forked from giuseppeg/styled-jsx-plugin-postcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
28 lines (24 loc) · 935 Bytes
/
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
const assert = require('assert')
const plugin = require('./')
describe('styled-jsx-plugin-postcss', () => {
it('applies browser list and preset-env features', () => {
assert.equal(
plugin('p { color: color-mod(red alpha(90%)); & img { display: block } }'),
'p { color: rgba(255, 0, 0, 0.9) }\np img { display: block }'
)
})
it('applies plugins', () => {
assert.equal(plugin('p { background-colour: grey; }'), 'p { background-color: gray; }')
})
it('works with placeholders', () => {
assert.equal(
plugin('p { color: %%styled-jsx-placeholder-0%%; & img { display: block; } } %%styled-jsx-placeholder-1%%'), 'p { color: %%styled-jsx-placeholder-0%% } p img { display: block; } %%styled-jsx-placeholder-1%%'
)
})
it('works with @import', () => {
assert.equal(
plugin('@import "./fixture.css"; p { color: red }'),
'div { color: red; } p { color: red }'
)
})
})