Skip to content

Commit b412ec2

Browse files
authored
Merge pull request #293 from umbraco/v1/feature/a11y-tests
V1/feature/a11y tests
2 parents 901da47 + 72b1211 commit b412ec2

File tree

5 files changed

+58
-31
lines changed

5 files changed

+58
-31
lines changed

package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
"@types/chai": "4.3.3",
7474
"@typescript-eslint/eslint-plugin": "5.32.0",
7575
"@typescript-eslint/parser": "5.30.7",
76-
"@web/dev-server-esbuild": "0.3.1",
76+
"@web/dev-server-esbuild": "0.3.2",
7777
"@web/test-runner": "0.14.0",
78-
"@web/test-runner-playwright": "0.8.9",
78+
"@web/test-runner-playwright": "0.8.10",
7979
"autoprefixer": "10.4.7",
8080
"babel-loader": "8.2.5",
8181
"chromatic": "6.7.1",

packages/uui-button/lib/uui-button.test.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import '.';
2+
13
import {
2-
html,
3-
fixture,
4+
elementUpdated,
45
expect,
6+
fixture,
7+
html,
58
oneEvent,
6-
elementUpdated,
79
} from '@open-wc/testing';
10+
import {
11+
InterfaceColorValues,
12+
InterfaceLookValues,
13+
} from '@umbraco-ui/uui-base/lib/types';
14+
815
import { UUIButtonElement } from './uui-button.element';
9-
import '.';
1016

1117
describe('UuiButton', () => {
1218
let formElement: HTMLFormElement;
@@ -35,8 +41,23 @@ describe('UuiButton', () => {
3541
});
3642

3743
it('passes the a11y audit', async () => {
38-
await expect(element).shadowDom.to.be.accessible();
39-
});
44+
for (const color of InterfaceColorValues) {
45+
for (const look of InterfaceLookValues) {
46+
for (const disabled of [true, false]) {
47+
element = await fixture(
48+
html` <uui-button
49+
label="Continue"
50+
.disabled=${disabled}
51+
.look=${look}
52+
.color=${color}>
53+
Continue
54+
</uui-button>`
55+
);
56+
await expect(element).to.be.accessible();
57+
}
58+
}
59+
}
60+
}).timeout(30000);
4061

4162
describe('properties', () => {
4263
it('has a label property', () => {

packages/uui-table/lib/uui-table.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { html, fixture, expect, elementUpdated } from '@open-wc/testing';
2-
import { UUITableElement } from './uui-table.element';
3-
import { UUITableRowElement } from './uui-table-row.element';
1+
import '.';
2+
3+
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
4+
45
import { UUITableCellElement } from './uui-table-cell.element';
5-
import './index';
6+
import { UUITableRowElement } from './uui-table-row.element';
7+
import { UUITableElement } from './uui-table.element';
68

79
describe('UuiTable', () => {
810
let table: UUITableElement;
@@ -28,7 +30,7 @@ describe('UuiTable', () => {
2830
<uui-table-row>
2931
<uui-table-cell>Hello 3</uui-table-cell>
3032
<uui-table-cell>Hello 3</uui-table-cell>
31-
<uui-table-cell>Hello 3</uui-table-cell>
33+
<uui-table-cell>Hello long text 3</uui-table-cell>
3234
</uui-table-row>
3335
</uui-table>
3436
`
@@ -48,7 +50,8 @@ describe('UuiTable', () => {
4850
?.assignedElements()[2] as UUITableCellElement;
4951
cell.setAttribute('clip-text', 'true');
5052
await elementUpdated(cell);
51-
expect(cell.title).to.equal('Hello 3');
53+
expect(cell).to.have.attribute('title', 'Hello long text 3');
54+
expect(cell.title).to.equal('Hello long text 3');
5255
});
5356

5457
it('ROW: Adds selected attribute when clicked', async () => {

web-test-runner.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export default {
1212
],
1313
testRunnerHtml: testFramework =>
1414
`<html>
15+
<head>
16+
<link rel="stylesheet" href="/packages/uui-css/dist/uui-css.css">
17+
</head>
1518
<body>
1619
<script type="module" src="${testFramework}"></script>
1720
<script type="module">

0 commit comments

Comments
 (0)