Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/web-animations-api/fill-forward-negative-end-delay.html |
| diff --git a/third_party/WebKit/LayoutTests/web-animations-api/fill-forward-negative-end-delay.html b/third_party/WebKit/LayoutTests/web-animations-api/fill-forward-negative-end-delay.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..50b20cdcfb8a3f065ee54be261e22ee7473cb8b4 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/web-animations-api/fill-forward-negative-end-delay.html |
| @@ -0,0 +1,69 @@ |
| +<script src="../resources/testharness.js"></script> |
|
suzyh_UTC10 (ex-contributor)
2016/07/25 00:51:09
Are we intending to upstream this one?
alancutter (OOO until 2018)
2016/07/25 01:44:32
Yes.
suzyh_UTC10 (ex-contributor)
2016/07/25 01:52:12
In that case, please add the usual meta/header inf
alancutter (OOO until 2018)
2016/07/25 04:46:48
Done.
|
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../imported/wpt/web-animations/testcommon.js"></script> |
| +<body> |
| +<script> |
| +'use strict'; |
| + |
| +var keyframes = {left: ['0px', '1px']}; |
| + |
| +// TODO(alancutter): Implement animation.effect.getComputedTiming().progress to |
|
suzyh_UTC10 (ex-contributor)
2016/07/25 00:51:09
Don't we have this now?
alancutter (OOO until 2018)
2016/07/25 01:44:32
Using it now.
|
| +// query the timing model more directly and avoid having to read getComputedStyle(). |
| +function animationProgress(element) { |
| + return parseFloat(getComputedStyle(element).left); |
| +} |
| + |
| +test(function(t) { |
| + var element = createDiv(t); |
| + var animation = element.animate(keyframes, { |
| + fill: 'forwards', |
| + duration: 1, |
| + endDelay: -1, |
| + }); |
| + animation.currentTime = 10; |
| + assert_equals(animationProgress(element), 0, |
| + 'Progress should be zero since we clip to the start of the animation'); |
| +}, 'Negative end delay clipping into the start of the animation'); |
| + |
| +test(function(t) { |
| + var element = createDiv(t); |
| + var animation = element.animate(keyframes, { |
| + fill: 'forwards', |
| + duration: 1, |
| + iterations: 2, |
| + endDelay: -1, |
| + }); |
| + animation.currentTime = 10; |
| + assert_equals(animationProgress(element), 1, |
| + 'Progress should be 1 since we clip to the end of the first iteration ' + |
| + 'and the second iteration does not have a chance to start'); |
| +}, 'Negative end delay clipping to the end of the the first iteration'); |
| + |
| +test(function(t) { |
| + var element = createDiv(t); |
| + var animation = element.animate(keyframes, { |
| + fill: 'forwards', |
| + duration: 1, |
| + iterations: 2, |
| + endDelay: -0.75, |
| + }); |
| + animation.currentTime = 10; |
| + assert_equals(animationProgress(element), 0.25, |
| + 'Progress should be 0.25 since we clip part way through the second iteration'); |
| +}, 'Negative end delay clipping part way into the second iteration'); |
| + |
| +test(function(t) { |
| + var element = createDiv(t); |
| + var animation = element.animate(keyframes, { |
| + fill: 'forwards', |
| + duration: 1, |
| + iterations: 0, |
| + endDelay: -1, |
| + }); |
| + animation.currentTime = 10; |
| + assert_equals(animationProgress(element), 0, |
| + 'Progress should be 0 since there are no iterations to make progress in'); |
| +}, 'Negative end delay clipping into zero iterations'); |
| + |
| +</script> |
| +</body> |