From 5e2efce0476a6c5577493904970e86d9da4ad1b6 Mon Sep 17 00:00:00 2001 From: Marco D'Auria Date: Fri, 15 Mar 2024 20:53:37 +0100 Subject: [PATCH] fix: tests --- .../__snapshots__/stepper.spec.snap.js | 91 +++++++++---------- .../stepper/stepper/stepper.spec.ts | 16 ++++ 2 files changed, 57 insertions(+), 50 deletions(-) diff --git a/src/components/stepper/stepper/__snapshots__/stepper.spec.snap.js b/src/components/stepper/stepper/__snapshots__/stepper.spec.snap.js index 9259c6fbfd5..e11de93a40e 100644 --- a/src/components/stepper/stepper/__snapshots__/stepper.spec.snap.js +++ b/src/components/stepper/stepper/__snapshots__/stepper.spec.snap.js @@ -18,7 +18,7 @@ snapshots["sbb-stepper renders"] = `; /* end snapshot sbb-stepper renders */ -snapshots["sbb-tab-group A11y tree Chrome"] = +snapshots["sbb-stepper A11y tree Chrome"] = `

{ "role": "WebArea", @@ -35,29 +35,24 @@ snapshots["sbb-tab-group A11y tree Chrome"] = }, { "role": "tab", - "name": "Test step label 3" + "name": "Test step label 3", + "disabled": true }, { "role": "tab", "name": "Test step label 4" }, { - "role": "tabpanel", - "name": "", - "children": [ - { - "role": "text", - "name": "Test step content 1" - } - ] + "role": "text", + "name": "Test step content 1" } ] }

`; -/* end snapshot sbb-tab-group A11y tree Chrome */ +/* end snapshot sbb-stepper A11y tree Chrome */ -snapshots["sbb-tab-group A11y tree Firefox"] = +snapshots["sbb-stepper A11y tree Firefox"] = `

{ "role": "document", @@ -65,83 +60,79 @@ snapshots["sbb-tab-group A11y tree Firefox"] = "children": [ { "role": "tab", - "name": "Test step label 1", + "name": "1 Test step label 1", "selected": true }, { "role": "tab", - "name": "Test step label 2" + "name": "2 Test step label 2" }, { "role": "tab", - "name": "Test step label 3" + "name": "3 Test step label 3", + "disabled": true }, { "role": "tab", - "name": "Test step label 4" + "name": "4 Test step label 4" + }, + { + "role": "text leaf", + "name": "Test step content 1" }, { "role": "tabpanel", - "name": "", - "children": [ - { - "role": "text leaf", - "name": "Test step content 1" - } - ] + "name": "2 Test step label 2" + }, + { + "role": "tabpanel", + "name": "3 Test step label 3" } ] }

`; -/* end snapshot sbb-tab-group A11y tree Firefox */ +/* end snapshot sbb-stepper A11y tree Firefox */ -snapshots["sbb-tab-group A11y tree Safari"] = +snapshots["sbb-stepper A11y tree Safari"] = `

{ "role": "WebArea", "name": "", "children": [ { - "role": "tab", - "name": "Test step label 1", - "selected": true + "role": "tabpanel", + "name": "3 Test step label 3" + }, + { + "role": "tabpanel", + "name": "2 Test step label 2" + }, + { + "role": "text", + "name": "Test step content 1" }, { "role": "tab", - "name": "Test step label 2" + "name": "1 Test step label 1", + "selected": true }, { "role": "tab", - "name": "Test step label 3" + "name": "2 Test step label 2" }, { "role": "tab", - "name": "Test step label 4" + "name": "3 Test step label 3", + "disabled": true }, { - "role": "tabpanel", - "name": "", - "children": [ - { - "role": "text", - "name": "Test step content 1" - } - ] + "role": "tab", + "name": "4 Test step label 4" } ] }

`; -/* end snapshot sbb-tab-group A11y tree Safari */ - -snapshots["sbb-stepper A11y tree Chrome"] = -`

- { - "role": "WebArea", - "name": "" -} -

-`; -/* end snapshot sbb-stepper A11y tree Chrome */ +/* end snapshot sbb-stepper A11y tree Safari */ diff --git a/src/components/stepper/stepper/stepper.spec.ts b/src/components/stepper/stepper/stepper.spec.ts index 20aec2dfe20..9bab0bc3790 100644 --- a/src/components/stepper/stepper/stepper.spec.ts +++ b/src/components/stepper/stepper/stepper.spec.ts @@ -3,8 +3,24 @@ import { html } from 'lit/static-html.js'; import { testA11yTreeSnapshot } from '../../core/testing/a11y-tree-snapshot'; import '.'; +import '../step'; +import '../step-label'; describe('sbb-stepper', () => { + beforeEach(async () => { + await fixture(html` + + Test step label 1 + Test step content 1 + Test step label 2 + Test step content 2 + Test step label 3 + Test step content 3 + Test step label 4 + + `); + }); + it('renders', async () => { const root = await fixture(html``); expect(root).dom.to.be.equal(``);