Files
tubestation/dom/animation/test/css-transitions/test_animation-pausing.html
Brian Birtles eecc3b000d Bug 1382841 - Rename test_XXX_to_rename.html files in dom/animation/test to test_XXX.html; r=hiro
See the description in this changeset's parent which describes why we do this in
two steps.

MozReview-Commit-ID: GtO0SCb0UOF
2018-03-12 16:08:35 +09:00

51 lines
1.8 KiB
HTML

<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
async_test(function(t) {
var div = addDiv(t);
var cs = getComputedStyle(div);
div.style.marginLeft = '0px';
cs.marginLeft; // Flush style to set up transition start point
div.style.transition = 'margin-left 100s';
div.style.marginLeft = '10000px';
cs.marginLeft;
var animation = div.getAnimations()[0];
var previousProgress = animation.effect.getComputedTiming().progress;
assert_equals(previousProgress, 0, 'Initial value of progress is zero');
animation.ready.then(waitForNextFrame).then(t.step_func(function() {
assert_greater_than(animation.effect.getComputedTiming().progress,
previousProgress,
'Iteration progress is initially increasing');
animation.pause();
return animation.ready;
})).then(t.step_func(function() {
previousProgress = animation.effect.getComputedTiming().progress;
return waitForNextFrame();
})).then(t.step_func(function() {
assert_equals(animation.effect.getComputedTiming().progress,
previousProgress,
'Iteration progress does not increase after calling pause()');
previousProgress = animation.effect.getComputedTiming().progress;
animation.play();
return animation.ready.then(waitForNextFrame);
})).then(t.step_func(function() {
assert_greater_than(animation.effect.getComputedTiming().progress,
previousProgress,
'Iteration progress increases after calling play()');
t.done();
}));
}, 'pause() and play() a transition');
</script>
</body>