diff --git a/tools/visual-regression-testing/diff-app/src/components/overview/overview.ts b/tools/visual-regression-testing/diff-app/src/components/overview/overview.ts
index 8e1a9032e7..cf835c5219 100644
--- a/tools/visual-regression-testing/diff-app/src/components/overview/overview.ts
+++ b/tools/visual-regression-testing/diff-app/src/components/overview/overview.ts
@@ -1,7 +1,7 @@
import { LitElement, html, type TemplateResult, type CSSResultGroup } from 'lit';
import { customElement } from 'lit/decorators.js';
-import { screenshotService } from '../../screenshots.js';
+import { screenshots } from '../../screenshots.js';
import style from './overview.scss?lit&inline';
@@ -27,20 +27,18 @@ export class Overview extends LitElement {
Lyne visual regression comparison
- ${screenshotService.screenshots.stats}
+ ${screenshots.stats}
Start comparing
- ${screenshotService.screenshots.components.map(
+ ${screenshots.components.map(
(screenshotComponent) => html`
-
+
${screenshotComponent.name} (${screenshotComponent.stats})
diff --git a/tools/visual-regression-testing/diff-app/src/components/test-case/test-case.ts b/tools/visual-regression-testing/diff-app/src/components/test-case/test-case.ts
index 79ae973a20..000ecb9984 100644
--- a/tools/visual-regression-testing/diff-app/src/components/test-case/test-case.ts
+++ b/tools/visual-regression-testing/diff-app/src/components/test-case/test-case.ts
@@ -1,13 +1,13 @@
import {
- LitElement,
- html,
- type TemplateResult,
type CSSResultGroup,
+ html,
+ LitElement,
type PropertyValues,
+ type TemplateResult,
} from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
-import { screenshotService, type ScreenshotTestCase } from '../../screenshots.js';
+import { screenshots, type ScreenshotTestCase } from '../../screenshots.js';
import '../../../../../../src/components/button/secondary-button-link.js';
import '../../../../../../src/components/chip.js';
@@ -38,21 +38,40 @@ export class TestCase extends LitElement {
@property() public params?: { componentName: string; testCaseName: string };
@state() private _testCase?: ScreenshotTestCase;
+ @state() private _testCaseIndex: number = -1;
@state() private _filter: Filter = {};
protected override willUpdate(changedProperties: PropertyValues): void {
super.willUpdate(changedProperties);
if (changedProperties.has('params')) {
+ // Reset
this._filter = {};
this.shadowRoot!.querySelector('app-test-case-filter')?.reset();
- this._testCase = screenshotService.setCurrentTestCase(
+
+ // Get test case
+ this._testCaseIndex = screenshots.indexOfTestCase(
this.params!.componentName!,
this.params!.testCaseName!,
);
+ if (this._testCaseIndex >= 0) {
+ this._testCase = screenshots.getByTestCaseIndex(this._testCaseIndex);
+ }
}
}
+ private _progressFraction(): number {
+ return (this._testCaseIndex + 1) / screenshots.testCaseCount;
+ }
+
+ private _next(): ScreenshotTestCase | undefined {
+ return screenshots.getByTestCaseIndex(this._testCaseIndex + 1);
+ }
+
+ private _previous(): ScreenshotTestCase | undefined {
+ return screenshots.getByTestCaseIndex(this._testCaseIndex - 1);
+ }
+
private _viewportFilterChanged(event: CustomEvent): void {
this._filter = {
...this._filter,
@@ -70,10 +89,7 @@ export class TestCase extends LitElement {
public override render(): TemplateResult {
return html`
-
+