OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>iterationStart tests</title> |
| 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"> |
| 6 <script src="../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> |
| 8 <script src="../testcommon.js"></script> |
| 9 <body> |
| 10 <div id="log"></div> |
| 11 <script> |
| 12 'use strict'; |
| 13 |
| 14 test(function(t) { |
| 15 var div = createDiv(t); |
| 16 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 17 { iterationStart: 0.2, |
| 18 iterations: 1, |
| 19 fill: 'both', |
| 20 duration: 100, |
| 21 delay: 1 }); |
| 22 anim.effect.timing.iterationStart = 2.5; |
| 23 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 24 assert_equals(anim.effect.getComputedTiming().currentIteration, 2); |
| 25 }, 'Test that changing the iterationStart affects computed timing ' + |
| 26 'when backwards-filling'); |
| 27 |
| 28 test(function(t) { |
| 29 var div = createDiv(t); |
| 30 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 31 { iterationStart: 0.2, |
| 32 iterations: 1, |
| 33 fill: 'both', |
| 34 duration: 100, |
| 35 delay: 0 }); |
| 36 anim.effect.timing.iterationStart = 2.5; |
| 37 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 38 assert_equals(anim.effect.getComputedTiming().currentIteration, 2); |
| 39 }, 'Test that changing the iterationStart affects computed timing ' + |
| 40 'during the active phase'); |
| 41 |
| 42 test(function(t) { |
| 43 var div = createDiv(t); |
| 44 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 45 { iterationStart: 0.2, |
| 46 iterations: 1, |
| 47 fill: 'both', |
| 48 duration: 100, |
| 49 delay: 0 }); |
| 50 anim.finish(); |
| 51 anim.effect.timing.iterationStart = 2.5; |
| 52 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 53 assert_equals(anim.effect.getComputedTiming().currentIteration, 3); |
| 54 }, 'Test that changing the iterationStart affects computed timing ' + |
| 55 'when forwards-filling'); |
| 56 |
| 57 test(function(t) { |
| 58 var div = createDiv(t); |
| 59 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); |
| 60 assert_throws({ name: 'TypeError' }, |
| 61 function() { |
| 62 anim.effect.timing.iterationStart = -1; |
| 63 }); |
| 64 assert_throws({ name: 'TypeError' }, |
| 65 function() { |
| 66 div.animate({ opacity: [ 0, 1 ] }, |
| 67 { iterationStart: -1 }); |
| 68 }); |
| 69 }, 'Test invalid iterationStart value'); |
| 70 |
| 71 </script> |
| 72 </body> |
OLD | NEW |