OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset=utf-8> | |
3 <title>Element.getAnimations tests</title> | |
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"
> | |
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 ] }, 2000); | |
17 anim.finish(); | |
18 assert_equals(div.getAnimations().length, 0, 'animation finished'); | |
19 anim.effect.timing.duration += 100000; | |
20 assert_equals(div.getAnimations()[0], anim, 'set duration 102000'); | |
21 anim.effect.timing.duration = 0; | |
22 assert_equals(div.getAnimations().length, 0, 'set duration 0'); | |
23 anim.effect.timing.duration = 'auto'; | |
24 assert_equals(div.getAnimations().length, 0, 'set duration \'auto\''); | |
25 }, 'when duration is changed'); | |
26 | |
27 test(function(t) { | |
28 var div = createDiv(t); | |
29 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); | |
30 | |
31 anim.effect.timing.endDelay = -3000; | |
32 assert_equals(div.getAnimations().length, 0, | |
33 'set negative endDelay so as endTime is less than currentTime'); | |
34 anim.effect.timing.endDelay = 1000; | |
35 assert_equals(div.getAnimations()[0], anim, | |
36 'set positive endDelay so as endTime is more than currentTime'); | |
37 | |
38 anim.effect.timing.duration = 1000; | |
39 anim.currentTime = 1500; | |
40 assert_equals(div.getAnimations().length, 0, | |
41 'set currentTime less than endTime'); | |
42 anim.effect.timing.endDelay = -500; | |
43 anim.currentTime = 400; | |
44 assert_equals(div.getAnimations()[0], anim, | |
45 'set currentTime less than endTime when endDelay is negative value'); | |
46 anim.currentTime = 500; | |
47 assert_equals(div.getAnimations().length, 0, | |
48 'set currentTime same as endTime when endDelay is negative value'); | |
49 anim.currentTime = 1000; | |
50 assert_equals(div.getAnimations().length, 0, | |
51 'set currentTime same as duration when endDelay is negative value'); | |
52 }, 'when endDelay is changed'); | |
53 | |
54 test(function(t) { | |
55 var div = createDiv(t); | |
56 var anim = div.animate({ opacity: [ 0, 1 ] }, | |
57 { duration: 1000, delay: 500, endDelay: -500 }); | |
58 assert_equals(div.getAnimations()[0], anim, 'when currentTime 0'); | |
59 anim.currentTime = 500; | |
60 assert_equals(div.getAnimations()[0], anim, 'set currentTime 500'); | |
61 anim.currentTime = 1000; | |
62 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); | |
63 }, 'when currentTime changed in duration:1000, delay: 500, endDelay: -500'); | |
64 | |
65 test(function(t) { | |
66 var div = createDiv(t); | |
67 var anim = div.animate({ opacity: [ 0, 1 ] }, | |
68 { duration: 1000, delay: -500, endDelay: -500 }); | |
69 assert_equals(div.getAnimations().length, 0, 'when currentTime 0'); | |
70 anim.currentTime = 500; | |
71 assert_equals(div.getAnimations().length, 0, 'set currentTime 500'); | |
72 anim.currentTime = 1000; | |
73 assert_equals(div.getAnimations().length, 0, 'set currentTime 1000'); | |
74 }, 'when currentTime changed in duration:1000, delay: -500, endDelay: -500'); | |
75 | |
76 | |
77 </script> | |
78 </body> | |
OLD | NEW |