-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathcan-animate.test.ts
More file actions
25 lines (20 loc) · 820 Bytes
/
can-animate.test.ts
File metadata and controls
25 lines (20 loc) · 820 Bytes
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
import { canAnimate } from "../can-animate"
describe("canAnimate", () => {
it("returns true for valid filter blur keyframes", () => {
expect(
canAnimate(["blur(10px)", "blur(0px)"], "filter")
).toBeTruthy()
})
it("returns false for bare filter function names without parentheses", () => {
expect(canAnimate(["blur(10px)", "blur"], "filter")).toBeFalsy()
})
it("returns false when both keyframes are non-animatable", () => {
expect(canAnimate(["blur", "blur"], "filter")).toBeFalsy()
})
it("returns false when origin keyframe is null", () => {
expect(canAnimate([null, "blur(10px)"], "filter")).toBe(false)
})
it("returns true for opacity keyframes", () => {
expect(canAnimate([0, 1], "opacity")).toBeTruthy()
})
})