-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upstream animation-play-after-finish-restarts.html from Blink (#3335)
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
web-animations/timing-model/animations/playing-an-animation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<meta charset=utf-8> | ||
<title>Playing an animation</title> | ||
<link rel="help" | ||
href="https://w3c.github.io/web-animations/#playing-an-animation-section"> | ||
<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'; | ||
|
||
test(function(t) { | ||
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); | ||
animation.currentTime = 1 * MS_PER_SEC; | ||
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); | ||
animation.play(); | ||
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC); | ||
}, 'Playing a running animation leaves the current time unchanged'); | ||
|
||
test(function(t) { | ||
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); | ||
animation.finish(); | ||
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); | ||
animation.play(); | ||
assert_times_equal(animation.currentTime, 0); | ||
}, 'Playing a finished animation seeks back to the start'); | ||
|
||
test(function(t) { | ||
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); | ||
animation.playbackRate = -1; | ||
animation.currentTime = 0; | ||
assert_times_equal(animation.currentTime, 0); | ||
animation.play(); | ||
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC); | ||
}, 'Playing a finished and reversed animation seeks to end'); | ||
|
||
</script> | ||
</body> |