OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <div id='container'> | 4 <div id='container'> |
5 <div id='element'></div> | 5 <div id='element'></div> |
6 </div> | 6 </div> |
7 | 7 |
8 <script> | 8 <script> |
9 | 9 |
10 var container = document.getElementById('container'); | 10 var container = document.getElementById('container'); |
11 var element = document.getElementById('element'); | 11 var element = document.getElementById('element'); |
12 | 12 |
13 test(function() { | 13 test(function() { |
14 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 14 assert_equals(document.timeline.getAnimations().length, 0); |
15 assert_equals(container.getAnimationPlayers().length, 0); | 15 assert_equals(container.getAnimations().length, 0); |
16 assert_equals(element.getAnimationPlayers().length, 0); | 16 assert_equals(element.getAnimations().length, 0); |
17 | 17 |
18 var player = element.animate([], 1000); | 18 var animation = element.animate([], 1000); |
19 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 19 assert_equals(document.timeline.getAnimations().length, 1); |
20 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 20 assert_equals(document.timeline.getAnimations()[0], animation); |
21 | 21 |
22 var player2 = container.animate([], 1000); | 22 var animation2 = container.animate([], 1000); |
23 assert_equals(document.timeline.getAnimationPlayers().length, 2); | 23 assert_equals(document.timeline.getAnimations().length, 2); |
24 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 24 assert_equals(document.timeline.getAnimations()[0], animation); |
25 assert_equals(document.timeline.getAnimationPlayers()[1], player2); | 25 assert_equals(document.timeline.getAnimations()[1], animation2); |
26 | 26 |
27 player.finish(); | 27 animation.finish(); |
28 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 28 assert_equals(document.timeline.getAnimations().length, 1); |
29 assert_equals(document.timeline.getAnimationPlayers()[0], player2); | 29 assert_equals(document.timeline.getAnimations()[0], animation2); |
30 | 30 |
31 player2.finish(); | 31 animation2.finish(); |
32 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 32 assert_equals(document.timeline.getAnimations().length, 0); |
33 }, 'Timeline getAnimationPlayers()'); | 33 }, 'Timeline getAnimations()'); |
34 | 34 |
35 test(function() { | 35 test(function() { |
36 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 36 assert_equals(document.timeline.getAnimations().length, 0); |
37 assert_equals(container.getAnimationPlayers().length, 0); | 37 assert_equals(container.getAnimations().length, 0); |
38 assert_equals(element.getAnimationPlayers().length, 0); | 38 assert_equals(element.getAnimations().length, 0); |
39 | 39 |
40 var player = element.animate([], 1000); | 40 var animation = element.animate([], 1000); |
41 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 41 assert_equals(document.timeline.getAnimations().length, 1); |
42 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 42 assert_equals(document.timeline.getAnimations()[0], animation); |
43 assert_equals(container.getAnimationPlayers().length, 0); | 43 assert_equals(container.getAnimations().length, 0); |
44 assert_equals(element.getAnimationPlayers().length, 1); | 44 assert_equals(element.getAnimations().length, 1); |
45 assert_equals(element.getAnimationPlayers()[0], player); | 45 assert_equals(element.getAnimations()[0], animation); |
46 | 46 |
47 var player2 = container.animate([], 1000); | 47 var animation2 = container.animate([], 1000); |
48 assert_equals(document.timeline.getAnimationPlayers().length, 2); | 48 assert_equals(document.timeline.getAnimations().length, 2); |
49 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 49 assert_equals(document.timeline.getAnimations()[0], animation); |
50 assert_equals(document.timeline.getAnimationPlayers()[1], player2); | 50 assert_equals(document.timeline.getAnimations()[1], animation2); |
51 assert_equals(container.getAnimationPlayers().length, 1); | 51 assert_equals(container.getAnimations().length, 1); |
52 assert_equals(container.getAnimationPlayers()[0], player2); | 52 assert_equals(container.getAnimations()[0], animation2); |
53 assert_equals(element.getAnimationPlayers().length, 1); | 53 assert_equals(element.getAnimations().length, 1); |
54 assert_equals(element.getAnimationPlayers()[0], player); | 54 assert_equals(element.getAnimations()[0], animation); |
55 | 55 |
56 player.finish(); | 56 animation.finish(); |
57 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 57 assert_equals(document.timeline.getAnimations().length, 1); |
58 assert_equals(document.timeline.getAnimationPlayers()[0], player2); | 58 assert_equals(document.timeline.getAnimations()[0], animation2); |
59 assert_equals(container.getAnimationPlayers().length, 1); | 59 assert_equals(container.getAnimations().length, 1); |
60 assert_equals(container.getAnimationPlayers()[0], player2); | 60 assert_equals(container.getAnimations()[0], animation2); |
61 assert_equals(element.getAnimationPlayers().length, 0); | 61 assert_equals(element.getAnimations().length, 0); |
62 | 62 |
63 player2.finish(); | 63 animation2.finish(); |
64 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 64 assert_equals(document.timeline.getAnimations().length, 0); |
65 assert_equals(container.getAnimationPlayers().length, 0); | 65 assert_equals(container.getAnimations().length, 0); |
66 assert_equals(element.getAnimationPlayers().length, 0); | 66 assert_equals(element.getAnimations().length, 0); |
67 | 67 |
68 }, 'Animatable getAnimationPlayers()'); | 68 }, 'Animatable getAnimations()'); |
69 | 69 |
70 test(function() { | 70 test(function() { |
71 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 71 assert_equals(document.timeline.getAnimations().length, 0); |
72 assert_equals(container.getAnimationPlayers().length, 0); | 72 assert_equals(container.getAnimations().length, 0); |
73 assert_equals(element.getAnimationPlayers().length, 0); | 73 assert_equals(element.getAnimations().length, 0); |
74 | 74 |
75 var player = element.animate([], {duration: 1000, delay: 500}); | 75 var animation = element.animate([], {duration: 1000, delay: 500}); |
76 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 76 assert_equals(document.timeline.getAnimations().length, 1); |
77 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 77 assert_equals(document.timeline.getAnimations()[0], animation); |
78 assert_equals(container.getAnimationPlayers().length, 0); | 78 assert_equals(container.getAnimations().length, 0); |
79 assert_equals(element.getAnimationPlayers().length, 1); | 79 assert_equals(element.getAnimations().length, 1); |
80 assert_equals(element.getAnimationPlayers()[0], player); | 80 assert_equals(element.getAnimations()[0], animation); |
81 | 81 |
82 player.finish(); | 82 animation.finish(); |
83 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 83 assert_equals(document.timeline.getAnimations().length, 0); |
84 assert_equals(container.getAnimationPlayers().length, 0); | 84 assert_equals(container.getAnimations().length, 0); |
85 assert_equals(element.getAnimationPlayers().length, 0); | 85 assert_equals(element.getAnimations().length, 0); |
86 | 86 |
87 }, 'getAnimationPlayers() with delays'); | 87 }, 'getAnimations() with delays'); |
88 | 88 |
89 test(function() { | 89 test(function() { |
90 assert_equals(document.timeline.getAnimationPlayers().length, 0); | 90 assert_equals(document.timeline.getAnimations().length, 0); |
91 assert_equals(container.getAnimationPlayers().length, 0); | 91 assert_equals(container.getAnimations().length, 0); |
92 assert_equals(element.getAnimationPlayers().length, 0); | 92 assert_equals(element.getAnimations().length, 0); |
93 | 93 |
94 var player = element.animate([], {duration: 1000, delay: 500, fill: 'both'})
; | 94 var animation = element.animate([], {duration: 1000, delay: 500, fill: 'both
'}); |
95 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 95 assert_equals(document.timeline.getAnimations().length, 1); |
96 assert_equals(document.timeline.getAnimationPlayers()[0], player); | 96 assert_equals(document.timeline.getAnimations()[0], animation); |
97 assert_equals(container.getAnimationPlayers().length, 0); | 97 assert_equals(container.getAnimations().length, 0); |
98 assert_equals(element.getAnimationPlayers().length, 1); | 98 assert_equals(element.getAnimations().length, 1); |
99 assert_equals(element.getAnimationPlayers()[0], player); | 99 assert_equals(element.getAnimations()[0], animation); |
100 | 100 |
101 player.finish(); | 101 animation.finish(); |
102 assert_equals(document.timeline.getAnimationPlayers().length, 1); | 102 assert_equals(document.timeline.getAnimations().length, 1); |
103 // assert_equals(container.getAnimationPlayers().length, 1); | 103 // assert_equals(container.getAnimations().length, 1); |
104 // assert_equals(element.getAnimationPlayers().length, 1); | 104 // assert_equals(element.getAnimations().length, 1); |
105 | 105 |
106 }, 'getAnimationPlayers() - in effect animations'); | 106 }, 'getAnimations() - in effect animations'); |
107 | 107 |
108 </script> | 108 </script> |
OLD | NEW |