-
Notifications
You must be signed in to change notification settings - Fork 791
/
layout-table-matches.js
52 lines (39 loc) · 1.49 KB
/
layout-table-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
42
43
44
45
46
47
48
49
50
51
52
describe('layout-table-matches', function() {
'use strict';
var fixture = document.getElementById('fixture');
var fixtureSetup = axe.testUtils.fixtureSetup;
var rule;
beforeEach(function() {
rule = axe._audit.rules.find(function(rule) {
return rule.id === 'layout-table';
});
});
afterEach(function() {
fixture.innerHTML = '';
});
it('returns false for element that is not focusable and has presentation role', function() {
fixtureSetup('<table role="presentation"></table>');
var target = fixture.querySelector('table');
assert.isFalse(rule.matches(target));
});
it('returns false for element that is not focusable and has none role', function() {
fixtureSetup('<table role="none"></table>');
var target = fixture.querySelector('table');
assert.isFalse(rule.matches(target));
});
it('returns trie for element that is a table without presentation/none role', function() {
fixtureSetup('<table></table>');
var target = fixture.querySelector('table');
assert.isTrue(rule.matches(target));
});
it('returns true for element that is focusable and has none role', function() {
fixtureSetup('<table role="none" tabindex="0"></table>');
var target = fixture.querySelector('table');
assert.isTrue(rule.matches(target));
});
it('returns true for element that is focusable and has presentation role', function() {
fixtureSetup('<table role="presentation" tabindex="0"></table>');
var target = fixture.querySelector('table');
assert.isTrue(rule.matches(target));
});
});