Bug 1244635 - Part3 Add duration tests in testing/web-platform/tests/web-animations r?hiro
MozReview-Commit-ID: 6VROCYmzc1X
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -27411,16 +27411,20 @@
"path": "web-animations/animatable/animate.html",
"url": "/web-animations/animatable/animate.html"
},
{
"path": "web-animations/animation-effect-timing/duration.html",
"url": "/web-animations/animation-effect-timing/duration.html"
},
{
+ "path": "web-animations/animation-effect-timing/endDelay.html",
+ "url": "/web-animations/animation-effect-timing/endDelay.html"
+ },
+ {
"path": "web-animations/animation-effect-timing/getAnimations.html",
"url": "/web-animations/animation-effect-timing/getAnimations.html"
},
{
"path": "web-animations/animation-effect-timing/getComputedStyle.html",
"url": "/web-animations/animation-effect-timing/getComputedStyle.html"
},
{
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/animation-effect-timing/endDelay.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>endDelay tests</title>
+<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationeffecttiming-enddelay">
+<link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<link rel="stylesheet" href="/resources/testharness.css">
+<body>
+<div id="log"></div>
+<script>
+'use strict';
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ anim.effect.timing.endDelay = 123.45;
+ assert_approx_equals(anim.effect.timing.endDelay, 123.45, 0.000001,
+ 'set endDelay 123.45');
+ assert_approx_equals(anim.effect.getComputedTiming().endDelay, 123.45,
+ 0.000001,
+ 'getComputedTiming() after set endDelay 123.45');
+}, 'set endDelay 123.45');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+ anim.effect.timing.endDelay = -1000;
+ assert_equals(anim.effect.timing.endDelay, -1000, 'set endDelay 1000');
+ assert_equals(anim.effect.getComputedTiming().endDelay, -1000,
+ 'getComputedTiming() after set endDelay -1000');
+}, 'set endDelay 1000');
+
+</script>
+</body>
--- a/testing/web-platform/tests/web-animations/animation-effect-timing/getAnimations.html
+++ b/testing/web-platform/tests/web-animations/animation-effect-timing/getAnimations.html
@@ -20,10 +20,20 @@ test(function(t) {
anim.effect.timing.duration += 100000;
assert_equals(div.getAnimations()[0], anim, 'set duration 102000');
anim.effect.timing.duration = 0;
assert_equals(div.getAnimations().length, 0, 'set duration 0');
anim.effect.timing.duration = 'auto';
assert_equals(div.getAnimations().length, 0, 'set duration \'auto\'');
}, 'when duration is changed');
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
+
+ anim.effect.timing.endDelay = -3000;
+ assert_equals(div.getAnimations().length, 0, 'set negative endDelay');
+ anim.effect.timing.endDelay = 1000;
+ assert_equals(div.getAnimations()[0], anim, 'set positive endDelay');
+}, 'when endDelay is changed');
+
</script>
</body>
--- a/testing/web-platform/tests/web-animations/animation-effect-timing/getComputedStyle.html
+++ b/testing/web-platform/tests/web-animations/animation-effect-timing/getComputedStyle.html
@@ -20,10 +20,42 @@ test(function(t) {
anim.effect.timing.duration *= 2;
assert_equals(getComputedStyle(div).opacity, '0.5', 'set double duration');
anim.effect.timing.duration = 0;
assert_equals(getComputedStyle(div).opacity, '1', 'set duration 0');
anim.effect.timing.duration = 'auto';
assert_equals(getComputedStyle(div).opacity, '1', 'set duration \'auto\'');
}, 'changed duration immediately updates its computed styles');
+test(function(t) {
+ var div = createDiv(t);
+ div.style.opacity = '0';
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { duration: 100000, fill: 'none' });
+ anim.effect.timing.endDelay = 10000;
+
+ anim.currentTime = 90000;
+ assert_equals(getComputedStyle(div).opacity, '0.9',
+ 'set currentTime during duration');
+
+ anim.currentTime = 109000;
+ assert_equals(getComputedStyle(div).opacity, '0',
+ 'set currentTime during endDelay');
+
+ anim.currentTime = 111000;
+ assert_equals(getComputedStyle(div).opacity, '0',
+ 'set currentTime after endDelay');
+}, 'change endDelay and currentTime when fill none');
+
+test(function(t) {
+ var div = createDiv(t);
+ div.style.opacity = '0';
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { duration: 100000, fill: 'forwards' });
+
+ anim.effect.timing.endDelay = 10000;
+ anim.currentTime = 109000;
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'set currentTime during endDelay');
+}, 'change endDelay and currentTime when fill backwards');
+
</script>
</body>