| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>KeyframeEffectReadOnly constructor tests</title> | 3 <title>KeyframeEffectReadOnly constructor tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-keyframeeffect-
interfaces"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-keyframeeffect-
interfaces"> |
| 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 <div id="target"></div> | 12 <div id="target"></div> |
| 12 <style> | 13 <style> |
| 13 #target { | 14 #target { |
| 14 border-style: solid; /* so border-*-width values don't compute to 0 */ | 15 border-style: solid; /* so border-*-width values don't compute to 0 */ |
| 15 } | 16 } |
| 16 </style> | 17 </style> |
| 17 <script> | 18 <script> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 gEasingValueTests.forEach(function(subtest) { | 60 gEasingValueTests.forEach(function(subtest) { |
| 60 var easing = subtest[0]; | 61 var easing = subtest[0]; |
| 61 var expected = subtest[1]; | 62 var expected = subtest[1]; |
| 62 var effect = new KeyframeEffectReadOnly(target, { | 63 var effect = new KeyframeEffectReadOnly(target, { |
| 63 left: ["10px", "20px"] | 64 left: ["10px", "20px"] |
| 64 }, { easing: easing }); | 65 }, { easing: easing }); |
| 65 assert_equals(effect.timing.easing, expected, | 66 assert_equals(effect.timing.easing, expected, |
| 66 "resulting easing for '" + easing + "'"); | 67 "resulting easing for '" + easing + "'"); |
| 67 }); | 68 }); |
| 68 }, "easing values are parsed correctly when passed to the " + | 69 }, "easing values are parsed correctly when passed to the " + |
| 69 "KeyframeEffectReadOnly constructor in KeyframeTimingOptions"); | 70 "KeyframeEffectReadOnly constructor in KeyframeEffectOptions"); |
| 71 |
| 72 test(function(t) { |
| 73 gInvalidEasings.forEach(invalidEasing => { |
| 74 assert_throws(new TypeError, () => { |
| 75 new KeyframeEffectReadOnly(target, { easing: invalidEasing }); |
| 76 }, `TypeError is thrown for easing '${invalidEasing}'`); |
| 77 }); |
| 78 }, 'invalid easing values are correctly rejected when passed to the ' + |
| 79 'KeyframeEffectReadOnly constructor in regular keyframes'); |
| 80 |
| 81 test(function(t) { |
| 82 gInvalidEasings.forEach(invalidEasing => { |
| 83 assert_throws(new TypeError, () => { |
| 84 new KeyframeEffectReadOnly(target, null, { easing: invalidEasing }); |
| 85 }, `TypeError is thrown for easing '${invalidEasing}'`); |
| 86 }); |
| 87 }, 'invalid easing values are correctly rejected when passed to the ' + |
| 88 'KeyframeEffectReadOnly constructor in KeyframeEffectOptions'); |
| 70 | 89 |
| 71 test(function(t) { | 90 test(function(t) { |
| 72 var getKeyframe = function(composite) { | 91 var getKeyframe = function(composite) { |
| 73 return { left: [ "10px", "20px" ], composite: composite }; | 92 return { left: [ "10px", "20px" ], composite: composite }; |
| 74 }; | 93 }; |
| 75 gGoodKeyframeCompositeValueTests.forEach(function(composite) { | 94 gGoodKeyframeCompositeValueTests.forEach(function(composite) { |
| 76 var effect = new KeyframeEffectReadOnly(target, getKeyframe(composite)); | 95 var effect = new KeyframeEffectReadOnly(target, getKeyframe(composite)); |
| 77 assert_equals(effect.getKeyframes()[0].composite, composite, | 96 assert_equals(effect.getKeyframes()[0].composite, composite, |
| 78 "resulting composite for '" + composite + "'"); | 97 "resulting composite for '" + composite + "'"); |
| 79 }); | 98 }); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 test(function(t) { | 288 test(function(t) { |
| 270 var test_error = { name: "test" }; | 289 var test_error = { name: "test" }; |
| 271 | 290 |
| 272 assert_throws(test_error, function() { | 291 assert_throws(test_error, function() { |
| 273 new KeyframeEffect(target, { get left() { throw test_error }}) | 292 new KeyframeEffect(target, { get left() { throw test_error }}) |
| 274 }); | 293 }); |
| 275 }, "KeyframeEffect constructor propagates exceptions generated by accessing" | 294 }, "KeyframeEffect constructor propagates exceptions generated by accessing" |
| 276 + " the options object"); | 295 + " the options object"); |
| 277 </script> | 296 </script> |
| 278 </body> | 297 </body> |
| OLD | NEW |