From 63b4c3a69eb0f83bd75e76264e089ad673b54b57 Mon Sep 17 00:00:00 2001 From: Tommmaso Menga Date: Tue, 30 Jan 2024 16:22:37 +0100 Subject: [PATCH] test(selection-panel): implemented a11y tree snapshot tests --- .../selection-panel.spec.snap.js | 94 +++++++++++++++++++ .../selection-panel/selection-panel.spec.ts | 4 +- 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/src/components/selection-panel/__snapshots__/selection-panel.spec.snap.js b/src/components/selection-panel/__snapshots__/selection-panel.spec.snap.js index 0ff74701239..ffbb04b7086 100644 --- a/src/components/selection-panel/__snapshots__/selection-panel.spec.snap.js +++ b/src/components/selection-panel/__snapshots__/selection-panel.spec.snap.js @@ -73,3 +73,97 @@ snapshots["sbb-selection-panel renders - ShadowDom"] = `; /* end snapshot sbb-selection-panel renders - ShadowDom */ +snapshots["sbb-selection-panel A11y tree Chrome"] = +`

+ { + "role": "WebArea", + "name": "", + "children": [ + { + "role": "text", + "name": "%" + }, + { + "role": "text", + "name": " " + }, + { + "role": "text", + "name": "from CHF" + }, + { + "role": "text", + "name": " " + }, + { + "role": "text", + "name": "19.99" + }, + { + "role": "checkbox", + "name": "​ Value one Suffix Subtext , collapsed", + "checked": false + } + ] +} +

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

+ { + "role": "document", + "name": "", + "children": [ + { + "role": "text leaf", + "name": "%" + }, + { + "role": "text leaf", + "name": "from CHF" + }, + { + "role": "text leaf", + "name": "19.99" + }, + { + "role": "checkbox", + "name": "​ Value one Suffix Subtext , collapsed" + } + ] +} +

+`; +/* end snapshot sbb-selection-panel A11y tree Firefox */ + +snapshots["sbb-selection-panel A11y tree Safari"] = +`

+ { + "role": "WebArea", + "name": "", + "children": [ + { + "role": "text", + "name": "%" + }, + { + "role": "text", + "name": "from CHF" + }, + { + "role": "text", + "name": "19.99" + }, + { + "role": "checkbox", + "name": "​ Value one Suffix Subtext , collapsed", + "checked": false + } + ] +} +

+`; +/* end snapshot sbb-selection-panel A11y tree Safari */ + diff --git a/src/components/selection-panel/selection-panel.spec.ts b/src/components/selection-panel/selection-panel.spec.ts index 4af7417b464..e6be6e08075 100644 --- a/src/components/selection-panel/selection-panel.spec.ts +++ b/src/components/selection-panel/selection-panel.spec.ts @@ -1,7 +1,7 @@ import { expect, fixture } from '@open-wc/testing'; import { html } from 'lit/static-html.js'; -import { waitForLitRender } from '../core/testing'; +import { testA11yTreeSnapshot, waitForLitRender } from '../core/testing'; import './selection-panel'; import '../checkbox'; @@ -33,4 +33,6 @@ describe('sbb-selection-panel', () => { await waitForLitRender(root); await expect(root).shadowDom.to.be.equalSnapshot(); }); + + testA11yTreeSnapshot(undefined, template); });