OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Animatable.animate tests</title> | 3 <title>Animatable.animate tests</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animatable-anim
ate"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animatable-anim
ate"> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <script src="../../testcommon.js"></script> | 7 <script src="../../testcommon.js"></script> |
| 8 <script src="../../resources/easing-tests.js"></script> |
8 <script src="../../resources/keyframe-utils.js"></script> | 9 <script src="../../resources/keyframe-utils.js"></script> |
9 <body> | 10 <body> |
10 <div id="log"></div> | 11 <div id="log"></div> |
11 <iframe width="10" height="10" id="iframe"></iframe> | 12 <iframe width="10" height="10" id="iframe"></iframe> |
12 <script> | 13 <script> |
13 'use strict'; | 14 'use strict'; |
14 | 15 |
15 // Tests on Element | 16 // Tests on Element |
16 | 17 |
17 test(function(t) { | 18 test(function(t) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 90 |
90 gInvalidKeyframesTests.forEach(function(subtest) { | 91 gInvalidKeyframesTests.forEach(function(subtest) { |
91 test(function(t) { | 92 test(function(t) { |
92 var div = createDiv(t); | 93 var div = createDiv(t); |
93 assert_throws(subtest.expected, function() { | 94 assert_throws(subtest.expected, function() { |
94 div.animate(subtest.input, 2000); | 95 div.animate(subtest.input, 2000); |
95 }); | 96 }); |
96 }, 'Element.animate() does not accept ' + subtest.desc); | 97 }, 'Element.animate() does not accept ' + subtest.desc); |
97 }); | 98 }); |
98 | 99 |
| 100 gInvalidEasings.forEach(invalidEasing => { |
| 101 test(function(t) { |
| 102 var div = createDiv(t); |
| 103 assert_throws(new TypeError, () => { |
| 104 div.animate({ easing: invalidEasing }, 2000); |
| 105 }); |
| 106 }, `Element.animate() does not accept invalid easing: '${invalidEasing}'`); |
| 107 }); |
| 108 |
99 test(function(t) { | 109 test(function(t) { |
100 var div = createDiv(t); | 110 var div = createDiv(t); |
101 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); | 111 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000); |
102 assert_equals(anim.effect.timing.duration, 2000); | 112 assert_equals(anim.effect.timing.duration, 2000); |
103 // Also check that unspecified parameters receive their default values | 113 // Also check that unspecified parameters receive their default values |
104 assert_equals(anim.effect.timing.fill, 'auto'); | 114 assert_equals(anim.effect.timing.fill, 'auto'); |
105 }, 'Element.animate() accepts a double as an options argument'); | 115 }, 'Element.animate() accepts a double as an options argument'); |
106 | 116 |
107 test(function(t) { | 117 test(function(t) { |
108 var div = createDiv(t); | 118 var div = createDiv(t); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 181 |
172 test(function(t) { | 182 test(function(t) { |
173 var pseudoTarget = createPseudo(t, 'before'); | 183 var pseudoTarget = createPseudo(t, 'before'); |
174 var anim = pseudoTarget.animate(null); | 184 var anim = pseudoTarget.animate(null); |
175 assert_equals(anim.effect.target, pseudoTarget, | 185 assert_equals(anim.effect.target, pseudoTarget, |
176 'The returned Animation targets to the correct object'); | 186 'The returned Animation targets to the correct object'); |
177 }, 'CSSPseudoElement.animate() creates an Animation object targeting ' + | 187 }, 'CSSPseudoElement.animate() creates an Animation object targeting ' + |
178 'to the correct CSSPseudoElement object'); | 188 'to the correct CSSPseudoElement object'); |
179 </script> | 189 </script> |
180 </body> | 190 </body> |
OLD | NEW |