Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
animations: Don't apply animation delay to every iteration
The delay should only be applied to the animation before the first iteration.
- Loading branch information
Showing
4 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
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
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
91 changes: 91 additions & 0 deletions
91
tests/wpt/mozilla/tests/css/animations/animation-delay.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,91 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>Animation test: Automated test for animation-fill-mode.</title> | ||
<style> | ||
.target { | ||
width: 50px; | ||
height: 50px; | ||
background: red; | ||
} | ||
|
||
@keyframes width-animation { | ||
from { width: 0px; } | ||
to { width: 500px; } | ||
} | ||
|
||
</style> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<body></body> | ||
|
||
<script> | ||
|
||
test(function() { | ||
let testBinding = new window.TestBinding(); | ||
let element = document.createElement("div"); | ||
element.className = "target"; | ||
|
||
element.style.animationDelay = "1s"; | ||
element.style.animationDuration = "1s"; | ||
element.style.animationIterationCount = 1; | ||
element.style.animationName = "width-animation"; | ||
element.style.animationTimingFunction = "linear"; | ||
|
||
document.body.appendChild(element); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "0px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "250px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "500px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
}, "animation-delay should function correctly"); | ||
|
||
test(function() { | ||
let testBinding = new window.TestBinding(); | ||
let element = document.createElement("div"); | ||
element.className = "target"; | ||
|
||
element.style.animationDelay = "3s"; | ||
element.style.animationDuration = "1s"; | ||
element.style.animationIterationCount = 2; | ||
element.style.animationName = "width-animation"; | ||
element.style.animationTimingFunction = "linear"; | ||
|
||
document.body.appendChild(element); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
|
||
testBinding.advanceClock(2500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "0px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "250px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "500px"); | ||
|
||
// There should not be another delay here. | ||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "250px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "500px"); | ||
|
||
testBinding.advanceClock(500); | ||
assert_equals(getComputedStyle(element).getPropertyValue("width"), "50px"); | ||
}, "animation-delay should function correctly with multiple iterations"); | ||
|
||
</script> |
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