OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Element.getAnimations tests</title> | 3 <title>Element.getAnimations tests</title> |
4 <link rel="help" href="http://w3c.github.io/web-animations/#animationeffecttimin
g"> | 4 <link rel="help" href="http://w3c.github.io/web-animations/#animationeffecttimin
g"> |
5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org"
> | 5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org"
> |
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> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 anim.currentTime = 500; | 46 anim.currentTime = 500; |
47 assert_equals(div.getAnimations().length, 0, | 47 assert_equals(div.getAnimations().length, 0, |
48 'set currentTime same as endTime when endDelay is negative value'); | 48 'set currentTime same as endTime when endDelay is negative value'); |
49 anim.currentTime = 1000; | 49 anim.currentTime = 1000; |
50 assert_equals(div.getAnimations().length, 0, | 50 assert_equals(div.getAnimations().length, 0, |
51 'set currentTime same as duration when endDelay is negative value'); | 51 'set currentTime same as duration when endDelay is negative value'); |
52 }, 'when endDelay is changed'); | 52 }, 'when endDelay is changed'); |
53 | 53 |
54 test(function(t) { | 54 test(function(t) { |
55 var div = createDiv(t); | 55 var div = createDiv(t); |
| 56 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
| 57 anim.finish(); |
| 58 assert_equals(div.getAnimations().length, 0, 'animation finished'); |
| 59 anim.effect.timing.iterations = 10; |
| 60 assert_equals(div.getAnimations()[0], anim, 'set iterations 10'); |
| 61 anim.effect.timing.iterations = 0; |
| 62 assert_equals(div.getAnimations().length, 0, 'set iterations 0'); |
| 63 anim.effect.timing.iterations = Infinity; |
| 64 assert_equals(div.getAnimations().length, 1, 'set iterations Infinity'); |
| 65 }, 'when iterations is changed'); |
| 66 |
| 67 test(function(t) { |
| 68 var div = createDiv(t); |
56 var anim = div.animate({ opacity: [ 0, 1 ] }, | 69 var anim = div.animate({ opacity: [ 0, 1 ] }, |
57 { duration: 1000, delay: 500, endDelay: -500 }); | 70 { duration: 1000, delay: 500, endDelay: -500 }); |
58 assert_equals(div.getAnimations()[0], anim, 'when currentTime 0'); | 71 assert_equals(div.getAnimations()[0], anim, 'when currentTime 0'); |
59 anim.currentTime = 500; | 72 anim.currentTime = 500; |
60 assert_equals(div.getAnimations()[0], anim, 'set currentTime 500'); | 73 assert_equals(div.getAnimations()[0], anim, 'set currentTime 500'); |
61 anim.currentTime = 1000; | 74 anim.currentTime = 1000; |
62 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); | 75 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); |
63 }, 'when currentTime changed in duration:1000, delay: 500, endDelay: -500'); | 76 }, 'when currentTime changed in duration:1000, delay: 500, endDelay: -500'); |
64 | 77 |
65 test(function(t) { | 78 test(function(t) { |
66 var div = createDiv(t); | 79 var div = createDiv(t); |
67 var anim = div.animate({ opacity: [ 0, 1 ] }, | 80 var anim = div.animate({ opacity: [ 0, 1 ] }, |
68 { duration: 1000, delay: -500, endDelay: -500 }); | 81 { duration: 1000, delay: -500, endDelay: -500 }); |
69 assert_equals(div.getAnimations().length, 0, 'when currentTime 0'); | 82 assert_equals(div.getAnimations().length, 0, 'when currentTime 0'); |
70 anim.currentTime = 500; | 83 anim.currentTime = 500; |
71 assert_equals(div.getAnimations().length, 0, 'set currentTime 500'); | 84 assert_equals(div.getAnimations().length, 0, 'set currentTime 500'); |
72 anim.currentTime = 1000; | 85 anim.currentTime = 1000; |
73 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); | 86 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); |
74 }, 'when currentTime changed in duration:1000, delay: -500, endDelay: -500'); | 87 }, 'when currentTime changed in duration:1000, delay: -500, endDelay: -500'); |
75 | 88 |
76 | 89 |
77 </script> | 90 </script> |
78 </body> | 91 </body> |
OLD | NEW |