-
Notifications
You must be signed in to change notification settings - Fork 804
/
Copy pathhas-implicit-chromium-role-matches.js
41 lines (33 loc) · 1.22 KB
/
has-implicit-chromium-role-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
34
35
36
37
38
39
40
41
describe('has-implicit-chromium-role-matches', function () {
'use strict';
let rule;
const fixture = document.getElementById('fixture');
const queryFixture = axe.testUtils.queryFixture;
beforeEach(function () {
rule = axe.utils.getRule('presentation-role-conflict');
});
afterEach(function () {
fixture.innerHTML = '';
});
it('is a function', function () {
assert.isFunction(rule.matches);
});
it('matches elements with an implicit role', function () {
const vNode = queryFixture('<main id="target"></main>');
assert.isTrue(rule.matches(null, vNode));
});
it('does not match elements with no implicit role', function () {
const vNode = queryFixture('<div id="target"></div>');
assert.isFalse(rule.matches(null, vNode));
});
it('matches elements with an implicit role in chromium', function () {
const vNode = queryFixture('<svg id="target"></svg>');
assert.isTrue(rule.matches(null, vNode));
});
it('does not match elements with no implicit role even if they are focusable and have an explicit role', function () {
const vNode = queryFixture(
'<div id="target" role="none" tabindex="1"></div>'
);
assert.isFalse(rule.matches(null, vNode));
});
});