-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
44 lines (39 loc) · 1.25 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
const assert = require('assert')
const plugin = require('./')
describe('styled-jsx-plugin-root-theme-provider', () => {
it('applies plugins', () => {
assert.equal(
plugin(':root {--red: #dc3545;} .selector {background: var(--red);}'),
':root {--red: #dc3545;} .selector {background: #dc3545;background: var(--red);}'
)
})
it('applies theme', () => {
assert.equal(
plugin('.selector {background: var(--red);}', { themeFilePath: './fixture-theme.css' }),
'.selector {background: red;background: var(--red);}'
)
})
it('applies postcss-custom-media', () => {
assert.equal(
plugin('@media (--small-viewport) {b {font-size: 1em;}}', { themeFilePath: './fixture-theme.css' }),
'@media (max-width: 30em) {b {font-size: 1em;}}'
)
})
it('applies color-mod', () => {
assert.equal(
plugin('b { color: color-mod(black a(90%));}'),
'b { color: rgba(0, 0, 0, 0.9);}'
)
})
it('applies postcssPresetEnvOptions', () => {
assert.equal(
plugin('@media (--small-viewport) {b {font-size: 1em;}}', {
themeFilePath: './fixture-theme.css',
postcssPresetEnvOptions: {
stage: 2
}
}),
'@media (--small-viewport) {b {font-size: 1em;}}'
)
})
})