diff --git a/src/elements/footer/__snapshots__/footer.snapshot.spec.snap.js b/src/elements/footer/__snapshots__/footer.snapshot.spec.snap.js index c4f8283396..ceff79ee6f 100644 --- a/src/elements/footer/__snapshots__/footer.snapshot.spec.snap.js +++ b/src/elements/footer/__snapshots__/footer.snapshot.spec.snap.js @@ -1,7 +1,16 @@ /* @web/test-runner snapshot v1 */ export const snapshots = {}; -snapshots["sbb-footer renders"] = +snapshots["sbb-footer renders DOM"] = +` + +`; +/* end snapshot sbb-footer renders DOM */ + +snapshots["sbb-footer renders Shadow DOM"] = ` `; -/* end snapshot sbb-footer renders */ +/* end snapshot sbb-footer renders Shadow DOM */ -snapshots["sbb-footer A11y tree Chrome"] = +snapshots["sbb-footer renders A11y tree Firefox"] = `

{ - "role": "WebArea", + "role": "document", "name": "", "children": [ { @@ -29,12 +38,12 @@ snapshots["sbb-footer A11y tree Chrome"] = }

`; -/* end snapshot sbb-footer A11y tree Chrome */ +/* end snapshot sbb-footer renders A11y tree Firefox */ -snapshots["sbb-footer A11y tree Firefox"] = +snapshots["sbb-footer renders A11y tree Chrome"] = `

{ - "role": "document", + "role": "WebArea", "name": "", "children": [ { @@ -46,5 +55,5 @@ snapshots["sbb-footer A11y tree Firefox"] = }

`; -/* end snapshot sbb-footer A11y tree Firefox */ +/* end snapshot sbb-footer renders A11y tree Chrome */ diff --git a/src/elements/footer/footer.snapshot.spec.ts b/src/elements/footer/footer.snapshot.spec.ts index 48e1b6d8e8..69ba51c88e 100644 --- a/src/elements/footer/footer.snapshot.spec.ts +++ b/src/elements/footer/footer.snapshot.spec.ts @@ -4,22 +4,24 @@ import { html } from 'lit/static-html.js'; import { fixture, testA11yTreeSnapshot } from '../core/testing/private.js'; import type { SbbFooterElement } from './footer.js'; - import './footer.js'; describe(`sbb-footer`, () => { - it('renders', async () => { - const element: SbbFooterElement = await fixture( - html``, - ); + describe('renders', () => { + let element: SbbFooterElement; - expect(element).dom.to.be.equal( - ` - - `, - ); - await expect(element).shadowDom.to.be.equalSnapshot(); - }); + beforeEach(async () => { + element = await fixture(html` `); + }); + + it('DOM', async () => { + await expect(element).dom.to.be.equalSnapshot(); + }); - testA11yTreeSnapshot(html``); + it('Shadow DOM', async () => { + await expect(element).shadowDom.to.be.equalSnapshot(); + }); + + testA11yTreeSnapshot(); + }); }); diff --git a/src/elements/footer/footer.visual.spec.ts b/src/elements/footer/footer.visual.spec.ts new file mode 100644 index 0000000000..9bf581038f --- /dev/null +++ b/src/elements/footer/footer.visual.spec.ts @@ -0,0 +1,89 @@ +import { html } from 'lit'; + +import { describeEach, describeViewports, visualDiffDefault } from '../core/testing/private.js'; + +import './footer.js'; +import '../button/button-link.js'; +import '../button/secondary-button-link.js'; +import '../clock.js'; +import '../divider.js'; +import '../link-list.js'; +import '../link/block-link.js'; + +describe(`sbb-footer`, () => { + const cases = { + expanded: [false, true], + negative: [false, true], + }; + + describeViewports({ viewports: ['zero', 'small', 'medium', 'wide'] }, () => { + describeEach(cases, ({ expanded, negative }) => { + it( + 'variant=default', + visualDiffDefault.with(async (setup) => { + await setup.withFixture( + html` + + + Refunds + Lost property office + + + `, + { padding: '0' }, + ); + }), + ); + + it( + 'variant=clock-columns', + visualDiffDefault.with(async (setup) => { + await setup.withFixture( + html` + + + + Jobs & careers + Rail traffic information + + + + + + Refunds + Lost property office + + + `, + { padding: '0' }, + ); + }), + ); + }); + }); +});