Skip to content

Commit af6681b

Browse files
Merge pull request #667 from universal-ember/re-enable-a11y-testing
Re enable a11y testing
2 parents e101354 + 95c3cd3 commit af6681b

10 files changed

Lines changed: 204 additions & 621 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
node-version: 22
6666
- run: pnpm build
6767
- run: pnpm i -f # sync for some reason isn't running before lint
68-
- run: pnpm turbo test --filter test-app
68+
- run: pnpm turbo test:ember --filter test-app
6969

7070
floating:
7171
name: "Floating Dependencies"
@@ -80,7 +80,7 @@ jobs:
8080
pnpm-args: --no-lockfile
8181
- run: pnpm build
8282
- run: pnpm i -f # sync for some reason isn't running before lint
83-
- run: pnpm turbo test --filter test-app
83+
- run: pnpm turbo test:ember --filter test-app
8484

8585
compatibility:
8686
needs: ["test", "setup"]
@@ -156,7 +156,8 @@ jobs:
156156
repo-token: ${{ secrets.GITHUB_TOKEN }}
157157
- run: pnpm build
158158
- run: pnpm i -f # sync for some reason isn't running before lint
159-
- run: pnpm test --filter docs-app
159+
- run: pnpm test:ember
160+
working-directory: docs-app
160161

161162
DeployProduction:
162163
name: "Deploy: Production"

docs-app/app/templates/5-floaty-bits/portal-targets.gjs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The portal targets are stable element references that can be nested over and ove
88
- `modal` - for modal dialogs
99

1010
These render as three `<div>` elements with `data-portal-name` attributes:
11+
1112
```html
1213
<div data-portal-name="ember-primitives__portal-targets__popover"></div>
1314
<div data-portal-name="ember-primitives__portal-targets__tooltip"></div>

docs-app/app/templates/6-utils/shadowed.gjs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { CommentQuery } from 'kolay';
55
66
<template>
7-
<CommentQuery @module="components/shadowed" @name="Shadowed" />
7+
<CommentQuery @package="ember-primitives" @module="declarations/components/shadowed" @name="Shadowed" />
88
</template>
99
```
1010

docs-app/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"hash": "^0.2.1",
4646
"highlight.js": "^11.8.0",
4747
"highlightjs-glimmer": "^2.2.1",
48-
"kolay": "^5.0.1",
48+
"kolay": "^5.1.2",
4949
"limber-ui": "^4.1.1",
5050
"lorem-ipsum": "^2.0.8",
5151
"nvp.ui": "^0.5.3",
@@ -88,10 +88,11 @@
8888
"@types/qunit": "^2.19.10",
8989
"@types/rsvp": "^4.0.9",
9090
"autoprefixer": "^10.4.24",
91+
"axe-core": "^4.11.1",
9192
"babel-plugin-ember-template-compilation": "^4.0.0",
9293
"broccoli-asset-rev": "^3.0.0",
9394
"concurrently": "^9.2.1",
94-
"ember-a11y-testing": "^7.1.3",
95+
"ember-a11y-testing": "^8.0.0",
9596
"ember-page-title": "^9.0.3",
9697
"ember-qunit": "^9.0.4",
9798
"ember-resources": "^7.0.7",

docs-app/testem.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
'use strict';
22

33
if (typeof module !== 'undefined') {
4+
const { a11yMiddleware } = require('ember-a11y-testing/middleware');
5+
46
module.exports = {
57
test_page: 'tests/index.html?hidepassed',
68
cwd: 'dist',
9+
middleware: [a11yMiddleware],
710
disable_watching: true,
811
launch_in_ci: ['Chrome'],
912
launch_in_dev: ['Chrome'],

docs-app/tests/application/pages-test.ts

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@ import { module, test } from 'qunit';
33
import { setupApplicationTest } from 'ember-qunit';
44

55
import { colorScheme } from 'ember-primitives/color-scheme';
6+
import { docsManager } from 'kolay';
67

7-
// import { a11yAudit } from 'ember-a11y-testing/test-support';
8-
9-
async function a11yAudit(_options: any) {
10-
await Promise.resolve();
11-
console.debug(`a11y audit disabled until ember-a11y-testing supports native vite apps`);
12-
}
13-
14-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
15-
const pages: { path: string }[] = (window as any).__pages__;
8+
import { a11yAudit } from 'ember-a11y-testing/test-support';
169

1710
/**
1811
* per-page settings
@@ -71,8 +64,7 @@ async function checkA11y(assert: Assert, path: string, theme: string, settings:
7164
}
7265
}
7366

74-
const message =
75-
`no a11y errors found for ${path} using the ${theme} theme` + `\n\n` + errorText;
67+
const message = `${path}: no a11y errors found using the ${theme} theme` + `\n\n` + errorText;
7668

7769
if (window.location.search.includes('debugA11yAudit')) {
7870
console.error(errorText);
@@ -85,22 +77,39 @@ async function checkA11y(assert: Assert, path: string, theme: string, settings:
8577
module('Application | Pages', function (hooks) {
8678
setupApplicationTest(hooks);
8779

88-
for (const page of pages) {
89-
test(`${page.path}`, async function (assert) {
90-
const path = page.path.replace('.md', '');
80+
test('Pages all fit a11y criteria', async function (assert) {
81+
await visit('/');
82+
83+
const pages: { path: string }[] = [];
84+
85+
const docsService = docsManager(this);
86+
const groups = docsService.manifest.groups;
87+
88+
for (const group of groups) {
89+
for (const page of group.list) {
90+
pages.push(page);
91+
}
92+
}
93+
94+
assert.ok(pages.length > 10, `There are at least a few pages`);
95+
96+
for (const page of pages) {
97+
const path = page.path.replace('.gjs.md', '').replace('.md', '');
9198
const settings: object = a11yChecks[page.path] ?? {};
9299

93100
await visit(path);
94101
await waitUntil(() => findAll('nav a').length !== 0);
95102
await checkA11y(assert, path, 'default', settings);
96103

97-
assert.dom('[data-page-error]').doesNotExist();
104+
assert
105+
.dom('[data-page-error]')
106+
.doesNotExist(`${page.path}: does not contain [data-page-error]`);
98107

99108
colorScheme.update('dark');
100109
await checkA11y(assert, path, 'dark', settings);
101110

102111
colorScheme.update('light');
103112
await checkA11y(assert, path, 'light', settings);
104-
});
105-
}
113+
}
114+
});
106115
});

docs-app/tests/index.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323
import "ember-testing";
2424
</script>
2525

26-
<script type="module">
27-
window.Buffer = globalThis.Buffer = { isBuffer: () => false };
28-
29-
let response = await fetch("/kolay-manifest/manifest.json");
30-
let json = await response.json();
31-
let pages = json.groups[0].list;
32-
33-
// The accessibility page deliberately
34-
// has violations for demonstration
35-
window.__pages__ = pages.filter((page) => !page.path.includes("accessibility"));
36-
</script>
3726
<script type="module">
3827
import { start } from "./test-helper";
3928
import.meta.glob("./**/*.{js,ts,gjs,gts}", { eager: true });

docs-app/tests/test-helper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ import { start as qunitStart } from 'ember-qunit';
66
import Application from 'docs-app/app';
77
import config, { enterTestMode } from 'docs-app/config/environment';
88

9+
import { setupMiddlewareReporter } from 'ember-a11y-testing/test-support';
10+
911
QUnit.config.urlConfig.push({
1012
id: 'debugA11yAudit',
1113
label: 'Log a11y violations',
1214
});
1315

1416
export function start() {
1517
enterTestMode();
18+
setupMiddlewareReporter();
1619
setApplication(Application.create(config.APP));
1720

1821
setup(QUnit.assert);

packages/docs-support/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"ember-primitives": "workspace:^",
6363
"ember-resources": "^7.0.7",
6464
"inter-ui": "^4.0.2",
65-
"kolay": "^5.0.1",
65+
"kolay": "^5.1.2",
6666
"package-up": "^5.0.0",
6767
"read-package-up": "^12.0.0",
6868
"should-handle-link": "^1.2.2",

0 commit comments

Comments
 (0)