-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
keyframes.test.js
61 lines (55 loc) 路 1.04 KB
/
keyframes.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
60
61
// @flow
import expect from 'expect'
import _keyframes from '../keyframes'
import styleSheet from '../../models/StyleSheet'
import { expectCSSMatches, resetStyled } from '../../test/utils'
/**
* Setup
*/
let index = 0
const keyframes = _keyframes(() => `keyframe_${index++}`)
describe('keyframes', () => {
beforeEach(() => {
resetStyled()
index = 0
})
it('should return its name', () => {
expect(keyframes`
0% {
opacity: 0;
}
100% {
opacity: 1;
}
`).toEqual('keyframe_0')
})
it('should insert the correct styles', () => {
const rules = `
0% {
opacity: 0;
}
100% {
opacity: 1;
}
`
const name = keyframes`${rules}`
expectCSSMatches(`
@keyframes keyframe_0 {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes keyframe_0 {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
`, { styleSheet })
})
})