Skip to content

Commit

Permalink
additional test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiety-deque committed May 2, 2024
1 parent b29a90d commit 53782f2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/checks/navigation/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,42 @@ describe('region', function () {
assert.isFalse(checkEvaluate.apply(checkContext, checkArgs));
});

it('should return true when canvas role=none', function () {
const checkArgs = checkSetup(`
<canvas id="target" role="none" />
<div role="main">Content</div>
`);

assert.isTrue(checkEvaluate.apply(checkContext, checkArgs));
});

it('should return false when object has an aria-label', function () {
const checkArgs = checkSetup(`
<object id="target" aria-label="bar"></object>
<div role="main">Content</div>
`);

assert.isFalse(checkEvaluate.apply(checkContext, checkArgs));
});

it('should return false when a non-landmark has text content but a role=none', function () {
const checkArgs = checkSetup(`
<div id="target" role="none">apples</div>
<div role="main">Content</div>
`);

assert.isFalse(checkEvaluate.apply(checkContext, checkArgs));
});

it('should return true when a non-landmark does NOT have text content and a role=none', function () {
const checkArgs = checkSetup(`
<div id="target" role="none"></div>
<div role="main">Content</div>
`);

assert.isTrue(checkEvaluate.apply(checkContext, checkArgs));
});

it('should return true when textless text content is outside the region', function () {
var checkArgs = checkSetup(
'<p id="target"></p><div role="main"><h1 id="mainheader" tabindex="0">Introduction</h1></div>'
Expand Down
5 changes: 5 additions & 0 deletions test/integration/full/region/region-fail.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<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 Down
10 changes: 10 additions & 0 deletions test/integration/full/region/region-pass.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
</head>
<body>
<a href="#mainheader" id="skiplink">This is a skip link.</a>
<!-- Decorative image -->
<img id="target" src="#" alt="" />
<!-- Decorative image -->
<img id="target" src="#" role="presentation" />
<!-- SVG's may be outside of a landmark -->
<svg role="none" aria-label="foo"></svg>
<!-- Div with a role of none may be outside a landmark -->
<div role="none"></div>
<!-- Canvas with a role of none may be outside a landmark -->
<canvas role="none" />
<div id="wrapper">
<div role="main">
<h1 id="mainheader" tabindex="0">This is a header.</h1>
Expand Down

0 comments on commit 53782f2

Please sign in to comment.