From fd734f45b8a1e733033014df07792d2d4e46446c Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 16 Aug 2018 14:41:03 +0900 Subject: [PATCH] Bug 1467344 - Update tests in test_animation-finished.html; r=hiro For the first test, we really want to check that it is possible to restart transitions (since they are otherwise disassociated once they finish) hence this patch updates the test to the actual output in style rather than timing. The second test is covered in web-animations/timing-model/animations/reversing-an-animation.html by the 'Playing a finished and reversed animation seeks to end' test so this patch removes it from this file. --HG-- extra : rebase_source : 415b8c9ca314085e64ffc715bf72046db264cf52 --- .../test_animation-finished.html | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/dom/animation/test/css-transitions/test_animation-finished.html b/dom/animation/test/css-transitions/test_animation-finished.html index d36eb8626c57..40df70422bc0 100644 --- a/dom/animation/test/css-transitions/test_animation-finished.html +++ b/dom/animation/test/css-transitions/test_animation-finished.html @@ -8,7 +8,7 @@ .animated-div { margin-left: 100px; - transition: margin-left 1000s linear 1000s; + transition: margin-left 100s linear 100s; } @@ -17,42 +17,22 @@ 'use strict'; -const ANIM_DELAY_MS = 1000000; // 1000s -const ANIM_DUR_MS = 1000000; // 1000s - promise_test(async t => { - const div = addDiv(t, {'class': 'animated-div'}); + const div = addDiv(t, { class: 'animated-div' }); flushComputedStyle(div); - div.style.marginLeft = '200px'; // initiate transition - + div.style.marginLeft = '200px'; const animation = div.getAnimations()[0]; animation.finish(); await animation.finished; animation.play(); - assert_equals(animation.currentTime, 0, - 'Replaying a finished transition should reset its ' + - 'currentTime'); -}, 'Test restarting a finished transition'); - -promise_test(async t => { - const div = addDiv(t, {'class': 'animated-div'}); - flushComputedStyle(div); - div.style.marginLeft = '200px'; // initiate transition - - const animation = div.getAnimations()[0]; - await animation.ready; - - animation.playbackRate = -1; - await animation.finished; - - animation.play(); - // FIXME: once animation.effect.computedTiming.endTime is available (bug - // 1108055) we should use that here. - assert_equals(animation.currentTime, ANIM_DELAY_MS + ANIM_DUR_MS, - 'Replaying a finished reversed transition should reset ' + - 'its currentTime to the end of the effect'); -}, 'Test restarting a reversed finished transition'); + const marginLeft = parseFloat(getComputedStyle(div).marginLeft); + assert_equals( + marginLeft, + 100, + 'Replaying a finished transition should update the target element\'s style' + ); +}, 'Restarting a finished transition rewinds playback');