blob: 0db45409b1d5f61dd3f60292a912cc749756b574 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.target {
position: relative;
height: 100px;
width: 100px;
background-color: red;
left: 0px;
margin-bottom: 10px;
-webkit-animation: test 0.8s linear forwards;
-webkit-animation-play-state: paused;
animation: test 0.8s linear forwards;
animation-play-state: paused;
}
.running {
-webkit-animation-play-state: running;
animation-play-state: running;
}
#animation1 {
-webkit-animation-delay: -0.2s;
animation-delay: -0.2s;
}
#animation2 {
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
#animation3 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
@-webkit-keyframes test {
from { left: 100px; }
to { left: 300px; }
}
@keyframes test {
from { left: 100px; }
to { left: 300px; }
}
</style>
<script src="resources/animation-test-helpers.js" type="text/javascript"></script>
<script type="text/javascript">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.0, "animation1", "left", 150, 0],
[0.3, "animation1", "left", 150, 0],
[0.5, "animation1", "left", 175, 15],
[0.6, "animation1", "left", 200, 15],
[0.8, "animation1", "left", 250, 15],
[1.0, "animation1", "left", 300, 15],
[1.2, "animation1", "left", 300, 0],
[0.0, "animation2", "left", 100, 0],
[0.3, "animation2", "left", 100, 0],
[0.5, "animation2", "left", 125, 15],
[0.6, "animation2", "left", 150, 15],
[0.8, "animation2", "left", 200, 15],
[1.0, "animation2", "left", 250, 15],
[1.2, "animation2", "left", 300, 15],
[1.4, "animation2", "left", 300, 0],
[0.0, "animation3", "left", 0, 0],
[0.5, "animation3", "left", 0, 0],
[0.7, "animation3", "left", 125, 15],
[0.8, "animation3", "left", 150, 15],
[1.0, "animation3", "left", 200, 15],
[1.2, "animation3", "left", 250, 15],
[1.4, "animation3", "left", 300, 15],
[1.6, "animation3", "left", 300, 0],
];
function run() {
var targets = document.getElementsByClassName('target');
for (var i = 0; i < targets.length; ++i) {
targets[i].classList.add('running');
}
}
var disablePauseAnimationAPI = true;
runAnimationTest(expectedValues, {0.4: run}, null, disablePauseAnimationAPI);
</script>
</head>
<body>
<p>This tests that an animation which is initially paused produces the correct output when first created, and can be unpaused.</p>
<div class="target" id="animation1"></div>
<div class="target" id="animation2"></div>
<div class="target" id="animation3"></div>
<div id="result"></div>
</body>
</html>