OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>delay tests</title> | 3 <title>delay tests</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-delay"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-delay"> |
5 <link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.o
rg"> | 5 <link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.o
rg"> |
6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
8 <script src="../../testcommon.js"></script> | 8 <script src="../../testcommon.js"></script> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 'use strict'; | 12 'use strict'; |
13 | 13 |
14 test(function(t) { | 14 test(function(t) { |
| 15 var anim = createDiv(t).animate(null); |
| 16 assert_equals(anim.effect.timing.delay, 0); |
| 17 }, 'Test default value'); |
| 18 |
| 19 test(function(t) { |
15 var div = createDiv(t); | 20 var div = createDiv(t); |
16 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); | 21 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); |
17 anim.effect.timing.delay = 100; | 22 anim.effect.timing.delay = 100; |
18 assert_equals(anim.effect.timing.delay, 100, 'set delay 100'); | 23 assert_equals(anim.effect.timing.delay, 100, 'set delay 100'); |
19 assert_equals(anim.effect.getComputedTiming().delay, 100, | 24 assert_equals(anim.effect.getComputedTiming().delay, 100, |
20 'getComputedTiming() after set delay 100'); | 25 'getComputedTiming() after set delay 100'); |
21 }, 'set delay 100'); | 26 }, 'set delay 100'); |
22 | 27 |
23 test(function(t) { | 28 test(function(t) { |
24 var div = createDiv(t); | 29 var div = createDiv(t); |
(...skipping 25 matching lines...) Expand all Loading... |
50 test(function(t) { | 55 test(function(t) { |
51 var div = createDiv(t); | 56 var div = createDiv(t); |
52 var anim = div.animate({ opacity: [ 0, 1 ] }, | 57 var anim = div.animate({ opacity: [ 0, 1 ] }, |
53 { fill: 'both', | 58 { fill: 'both', |
54 duration: 100 }); | 59 duration: 100 }); |
55 anim.effect.timing.delay = -100; | 60 anim.effect.timing.delay = -100; |
56 assert_equals(anim.effect.getComputedTiming().progress, 1); | 61 assert_equals(anim.effect.getComputedTiming().progress, 1); |
57 assert_equals(anim.effect.getComputedTiming().currentIteration, 0); | 62 assert_equals(anim.effect.getComputedTiming().currentIteration, 0); |
58 }, 'Test finishing an animation using a large negative delay'); | 63 }, 'Test finishing an animation using a large negative delay'); |
59 | 64 |
| 65 test(function(t) { |
| 66 var div = createDiv(t); |
| 67 var anim = div.animate(null); |
| 68 for (let invalid of [NaN, Infinity]) { |
| 69 assert_throws({ name: 'TypeError' }, function() { |
| 70 anim.effect.timing.delay = invalid; |
| 71 }, 'setting ' + invalid); |
| 72 assert_throws({ name: 'TypeError' }, function() { |
| 73 div.animate({}, { delay: invalid }); |
| 74 }, 'animate() with ' + invalid); |
| 75 } |
| 76 }, 'Setting invalid values should throw TypeError'); |
| 77 |
60 </script> | 78 </script> |
61 </body> | 79 </body> |
OLD | NEW |