-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
59 lines (55 loc) · 1.16 KB
/
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
57
58
59
const cssMatcher = require('jest-matcher-css')
const plugin = require('./index')
const { run } = require('../../testing/run')
expect.extend({
toMatchCss: cssMatcher,
})
it('should generate the sr classes', () => {
const config = {
content: [
{
raw: String.raw`
<span class="sr-only">text</span>
<span class="sr-undo">text</span>
<span class="sr-undo-absolute">text</span>
`,
},
],
corePlugins: {
accessibility: false,
},
}
const output = String.raw`
.sr-only {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.sr-undo {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
.sr-undo-absolute {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: absolute;
width: auto;
}
`
expect.assertions(2)
return run(plugin, config).then((result) => {
expect(result.warnings().length).toBe(0)
expect(result.css).toMatchCss(output)
})
})