-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathkeyframes.test.js
71 lines (62 loc) · 1.47 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
62
63
64
65
66
67
68
69
70
71
import 'test-utils/setup-env'
import React from 'react'
import renderer from 'react-test-renderer'
import { keyframes, flush, css } from '@emotion/css'
describe('keyframes', () => {
afterEach(() => {
flush()
})
test('renders', () => {
const bounce = keyframes`
from, 20%, 53%, 80%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
transform: translate3d(0,0,0);
}
40%, 43% {
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
transform: translate3d(0, -30px, 0);
}
70% {
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
transform: translate3d(0, -15px, 0);
}
90% {
transform: translate3d(0,-4px,0);
}
`
const tree = renderer
.create(
<h1
className={css`
animation: ${bounce} 2s linear infinite;
`}
>
hello world
</h1>
)
.toJSON()
expect(tree).toMatchSnapshot()
})
test('keyframes with interpolation', () => {
const endingRotation = '360deg'
const tree = renderer
.create(
<h1
className={css`
animation: ${keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(${endingRotation});
}
`} 2s linear infinite;
`}
>
hello world
</h1>
)
.toJSON()
expect(tree).toMatchSnapshot()
})
})