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 | 4 |
5 <!-- This tests that players get updated even if they have previously had their
source content removed or go out of effect. --> | 5 <!-- This tests that players get updated even if they have previously had their
source content removed or go out of effect. --> |
6 | 6 |
7 <div id='element'></div> | 7 <div id='element'></div> |
8 | 8 |
9 <script> | 9 <script> |
10 var element = document.getElementById('element'); | 10 var element = document.getElementById('element'); |
11 var animation = new Animation(element, [{left: '0px'}, {left: '100px'}], 10); | 11 var keyframeEffect = new KeyframeEffect(element, [{left: '0px'}, {left: '100px'}
], 10); |
12 test(function() { | 12 test(function() { |
13 var player = document.timeline.play(animation); | 13 var player = document.timeline.play(keyframeEffect); |
14 player.finish(); | 14 player.finish(); |
15 assert_equals(getComputedStyle(element).left, 'auto'); | 15 assert_equals(getComputedStyle(element).left, 'auto'); |
16 | 16 |
17 player.play(); | 17 player.play(); |
18 assert_equals(getComputedStyle(element).left, '0px'); | 18 assert_equals(getComputedStyle(element).left, '0px'); |
19 | 19 |
20 player.finish(); | 20 player.finish(); |
21 }, 'Player updated after finish and play'); | 21 }, 'Player updated after finish and play'); |
22 | 22 |
23 test(function() { | 23 test(function() { |
24 var player = document.timeline.play(animation); | 24 var player = document.timeline.play(keyframeEffect); |
25 assert_equals(getComputedStyle(element).left, '0px'); | 25 assert_equals(getComputedStyle(element).left, '0px'); |
26 var source = player.source | 26 var source = player.source |
27 player.source = null; | 27 player.source = null; |
28 assert_equals(getComputedStyle(element).left, 'auto'); | 28 assert_equals(getComputedStyle(element).left, 'auto'); |
29 | 29 |
30 player.source = source; | 30 player.source = source; |
31 assert_equals(getComputedStyle(element).left, '0px'); | 31 assert_equals(getComputedStyle(element).left, '0px'); |
32 | 32 |
33 player.finish(); | 33 player.finish(); |
34 }, 'Player updated after clear and set source'); | 34 }, 'Player updated after clear and set source'); |
35 </script> | 35 </script> |
OLD | NEW |