-
-
Notifications
You must be signed in to change notification settings - Fork 389
Expand file tree
/
Copy pathindex.test.js
More file actions
59 lines (52 loc) · 1.24 KB
/
index.test.js
File metadata and controls
59 lines (52 loc) · 1.24 KB
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
/* eslint-disable no-underscore-dangle */
import expect from 'expect.js'
import {stripIndent} from 'common-tags'
import {create} from 'jss'
import nested from 'jss-plugin-nested'
import template, {cache} from '.'
const settings = {
createGenerateId: () => rule => `${rule.key}-id`
}
describe('jss-plugin-template', () => {
let jss
beforeEach(() => {
jss = create(settings).use(template(), nested())
})
it('should cache parsed template', () => {
const a = `color: red`
jss.createStyleSheet({a})
expect(cache[a]).to.eql({color: 'red'})
})
it('should support @media', () => {
const sheet = jss.createStyleSheet({
'@media print': {
button: 'color: black;'
}
})
expect(sheet.toString()).to.be(stripIndent`
@media print {
.button-id {
color: black;
}
}
`)
})
it('should support @keyframes', () => {
const sheet = jss.createStyleSheet({
'@keyframes a': {
from: 'opacity: 0;',
to: 'opacity: 1;'
}
})
expect(sheet.toString()).to.be(stripIndent`
@keyframes keyframes-a-id {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
`)
})
})