-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
50 lines (46 loc) · 1.06 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
const assert = require('assert')
const stripIndent = require('strip-indent')
const plugin = require('./')
const cleanup = str => stripIndent(str).trim()
describe('styled-jsx-plugin-less', () => {
it('applies variables', () => {
assert.equal(
plugin('@red: #fff; p { img { display: block} color: @red }').trim(),
cleanup(`
p {
color: #fff;
}
p img {
display: block;
}
`)
)
})
it('works with expressions placeholders', () => {
assert.equal(
plugin('p { img { display: block } color: %%styled-jsx-placeholder-1%%; } %%styled-jsx-placeholder-1%%').trim(),
cleanup(`
p {
color: %%styled-jsx-placeholder-1%%;
}
p img {
display: block;
}
%%styled-jsx-placeholder-1%%
`)
)
})
it('works with @import', () => {
assert.equal(
plugin('@import "fixture"; p { color: red }').trim(),
cleanup(`
div {
color: red;
}
p {
color: red;
}
`)
)
})
})