-
Notifications
You must be signed in to change notification settings - Fork 8
/
addAnnotatedTextAria.test.js
56 lines (54 loc) · 1.72 KB
/
addAnnotatedTextAria.test.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
'use strict';
const name = getName(__filename),
filterName = __filename.split('/').pop().split('.').shift(),
filter = require('./' + filterName);
describe(name, function () {
it('adds aria-describedby with incremented id', function () {
expect(filter([
{
_ref: 'localhost/components/clay-paragraph/instances/1',
text: '<span class=\"clay-annotated kiln-phrase\">hello</span>'
},
{
_ref: 'localhost/components/clay-paragraph/instances/2',
text: 'nothing annotated here'
},
{
_ref: 'localhost/components/clay-paragraph/instances/3',
text: '<span class=\"clay-annotated kiln-phrase\">hola</span>'
},
{
_ref: 'localhost/components/clay-annotated/instances/1',
text: 'yay'
},
{
_ref: 'localhost/components/clay-annotated/instances/2',
text: 'yay2'
}
])).to.deep.equal([
{
_ref: 'localhost/components/clay-paragraph/instances/1',
text: '<span class=\"clay-annotated kiln-phrase\" aria-describedby="annotation-1" tabindex="0">hello</span>'
},
{
_ref: 'localhost/components/clay-paragraph/instances/2',
text: 'nothing annotated here'
},
{
_ref: 'localhost/components/clay-paragraph/instances/3',
text: '<span class=\"clay-annotated kiln-phrase\" aria-describedby="annotation-2" tabindex="0">hola</span>'
},
{
_ref: 'localhost/components/clay-annotated/instances/1',
text: 'yay'
},
{
_ref: 'localhost/components/clay-annotated/instances/2',
text: 'yay2'
}
]);
});
it('always returns an array', function () {
expect(filter(null)).to.deep.equal([]);
});
});