Skip to content

Commit

Permalink
targeted test failure cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiety-deque committed May 2, 2024
1 parent 53782f2 commit 8938496
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
21 changes: 16 additions & 5 deletions test/integration/full/region/region-fail.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<a href="stuff.html#mainheader" id="notskiplink"
>This is not a skip link.</a
>
<img src="#" />
<img src="#" tabindex="0" alt="" />
<img src="#" aria-atomic="true" alt="" />
<object aria-label="bar"></object>
<div id="target" role="none">apples</div>
<form>
<div>
<h1 id="mainheader" tabindex="0">This is a header.</h1>
Expand All @@ -45,6 +40,22 @@ <h1 id="mainheader" tabindex="0">This is a header.</h1>
</section>
</div>

<div id="img-no-alt">
<img src="#" />
</div>
<div id="img-focusable">
<img src="#" tabindex="0" alt="" />
</div>
<div id="img-aria-global">
<img src="#" aria-atomic="true" alt="" />
</div>
<div id="labeled-object">
<object aria-label="bar"></object>
</div>
<div id="none-role-div">
<div id="target" role="none">apples</div>
</div>

This should be ignored

<main id="mocha"></main>
Expand Down
32 changes: 30 additions & 2 deletions test/integration/full/region/region-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,40 @@ describe('region fail test', function () {
});

describe('violations', function () {
it('should find one', function () {
assert.lengthOf(results.violations[0].nodes, 1);
it('should find all violations', function () {
assert.lengthOf(results.violations[0].nodes, 6);
});

it('should find wrapper', function () {
assert.deepEqual(results.violations[0].nodes[0].target, ['#wrapper']);
});

it('should find image without an alt tag', function () {
assert.deepEqual(results.violations[0].nodes[1].target, ['#img-no-alt']);
});

it('should find focusable image', function () {
assert.deepEqual(results.violations[0].nodes[2].target, [
'#img-focusable'
]);
});

it('should find image with global aria attr', function () {
assert.deepEqual(results.violations[0].nodes[3].target, [
'#img-aria-global'
]);
});

it('should find object with a label', function () {
assert.deepEqual(results.violations[0].nodes[4].target, [
'#labeled-object'
]);
});

it('should find div with an role of none', function () {
assert.deepEqual(results.violations[0].nodes[5].target, [
'#none-role-div'
]);
});
});
});

0 comments on commit 8938496

Please sign in to comment.