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
This commit is contained in:
Brian Birtles 2018-08-16 14:41:03 +09:00
Родитель ce2e73ce15
Коммит fd734f45b8
1 изменённых файлов: 10 добавлений и 30 удалений

Просмотреть файл

@ -8,7 +8,7 @@
.animated-div {
margin-left: 100px;
transition: margin-left 1000s linear 1000s;
transition: margin-left 100s linear 100s;
}
</style>
@ -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');
</script>