-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
59 lines (48 loc) · 1.14 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
const postcss = require('postcss')
const dedent = require("dedent");
const postcssSimpleVars = require('postcss-simple-vars')
const plugin = require('./')
async function run (input, output, opts = { }) {
let { plugins, ...pluginOpts } = opts
if (plugins === undefined) {
plugins = [plugin(pluginOpts)];
}
let result = await postcss(plugins).process(input, { from: undefined })
expect(result.css).toEqual(output)
expect(result.warnings()).toHaveLength(0)
}
it('parses a var darken call', async () => {
await run(
dedent`
$primary-color: #c84754;
td { background: darken($primary-color, 40%); }
`,
dedent`
td { background: #7d252e; }
`,
{
logLevel: 'debug',
plugins: [postcssSimpleVars, plugin]
}
)
})
it('parses a var lighten call', async () => {
await run(
dedent`
$primary-color: #c84754;
td { background: lighten($primary-color, 40%); }
`,
dedent`
td { background: #de9198; }
`,
{
logLevel: 'debug',
plugins: [postcssSimpleVars, plugin]
}
)
})
/* Write tests here
it('does something', async () => {
await run('a{ }', 'a{ }', { })
})
*/