| Index: LayoutTests/web-animations-api/timed-item.html
|
| diff --git a/LayoutTests/web-animations-api/timed-item.html b/LayoutTests/web-animations-api/timed-item.html
|
| index 3e4164393bf464f1cabf6382f7ba1720add81252..a4b33909b1646de3f8b21bf3fd1a9c8a092fd398 100644
|
| --- a/LayoutTests/web-animations-api/timed-item.html
|
| +++ b/LayoutTests/web-animations-api/timed-item.html
|
| @@ -11,60 +11,60 @@ var element = document.getElementById('e');
|
| var keyframes = [{opacity: '1', offset: 0}, {opacity: '0', offset: 1}];
|
|
|
| test(function() {
|
| - var animation = new Animation(element, keyframes);
|
| - assert_equals(animation.computedTiming.localTime, null);
|
| - assert_equals(animation.computedTiming.currentIteration, null);
|
| -}, 'TimedItem.localTime and TimedItem.currentIteration are null when animation is not associated with a Player');
|
| + var keyframeEffect = new KeyframeEffect(element, keyframes);
|
| + assert_equals(keyframeEffect.computedTiming.localTime, null);
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, null);
|
| +}, 'localTime and currentIteration are null when the KeyframeEffect is not associated with an Animation');
|
|
|
| test(function() {
|
| - var player = element.animate(keyframes, {fill: 'both', duration: 2000, iterations: 3});
|
| - var animation = player.source;
|
| - player.currentTime = -1000;
|
| - assert_equals(animation.computedTiming.localTime, -1000, 'localTime');
|
| - assert_equals(animation.computedTiming.currentIteration, 0);
|
| - player.currentTime = 1000;
|
| - assert_equals(animation.computedTiming.localTime, 1000);
|
| - assert_equals(animation.computedTiming.currentIteration, 0);
|
| - player.currentTime = 5000;
|
| - assert_equals(animation.computedTiming.localTime, 5000);
|
| - assert_equals(animation.computedTiming.currentIteration, 2);
|
| - player.currentTime = 7000;
|
| - assert_equals(animation.computedTiming.localTime, 7000);
|
| - assert_equals(animation.computedTiming.currentIteration, 2);
|
| -}, 'TimedItem.localTime and TimedItem.currentIteration return reasonable values when an animation is in effect');
|
| + var animation = element.animate(keyframes, {fill: 'both', duration: 2000, iterations: 3});
|
| + var keyframeEffect = animation.source;
|
| + animation.currentTime = -1000;
|
| + assert_equals(keyframeEffect.computedTiming.localTime, -1000, 'localTime');
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, 0);
|
| + animation.currentTime = 1000;
|
| + assert_equals(keyframeEffect.computedTiming.localTime, 1000);
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, 0);
|
| + animation.currentTime = 5000;
|
| + assert_equals(keyframeEffect.computedTiming.localTime, 5000);
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, 2);
|
| + animation.currentTime = 7000;
|
| + assert_equals(keyframeEffect.computedTiming.localTime, 7000);
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, 2);
|
| +}, 'TimedItem.localTime and TimedItem.currentIteration return reasonable values when an keyframeEffect is in effect');
|
|
|
| test(function() {
|
| - var player = element.animate(keyframes);
|
| - var animation = player.source;
|
| - player.currentTime = -1;
|
| - assert_equals(animation.computedTiming.currentIteration, null);
|
| - player.currentTime = 1;
|
| - assert_equals(animation.computedTiming.currentIteration, null);
|
| -}, 'TimedItem.currentIteration is null when animation is not in effect');
|
| + var animation = element.animate(keyframes);
|
| + var keyframeEffect = animation.source;
|
| + animation.currentTime = -1;
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, null);
|
| + animation.currentTime = 1;
|
| + assert_equals(keyframeEffect.computedTiming.currentIteration, null);
|
| +}, 'TimedItem.currentIteration is null when keyframeEffect is not in effect');
|
|
|
| test(function() {
|
| - var animation = new Animation(element, keyframes, 2);
|
| - assert_equals(animation.computedTiming.startTime, 0);
|
| - assert_equals(animation.computedTiming.endTime, 2);
|
| - assert_equals(animation.computedTiming.duration, 2);
|
| - assert_equals(animation.computedTiming.activeDuration, 2);
|
| -}, 'TimedItem startTime, endTime, duration, activeDuration are sensible for a simple animation');
|
| + var keyframeEffect = new KeyframeEffect(element, keyframes, 2);
|
| + assert_equals(keyframeEffect.computedTiming.startTime, 0);
|
| + assert_equals(keyframeEffect.computedTiming.endTime, 2);
|
| + assert_equals(keyframeEffect.computedTiming.duration, 2);
|
| + assert_equals(keyframeEffect.computedTiming.activeDuration, 2);
|
| +}, 'TimedItem startTime, endTime, duration, activeDuration are sensible for a simple keyframeEffect');
|
|
|
| test(function() {
|
| - var animation = new Animation(element, keyframes, {duration: 3, iterations: 4, delay: 5});
|
| - assert_equals(animation.computedTiming.startTime, 0);
|
| - assert_equals(animation.computedTiming.endTime, 17);
|
| - assert_equals(animation.computedTiming.duration, 3);
|
| - assert_equals(animation.computedTiming.activeDuration, 12);
|
| -}, 'TimedItem startTime, endTime, duration, activeDuration are sensible for animations with delays and iterations');
|
| + var keyframeEffect = new KeyframeEffect(element, keyframes, {duration: 3, iterations: 4, delay: 5});
|
| + assert_equals(keyframeEffect.computedTiming.startTime, 0);
|
| + assert_equals(keyframeEffect.computedTiming.endTime, 17);
|
| + assert_equals(keyframeEffect.computedTiming.duration, 3);
|
| + assert_equals(keyframeEffect.computedTiming.activeDuration, 12);
|
| +}, 'TimedItem startTime, endTime, duration, activeDuration are sensible for keyframeEffects with delays and iterations');
|
|
|
| test(function() {
|
| - var animation = new Animation(element, keyframes, {delay: 1});
|
| - assert_equals(animation.computedTiming.duration, 0);
|
| + var keyframeEffect = new KeyframeEffect(element, keyframes, {delay: 1});
|
| + assert_equals(keyframeEffect.computedTiming.duration, 0);
|
| }, 'TimedItem duration is calculated when no duration is specified');
|
|
|
| test(function() {
|
| - var timing = new Animation(element, keyframes).timing;
|
| + var timing = new KeyframeEffect(element, keyframes).timing;
|
| for (var attr of ['delay', 'endDelay', 'iterationStart', 'playbackRate']) {
|
| assert_throws(new TypeError, function() { timing[attr] = NaN; }, attr);
|
| assert_throws(new TypeError, function() { timing[attr] = Infinity; }, attr);
|
|
|