blob: 096210b6cdba59ec680cbf36c1339646482ce0a1 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test of animation-play-state</title>
<style>
body {
margin: 0;
}
#box {
position: absolute;
left: 0px;
top: 100px;
height: 100px;
width: 100px;
background-color: red;
margin: 0;
animation-duration: 2s;
animation-timing-function: linear;
animation-name: move;
animation-play-state: running;
}
@keyframes move {
from { margin-left: 0px; }
to { margin-left: 300px; }
}
</style>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/animation-test.js"></script>
</head>
<body>
<div id="box"></div>
<script>
async_test(async t => {
const delay = 100;
const test = new AnimationTest({
target: document.getElementById("box"),
styleExtractor: style => parseFloat(style.marginLeft)
});
// Record two computed values after the specified delay each.
await test.recordValueAfterRunningFor(delay);
await test.recordValueAfterRunningFor(delay);
// We'll now pause the animation using the CSS property "animation-play-state".
box.style.animationPlayState = "paused";
// And now we'll record values after the specified delay each and check that those are the same.
const initialPausedValue = await test.valueAfterWaitingFor(delay);
const currentPausedValue = await test.valueAfterWaitingFor(delay);
assert_equals(initialPausedValue, currentPausedValue, "Values recorded while paused are the same.");
// Finally, check the values recorded earlier in the test.
test.checkRecordedValues();
t.done();
}, `Pausing an animation using the animation-play-state property stops animating styles.`);
</script>
</div>
</body>
</html>