-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
71 lines (62 loc) · 1.68 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
70
71
const postcss = require('postcss')
const plugin = require('./')
async function run(input, output, opts) {
const result = await postcss([plugin(opts)]).process(input, { from: undefined })
expect(result.css).toEqual(output)
expect(result.warnings()).toHaveLength(0)
}
it('border', async () => {
await run('a { border: 1px #000 solid; }', 'a { border: 1px #000 solid; }\n.hairlines a { border-width: 0.5px; }', {})
})
it('single border', async () => {
await run(
'a{ border-top: 1px #000 solid; }',
'a{ border-top: 1px #000 solid; }\n.hairlines a{ border-top-width: 0.5px; }',
{}
)
})
it('border width', async () => {
await run('a{ border-top-width: 1px; }', 'a{ border-top-width: 1px; }\n.hairlines a{ border-top-width: 0.5px; }', {})
})
it('single border width', async () => {
await run('a{ border-width: 1px; }', 'a{ border-width: 1px; }\n.hairlines a{ border-width: 0.5px; }', {})
})
it('composite border', async () => {
await run(
'a{ border: 1px #f00 solid; border-top: 1px #0f0 solid; border-top-width: 1px; }',
'a{ border: 1px #f00 solid; border-top: 1px #0f0 solid; border-top-width: 1px; }\n.hairlines a{ border-width: 0.5px; border-top-width: 0.5px; border-top-width: 0.5px; }',
{}
)
})
it('rule ignore', async () => {
await run(
`
/* hairlines-ignore */
a {
border: 1px #000 solid;
}
`,
`
/* hairlines-ignore */
a {
border: 1px #000 solid;
}
`,
{}
)
})
it('decl ignore', async () => {
await run(
`
a {
border: 1px #000 solid; /* hairlines-ignore */
}
`,
`
a {
border: 1px #000 solid; /* hairlines-ignore */
}
`,
{}
)
})