forked from dequelabs/axe-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout-table-matches.js
More file actions
55 lines (44 loc) · 1.35 KB
/
Copy pathlayout-table-matches.js
File metadata and controls
55 lines (44 loc) · 1.35 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
describe('layout-table-matches', () => {
const fixture = document.getElementById('fixture');
const flatTreeSetup = axe.testUtils.flatTreeSetup;
let rule;
beforeEach(() => {
axe.configure({
rules: [
{
id: 'layout-rule',
matches: 'layout-table-matches'
}
]
});
rule = axe.utils.getRule('layout-rule');
});
afterEach(() => {
fixture.innerHTML = '';
axe.reset();
});
it('should return false for data table', () => {
fixture.innerHTML = '<table><caption>Hello></caption></table>';
flatTreeSetup(fixture);
const node = fixture.firstChild;
assert.isFalse(rule.matches(node));
});
it('should return false if the table is focusable', () => {
fixture.innerHTML = '<table tabindex="0"></table>';
flatTreeSetup(fixture);
const node = fixture.firstChild;
assert.isFalse(rule.matches(node));
});
it('should return true if table has role=presentation', () => {
fixture.innerHTML = '<table role="presentation"></table>';
flatTreeSetup(fixture);
const node = fixture.firstChild;
assert.isTrue(rule.matches(node));
});
it('should return true if table has role=none', () => {
fixture.innerHTML = '<table role="none"></table>';
flatTreeSetup(fixture);
const node = fixture.firstChild;
assert.isTrue(rule.matches(node));
});
});