Skip to content

Commit

Permalink
test(selection-panel): implemented a11y tree snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMenga committed Jan 30, 2024
1 parent 01834e6 commit 63b4c3a
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,97 @@ snapshots["sbb-selection-panel renders - ShadowDom"] =
`;
/* end snapshot sbb-selection-panel renders - ShadowDom */

snapshots["sbb-selection-panel A11y tree Chrome"] =
`<p>
{
"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
}
]
}
</p>
`;
/* end snapshot sbb-selection-panel A11y tree Chrome */

snapshots["sbb-selection-panel A11y tree Firefox"] =
`<p>
{
"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"
}
]
}
</p>
`;
/* end snapshot sbb-selection-panel A11y tree Firefox */

snapshots["sbb-selection-panel A11y tree Safari"] =
`<p>
{
"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
}
]
}
</p>
`;
/* end snapshot sbb-selection-panel A11y tree Safari */

4 changes: 3 additions & 1 deletion src/components/selection-panel/selection-panel.spec.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -33,4 +33,6 @@ describe('sbb-selection-panel', () => {
await waitForLitRender(root);
await expect(root).shadowDom.to.be.equalSnapshot();
});

testA11yTreeSnapshot(undefined, template);
});

0 comments on commit 63b4c3a

Please sign in to comment.