Skip to content

Commit

Permalink
Add failing test for local a11yAudit rule overrides.
Browse files Browse the repository at this point in the history
  • Loading branch information
deanmarano committed Nov 8, 2024
1 parent c0af827 commit 38a5744
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/acceptance/a11y-audit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,23 @@ module('Acceptance | a11y audit', function (hooks) {
assert.ok(true, 'the image-alt rule should be ignored');
});

test('a11yAudit does not override default config', async function (assert) {
await visit('/ignored-image-alt');
test('a11yAudit does not override default config when passing additional rules', async function (assert) {
await visit('/ignored-image-alt-and-button-name');

setRunOptions({
rules: {
// Disabled to test whether the config is
// properly loaded in test environment
'image-alt': { enabled: false },
'button-name': { enabled: false },
},
});

// Pass unrelated rules at runtime, should not override setRunOptions
await a11yAudit({ rules: { 'color-contrast': { enabled: false } } });
await a11yAudit({
rules: {
'image-alt': { enabled: false },
},
});

assert.ok(true, 'the image-alt rule should be ignored');
});
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export default class Router extends EmberRouter {
Router.map(function () {
this.route('violations', { path: '/' });
this.route('ignored-image-alt');
this.route('ignored-image-alt-and-button-name');
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{!-- template-lint-disable require-valid-alt-text --}}
<img src="" />

<button type="button" class="c-button" id="violations__empty-button" data-test-selector="empty-button"></button>

0 comments on commit 38a5744

Please sign in to comment.