| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>iterationStart tests</title> | 3 <title>iterationStart tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-iterationstart"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-iterationstart"> |
| 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.iterationStart, 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 ] }, | 21 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 17 { iterationStart: 0.2, | 22 { iterationStart: 0.2, |
| 18 iterations: 1, | 23 iterations: 1, |
| 19 fill: 'both', | 24 fill: 'both', |
| 20 duration: 100, | 25 duration: 100, |
| 21 delay: 1 }); | 26 delay: 1 }); |
| 22 anim.effect.timing.iterationStart = 2.5; | 27 anim.effect.timing.iterationStart = 2.5; |
| 23 assert_equals(anim.effect.getComputedTiming().progress, 0.5); | 28 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 24 assert_equals(anim.effect.getComputedTiming().currentIteration, 2); | 29 assert_equals(anim.effect.getComputedTiming().currentIteration, 2); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 delay: 0 }); | 54 delay: 0 }); |
| 50 anim.finish(); | 55 anim.finish(); |
| 51 anim.effect.timing.iterationStart = 2.5; | 56 anim.effect.timing.iterationStart = 2.5; |
| 52 assert_equals(anim.effect.getComputedTiming().progress, 0.5); | 57 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 53 assert_equals(anim.effect.getComputedTiming().currentIteration, 3); | 58 assert_equals(anim.effect.getComputedTiming().currentIteration, 3); |
| 54 }, 'Test that changing the iterationStart affects computed timing ' + | 59 }, 'Test that changing the iterationStart affects computed timing ' + |
| 55 'when forwards-filling'); | 60 'when forwards-filling'); |
| 56 | 61 |
| 57 test(function(t) { | 62 test(function(t) { |
| 58 var div = createDiv(t); | 63 var div = createDiv(t); |
| 59 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); | 64 var anim = div.animate(null); |
| 60 assert_throws({ name: 'TypeError' }, | 65 for (let invalid of [-1, NaN, Infinity]) { |
| 61 function() { | 66 assert_throws({ name: 'TypeError' }, function() { |
| 62 anim.effect.timing.iterationStart = -1; | 67 anim.effect.timing.iterationStart = invalid; |
| 63 }); | 68 }, 'setting ' + invalid); |
| 64 assert_throws({ name: 'TypeError' }, | 69 assert_throws({ name: 'TypeError' }, function() { |
| 65 function() { | 70 div.animate({}, { iterationStart: invalid }); |
| 66 div.animate({ opacity: [ 0, 1 ] }, | 71 }, 'animate() with ' + invalid); |
| 67 { iterationStart: -1 }); | 72 } |
| 68 }); | 73 }, 'Using invalid values should throw TypeError'); |
| 69 }, 'Test invalid iterationStart value'); | |
| 70 | 74 |
| 71 </script> | 75 </script> |
| 72 </body> | 76 </body> |
| OLD | NEW |