-
Notifications
You must be signed in to change notification settings - Fork 806
/
Copy pathnested-interactive-matches.js
33 lines (27 loc) · 1.08 KB
/
nested-interactive-matches.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
describe('nested-interactive-matches', function () {
const fixture = document.querySelector('#fixture');
const queryFixture = axe.testUtils.queryFixture;
let rule;
beforeEach(function () {
rule = axe.utils.getRule('nested-interactive');
});
afterEach(function () {
fixture.innerHTML = '';
});
it('should match if element has children presentational', function () {
const vNode = queryFixture('<button id="target"></button>');
assert.isTrue(rule.matches(null, vNode));
});
it('should match if aria element has children presentational', function () {
const vNode = queryFixture('<div role="button" id="target"></div>');
assert.isTrue(rule.matches(null, vNode));
});
it('should not match if element does not have children presentational', function () {
const vNode = queryFixture('<a href="foo.html" id="target"></a>');
assert.isFalse(rule.matches(null, vNode));
});
it('should not match if element has no role', function () {
const vNode = queryFixture('<span id="target"></span>');
assert.isFalse(rule.matches(null, vNode));
});
});