-
Notifications
You must be signed in to change notification settings - Fork 800
/
Copy pathdefinition-list.js
52 lines (46 loc) · 1.81 KB
/
definition-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
describe('definition-list virtual-rule', () => {
it('passes when there are no invalid child nodes', () => {
const dl = new axe.SerialVirtualNode({ nodeName: 'dl' });
const dt = new axe.SerialVirtualNode({ nodeName: 'dt' });
const dd = new axe.SerialVirtualNode({ nodeName: 'dd' });
dl.children = [dt, dd];
dt.parent = dl;
dd.parent = dl;
const results = axe.runVirtualRule('definition-list', dl);
assert.lengthOf(results.passes, 1);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 0);
});
it('fails when there no dd / dt pair', () => {
const dl = new axe.SerialVirtualNode({ nodeName: 'dl' });
const dd1 = new axe.SerialVirtualNode({ nodeName: 'dd' });
const dd2 = new axe.SerialVirtualNode({ nodeName: 'dd' });
dl.children = [dd1, dd2];
dd1.parent = dl;
dd2.parent = dl;
const results = axe.runVirtualRule('definition-list', dl);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
it('fails when there is an invalid child nodes', () => {
const dl = new axe.SerialVirtualNode({ nodeName: 'dl' });
const span = new axe.SerialVirtualNode({
nodeName: 'span',
attributes: {}
});
dl.children = [span];
span.parent = dl;
const results = axe.runVirtualRule('definition-list', dl);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 1);
assert.lengthOf(results.incomplete, 0);
});
it('is incomplete without child nodes', () => {
const dl = new axe.SerialVirtualNode({ nodeName: 'dl' });
const results = axe.runVirtualRule('definition-list', dl);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 0);
assert.lengthOf(results.incomplete, 1);
});
});