OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>iterations tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-iterations"> |
| 5 <script src="../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../resources/testharnessreport.js"></script> |
| 7 <script src="../testcommon.js"></script> |
| 8 <link rel="stylesheet" href="../../../../resources/testharness.css"> |
| 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 ] }, 2000); |
| 17 anim.effect.timing.iterations = 2; |
| 18 assert_equals(anim.effect.timing.iterations, 2, 'set duration 2'); |
| 19 assert_equals(anim.effect.getComputedTiming().iterations, 2, |
| 20 'getComputedTiming() after set iterations 2'); |
| 21 }, 'set iterations 2'); |
| 22 |
| 23 test(function(t) { |
| 24 var div = createDiv(t); |
| 25 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
| 26 anim.effect.timing.iterations = Infinity; |
| 27 assert_equals(anim.effect.timing.iterations, Infinity, 'set duration Infinity'
); |
| 28 assert_equals(anim.effect.getComputedTiming().iterations, Infinity, |
| 29 'getComputedTiming() after set iterations Infinity'); |
| 30 }, 'set iterations Infinity'); |
| 31 |
| 32 test(function(t) { |
| 33 var div = createDiv(t); |
| 34 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
| 35 assert_throws({ name: 'TypeError' }, function() { |
| 36 anim.effect.timing.iterations = -1; |
| 37 }); |
| 38 }, 'set negative iterations'); |
| 39 |
| 40 test(function(t) { |
| 41 var div = createDiv(t); |
| 42 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
| 43 assert_throws({ name: 'TypeError' }, function() { |
| 44 anim.effect.timing.iterations = -Infinity; |
| 45 }); |
| 46 }, 'set negative infinity iterations '); |
| 47 |
| 48 test(function(t) { |
| 49 var div = createDiv(t); |
| 50 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
| 51 assert_throws({ name: 'TypeError' }, function() { |
| 52 anim.effect.timing.iterations = NaN; |
| 53 }); |
| 54 }, 'set NaN iterations'); |
| 55 |
| 56 </script> |
| 57 </body> |
OLD | NEW |