Chromium Code Reviews| 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 <body> | 5 <body> |
| 6 <div id='e'></div> | 6 <div id='e'></div> |
| 7 </body> | 7 </body> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 var element = document.getElementById('e'); | 10 var element = document.getElementById('e'); |
| 11 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; | 11 var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}]; |
| 12 | 12 |
| 13 test(function() { | 13 test(function() { |
| 14 var animation = new Animation(element, keyframes); | 14 var animation = new KeyframeEffect(element, keyframes); |
|
alancutter (OOO until 2018)
2015/05/05 01:04:51
s/animation/keyframeEffect/g
dstockwell
2015/05/05 03:33:24
Done..
| |
| 15 assert_equals(animation.computedTiming.localTime, null); | 15 assert_equals(animation.computedTiming.localTime, null); |
| 16 assert_equals(animation.computedTiming.currentIteration, null); | 16 assert_equals(animation.computedTiming.currentIteration, null); |
| 17 }, 'TimedItem.localTime and TimedItem.currentIteration are null when animation i s not associated with a Player'); | 17 }, 'TimedItem.localTime and TimedItem.currentIteration are null when animation i s not associated with a Player'); |
| 18 | 18 |
| 19 test(function() { | 19 test(function() { |
| 20 var player = element.animate(keyframes, {fill: 'both', duration: 2000, itera tions: 3}); | 20 var player = element.animate(keyframes, {fill: 'both', duration: 2000, itera tions: 3}); |
| 21 var animation = player.source; | 21 var animation = player.source; |
| 22 player.currentTime = -1000; | 22 player.currentTime = -1000; |
| 23 assert_equals(animation.computedTiming.localTime, -1000, 'localTime'); | 23 assert_equals(animation.computedTiming.localTime, -1000, 'localTime'); |
| 24 assert_equals(animation.computedTiming.currentIteration, 0); | 24 assert_equals(animation.computedTiming.currentIteration, 0); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 test(function() { | 36 test(function() { |
| 37 var player = element.animate(keyframes); | 37 var player = element.animate(keyframes); |
| 38 var animation = player.source; | 38 var animation = player.source; |
| 39 player.currentTime = -1; | 39 player.currentTime = -1; |
| 40 assert_equals(animation.computedTiming.currentIteration, null); | 40 assert_equals(animation.computedTiming.currentIteration, null); |
| 41 player.currentTime = 1; | 41 player.currentTime = 1; |
| 42 assert_equals(animation.computedTiming.currentIteration, null); | 42 assert_equals(animation.computedTiming.currentIteration, null); |
| 43 }, 'TimedItem.currentIteration is null when animation is not in effect'); | 43 }, 'TimedItem.currentIteration is null when animation is not in effect'); |
| 44 | 44 |
| 45 test(function() { | 45 test(function() { |
| 46 var animation = new Animation(element, keyframes, 2); | 46 var animation = new KeyframeEffect(element, keyframes, 2); |
| 47 assert_equals(animation.computedTiming.startTime, 0); | 47 assert_equals(animation.computedTiming.startTime, 0); |
| 48 assert_equals(animation.computedTiming.endTime, 2); | 48 assert_equals(animation.computedTiming.endTime, 2); |
| 49 assert_equals(animation.computedTiming.duration, 2); | 49 assert_equals(animation.computedTiming.duration, 2); |
| 50 assert_equals(animation.computedTiming.activeDuration, 2); | 50 assert_equals(animation.computedTiming.activeDuration, 2); |
| 51 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for a si mple animation'); | 51 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for a si mple animation'); |
| 52 | 52 |
| 53 test(function() { | 53 test(function() { |
| 54 var animation = new Animation(element, keyframes, {duration: 3, iterations: 4, delay: 5}); | 54 var animation = new KeyframeEffect(element, keyframes, {duration: 3, iteration s: 4, delay: 5}); |
| 55 assert_equals(animation.computedTiming.startTime, 0); | 55 assert_equals(animation.computedTiming.startTime, 0); |
| 56 assert_equals(animation.computedTiming.endTime, 17); | 56 assert_equals(animation.computedTiming.endTime, 17); |
| 57 assert_equals(animation.computedTiming.duration, 3); | 57 assert_equals(animation.computedTiming.duration, 3); |
| 58 assert_equals(animation.computedTiming.activeDuration, 12); | 58 assert_equals(animation.computedTiming.activeDuration, 12); |
| 59 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for anim ations with delays and iterations'); | 59 }, 'TimedItem startTime, endTime, duration, activeDuration are sensible for anim ations with delays and iterations'); |
| 60 | 60 |
| 61 test(function() { | 61 test(function() { |
| 62 var animation = new Animation(element, keyframes, {delay: 1}); | 62 var animation = new KeyframeEffect(element, keyframes, {delay: 1}); |
| 63 assert_equals(animation.computedTiming.duration, 0); | 63 assert_equals(animation.computedTiming.duration, 0); |
| 64 }, 'TimedItem duration is calculated when no duration is specified'); | 64 }, 'TimedItem duration is calculated when no duration is specified'); |
| 65 | 65 |
| 66 test(function() { | 66 test(function() { |
| 67 var timing = new Animation(element, keyframes).timing; | 67 var timing = new KeyframeEffect(element, keyframes).timing; |
| 68 for (var attr of ['delay', 'endDelay', 'iterationStart', 'playbackRate']) { | 68 for (var attr of ['delay', 'endDelay', 'iterationStart', 'playbackRate']) { |
| 69 assert_throws(new TypeError, function() { timing[attr] = NaN; }, attr); | 69 assert_throws(new TypeError, function() { timing[attr] = NaN; }, attr); |
| 70 assert_throws(new TypeError, function() { timing[attr] = Infinity; }, attr); | 70 assert_throws(new TypeError, function() { timing[attr] = Infinity; }, attr); |
| 71 } | 71 } |
| 72 }, 'Restricted double attributes on the Timing interface throws for non-finite v alues.'); | 72 }, 'Restricted double attributes on the Timing interface throws for non-finite v alues.'); |
| 73 | 73 |
| 74 </script> | 74 </script> |
| OLD | NEW |