Bug 1466031 - Update test_animations-dynamic-changes.html; r?hiro
MozReview-Commit-ID: FNA9NuQ9oMf
--- a/dom/animation/test/css-animations/test_animations-dynamic-changes.html
+++ b/dom/animation/test/css-animations/test_animations-dynamic-changes.html
@@ -16,25 +16,23 @@ Element.getAnimations() - Dynamic change
<div id="log"></div>
<script>
'use strict';
promise_test(async t => {
const div = addDiv(t);
div.style.animation = 'anim1 100s';
const originalAnimation = div.getAnimations()[0];
- let originalStartTime;
- let originalCurrentTime;
// Wait a moment so we can confirm the startTime doesn't change (and doesn't
// simply reflect the current time).
await originalAnimation.ready;
- originalStartTime = originalAnimation.startTime;
- originalCurrentTime = originalAnimation.currentTime;
+ const originalStartTime = originalAnimation.startTime;
+ const originalCurrentTime = originalAnimation.currentTime;
// Wait a moment so we can confirm the startTime doesn't change (and
// doesn't simply reflect the current time).
await waitForNextFrame();
div.style.animationDuration = '200s';
const animation = div.getAnimations()[0];
assert_equals(animation, originalAnimation,
@@ -84,27 +82,28 @@ promise_test(async t => {
// Swap duration of first and second in list and prepend animation at the
// same time
div.style.animation = 'anim1 100s, anim1 100s, anim1 200s';
animations = div.getAnimations();
assert_true(animations[0] !== animation1 && animations[0] !== animation2,
'New Animation is prepended to start of list');
assert_equals(animations[1], animation1,
- 'First Animation is in second position after update');
+ 'First animation is in second position after update');
assert_equals(animations[2], animation2,
- 'Second Animation is in third position after update');
+ 'Second animation is in third position after update');
assert_equals(animations[1].startTime, animations[2].startTime,
- 'Old Animations have the same start time');
+ 'Old animations have the same start time');
+ assert_equals(animations[0].startTime, null,
+ 'New animation has a null start time');
- // TODO: Check that animations[0].startTime === null
await animations[0].ready;
assert_greater_than(animations[0].startTime, animations[1].startTime,
- 'New Animation has later start time');
+ 'New animation has later start time');
}, 'Only the startTimes of existing animations are preserved');
promise_test(async t => {
const div = addDiv(t);
div.style.animation = 'anim1 100s, anim1 100s';
const secondAnimation = div.getAnimations()[1];
// Wait before continuing so we can compare start times
@@ -124,32 +123,30 @@ promise_test(async t => {
'Remaining Animation preserves startTime');
}, 'Animations are removed from the start of the list while preserving'
+ ' the state of existing Animations');
promise_test(async t => {
const div = addDiv(t);
div.style.animation = 'anim1 100s';
const firstAddedAnimation = div.getAnimations()[0];
- let secondAddedAnimation;
- let animations;
// Wait and add second Animation
await firstAddedAnimation.ready;
await waitForFrame();
div.style.animation = 'anim1 100s, anim1 100s';
- secondAddedAnimation = div.getAnimations()[0];
+ const secondAddedAnimation = div.getAnimations()[0];
// Wait again and add another Animation
await secondAddedAnimation.ready;
await waitForFrame();
div.style.animation = 'anim1 100s, anim2 100s, anim1 100s';
- animations = div.getAnimations();
+ const animations = div.getAnimations();
assert_not_equals(firstAddedAnimation, secondAddedAnimation,
'New Animations are added to start of the list');
assert_equals(animations[0], secondAddedAnimation,
'Second Animation remains in same position after'
+ ' interleaving');
assert_equals(animations[2], firstAddedAnimation,
'First Animation remains in same position after'
+ ' interleaving');