OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../resources/testharness.js"></script> | |
3 <script src="../resources/testharnessreport.js"></script> | |
4 <script> | |
5 var typeError = {name: 'TypeError'}; | |
6 var timing = new KeyframeEffect(null, null).timing; | |
7 | |
8 test(function() { | |
9 timing.delay = 2; | |
10 assert_equals(timing.delay, 2); | |
11 timing.delay = -4; | |
12 assert_equals(timing.delay, -4); | |
13 | |
14 assert_throws(typeError, () => timing.delay = NaN); | |
15 assert_equals(timing.delay, -4); | |
16 | |
17 assert_throws(typeError, () => timing.delay = Infinity); | |
18 assert_equals(timing.delay, -4); | |
19 }, 'AnimationEffectTiming should have a setter for delay.'); | |
20 | |
21 test(function() { | |
22 timing.endDelay = 0.5; | |
23 assert_equals(timing.endDelay, 0.5); | |
24 | |
25 timing.endDelay = -5; | |
26 assert_equals(timing.endDelay, -5); | |
27 | |
28 assert_throws(typeError, () => timing.endDelay = NaN); | |
29 assert_equals(timing.endDelay, -5); | |
30 | |
31 assert_throws(typeError, () => timing.endDelay = Infinity); | |
32 assert_equals(timing.endDelay, -5); | |
33 }, 'AnimationEffectTiming should have a setter for endDelay.'); | |
34 | |
35 test(function() { | |
36 timing.fill = 'backwards'; | |
37 assert_equals(timing.fill, 'backwards'); | |
38 | |
39 timing.fill = 'both'; | |
40 assert_equals(timing.fill, 'both'); | |
41 }, 'AnimationEffectTiming should have a setter for fill.'); | |
42 | |
43 test(function() { | |
44 timing.iterationStart = 1.5; | |
45 assert_equals(timing.iterationStart, 1.5); | |
46 | |
47 assert_throws(typeError, () => timing.iterationStart = -0.5); | |
48 assert_equals(timing.iterationStart, 1.5); | |
49 | |
50 assert_throws(typeError, () => timing.iterationStart = NaN); | |
51 assert_equals(timing.iterationStart, 1.5); | |
52 | |
53 assert_throws(typeError, () => timing.iterationStart = Infinity); | |
54 assert_equals(timing.iterationStart, 1.5); | |
55 }, 'AnimationEffectTiming should have a setter for iterationStart.'); | |
56 | |
57 test(function() { | |
58 timing.iterations = 10; | |
59 assert_equals(timing.iterations, 10); | |
60 | |
61 timing.iterations = Infinity; | |
62 assert_equals(timing.iterations, Infinity); | |
63 | |
64 assert_throws(typeError, () => timing.iterations = -20); | |
65 assert_equals(timing.iterations, Infinity); | |
66 | |
67 assert_throws(typeError, () => timing.iterations = NaN); | |
68 assert_equals(timing.iterations, Infinity); | |
69 }, 'AnimationEffectTiming should have a setter for iterations.'); | |
70 | |
71 test(function() { | |
72 timing.duration = Infinity; | |
73 assert_equals(timing.duration, Infinity); | |
74 | |
75 timing.duration = 1234; | |
76 assert_equals(timing.duration, 1234); | |
77 | |
78 assert_throws(typeError, () => timing.duration = -10); | |
79 assert_equals(timing.duration, 1234); | |
80 | |
81 assert_throws(typeError, () => timing.duration = NaN); | |
82 assert_equals(timing.duration, 1234); | |
83 | |
84 assert_throws(typeError, () => timing.duration = 'very long'); | |
85 assert_equals(timing.duration, 1234); | |
86 }, 'AnimationEffectTiming should have a setter for duration.'); | |
87 | |
88 test(function() { | |
89 timing.playbackRate = 2; | |
90 assert_equals(timing.playbackRate, 2); | |
91 | |
92 timing.playbackRate = -2; | |
93 assert_equals(timing.playbackRate, -2); | |
94 | |
95 assert_throws(typeError, () => timing.playbackRate = NaN); | |
96 assert_equals(timing.playbackRate, -2); | |
97 }, 'AnimationEffectTiming should have a setter for playbackRate.'); | |
98 | |
99 test(function() { | |
100 timing.direction = 'reverse'; | |
101 assert_equals(timing.direction, 'reverse'); | |
102 | |
103 timing.direction = 'alternate'; | |
104 assert_equals(timing.direction, 'alternate'); | |
105 }, 'AnimationEffectTiming should have a setter for direction.'); | |
106 | |
107 test(function() { | |
108 timing.easing = "step-start"; | |
109 assert_equals(timing.easing, 'step-start'); | |
110 | |
111 timing.easing = "eAse\\2d iN-ouT"; | |
112 assert_equals(timing.easing, 'ease-in-out'); | |
113 | |
114 | |
115 assert_throws(typeError, () => timing.easing = 'ponies'); | |
116 assert_equals(timing.easing, 'ease-in-out'); | |
117 }, 'AnimationEffectTiming should have a setter for easing.'); | |
118 </script> | |
OLD | NEW |