-
Notifications
You must be signed in to change notification settings - Fork 805
/
Copy patharia-roledescription.js
95 lines (78 loc) · 2.65 KB
/
aria-roledescription.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
describe('aria-roledescription virtual-rule', function () {
it('should pass for elements with an implicit supported role', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'button',
attributes: {
'aria-roledescription': 'Awesome Button'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 0);
});
it('should pass for elements with an explicit supported role', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
'aria-roledescription': 'Awesome Radio',
role: 'radio'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 0);
});
it('should incomplete for elements with an unsupported role', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
'aria-roledescription': 'Awesome Main',
role: 'main'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 1);
});
it('should fail for elements without role', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
'aria-roledescription': 'Awesome Main'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
it('should fail for elements with role=presentation', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
'aria-roledescription': 'Awesome Main',
role: 'presentation'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
it('should fail for elements with role=none', function () {
var node = new axe.SerialVirtualNode({
nodeName: 'div',
attributes: {
'aria-roledescription': 'Awesome Main',
role: 'none'
}
});
var results = axe.runVirtualRule('aria-roledescription', node);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
});