-
Notifications
You must be signed in to change notification settings - Fork 800
/
Copy pathlist.js
36 lines (32 loc) · 1.18 KB
/
list.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
describe('list virtual-rule', () => {
it('passes when there are no invalid child nodes', () => {
const ul = new axe.SerialVirtualNode({ nodeName: 'ul' });
const li = new axe.SerialVirtualNode({ nodeName: 'li' });
ul.children = [li];
li.parent = ul;
const results = axe.runVirtualRule('list', ul);
assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 0);
});
it('fails when there is an invalid child node', () => {
const ul = new axe.SerialVirtualNode({ nodeName: 'ul' });
const span = new axe.SerialVirtualNode({
nodeName: 'span',
attributes: {}
});
ul.children = [span];
span.parent = ul;
const results = axe.runVirtualRule('list', ul);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
it('is incomplete without child nodes', () => {
const ul = new axe.SerialVirtualNode({ nodeName: 'ul' });
const results = axe.runVirtualRule('list', ul);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 1);
});
});