summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html')
-rw-r--r--testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html172
1 files changed, 172 insertions, 0 deletions
diff --git a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html
new file mode 100644
index 000000000..d6503a431
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html
@@ -0,0 +1,172 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>getComputedStyle tests</title>
+<link rel="help" href="http://w3c.github.io/web-animations/#animationeffecttiming">
+<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>
+<body>
+<div id="log"></div>
+<script>
+'use strict';
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 100000);
+ anim.finish();
+ assert_equals(getComputedStyle(div).opacity, '1', 'animation finished');
+ 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);
+ var anim = div.animate({ opacity: [ 0, 1 ] }, 100000);
+ anim.finish();
+ assert_equals(getComputedStyle(div).opacity, '1', 'animation finished');
+ anim.effect.timing.iterations = 2;
+ assert_equals(getComputedStyle(div).opacity, '0', 'set 2 iterations');
+ anim.effect.timing.iterations = 0;
+ assert_equals(getComputedStyle(div).opacity, '1', 'set iterations 0');
+ anim.effect.timing.iterations = Infinity;
+ assert_equals(getComputedStyle(div).opacity, '0', 'set iterations Infinity');
+}, 'changed iterations immediately updates its computed styles');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 1, 0 ] },
+ { duration: 10000, endDelay: 1000, fill: 'none' });
+
+ anim.currentTime = 9000;
+ assert_equals(getComputedStyle(div).opacity, '0.1',
+ 'set currentTime during duration');
+
+ anim.currentTime = 10900;
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'set currentTime during endDelay');
+
+ anim.currentTime = 11100;
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'set currentTime after endDelay');
+}, 'change currentTime when fill is none and endDelay is positive');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 1, 0 ] },
+ { duration: 10000,
+ endDelay: 1000,
+ fill: 'forwards' });
+ anim.currentTime = 5000;
+ assert_equals(getComputedStyle(div).opacity, '0.5',
+ 'set currentTime during duration');
+
+ anim.currentTime = 9999;
+ assert_equals(getComputedStyle(div).opacity, '0.0001',
+ 'set currentTime just a little before duration');
+
+ anim.currentTime = 10900;
+ assert_equals(getComputedStyle(div).opacity, '0',
+ 'set currentTime during endDelay');
+
+ anim.currentTime = 11100;
+ assert_equals(getComputedStyle(div).opacity, '0',
+ 'set currentTime after endDelay');
+}, 'change currentTime when fill forwards and endDelay is positive');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 1, 0 ] },
+ { duration: 10000, endDelay: -5000, fill: 'none' });
+
+ anim.currentTime = 1000;
+ assert_equals(getComputedStyle(div).opacity, '0.9',
+ 'set currentTime before endTime');
+
+ anim.currentTime = 10000;
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'set currentTime after endTime');
+}, 'change currentTime when fill none and endDelay is negative');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 1, 0 ] },
+ { duration: 10000,
+ endDelay: -5000,
+ fill: 'forwards' });
+
+ anim.currentTime = 1000;
+ assert_equals(getComputedStyle(div).opacity, '0.9',
+ 'set currentTime before endTime');
+
+ anim.currentTime = 5000;
+ assert_equals(getComputedStyle(div).opacity, '0.5',
+ 'set currentTime same as endTime');
+
+ anim.currentTime = 10000;
+ assert_equals(getComputedStyle(div).opacity, '0',
+ 'set currentTime after endTime');
+}, 'change currentTime when fill forwards and endDelay is negative');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { duration: 10000,
+ direction: 'normal' });
+
+ anim.currentTime = 7000;
+ anim.effect.timing.direction = 'reverse';
+
+ assert_equals(getComputedStyle(div).opacity, '0.3',
+ 'change direction from "normal" to "reverse"');
+}, 'change direction from "normal" to "reverse"');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { iterations: 2,
+ duration: 10000,
+ direction: 'normal' });
+
+ anim.currentTime = 17000;
+ anim.effect.timing.direction = 'alternate';
+
+ assert_equals(getComputedStyle(div).opacity, '0.3',
+ 'change direction from "normal" to "alternate"');
+ }, 'change direction from "normal" to "alternate"');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { iterations: 2,
+ duration: 10000,
+ direction: 'normal' });
+
+ anim.currentTime = 17000;
+ anim.effect.timing.direction = 'alternate-reverse';
+
+ assert_equals(getComputedStyle(div).opacity, '0.7',
+ 'change direction from "normal" to "alternate-reverse"');
+}, 'change direction from "normal" to "alternate-reverse"');
+
+test(function(t) {
+ var div = createDiv(t);
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { fill: 'backwards',
+ duration: 10000,
+ direction: 'normal' });
+
+ // test for a flip of value at the currentTime = 0
+ anim.effect.timing.direction = 'reverse';
+
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'change direction from "normal" to "reverse" ' +
+ 'at the starting point');
+}, 'change direction from "normal" to "reverse"');
+
+</script>
+</body>