Bug 1402170 - Merge gInvalidEasingInKeyframeSequenceTests with gInvalidEasings; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Fri, 22 Sep 2017 15:37:23 +0900
changeset 673292 56b66a314e8fdad37d0d51f16e03d1fa149c9b13
parent 673291 4870cdddc0226081f651a23331b848fdd4193a5c
child 673293 3e739f31abd9166d3ff252f4a984adb5d26a94a4
push id82519
push userbmo:bbirtles@mozilla.com
push dateMon, 02 Oct 2017 08:06:17 +0000
reviewershiro
bugs1402170
milestone58.0a1
Bug 1402170 - Merge gInvalidEasingInKeyframeSequenceTests with gInvalidEasings; r?hiro MozReview-Commit-ID: CIjKWyU2GIs
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
testing/web-platform/tests/web-animations/resources/easing-tests.js
testing/web-platform/tests/web-animations/resources/keyframe-utils.js
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
@@ -76,16 +76,25 @@ test(function(t) {
     }, `TypeError is thrown for easing '${invalidEasing}'`);
   });
 }, 'invalid easing values are correctly rejected when passed to the ' +
    'KeyframeEffectReadOnly constructor in regular keyframes');
 
 test(function(t) {
   gInvalidEasings.forEach(invalidEasing => {
     assert_throws(new TypeError, () => {
+      new KeyframeEffectReadOnly(target, [{ easing: invalidEasing }]);
+    }, `TypeError is thrown for easing '${invalidEasing}'`);
+  });
+}, 'invalid easing values are correctly rejected when passed to the ' +
+   'KeyframeEffectReadOnly constructor in a keyframe sequence');
+
+test(function(t) {
+  gInvalidEasings.forEach(invalidEasing => {
+    assert_throws(new TypeError, () => {
       new KeyframeEffectReadOnly(target, null, { easing: invalidEasing });
     }, `TypeError is thrown for easing '${invalidEasing}'`);
   });
 }, 'invalid easing values are correctly rejected when passed to the ' +
    'KeyframeEffectReadOnly constructor in KeyframeEffectOptions');
 
 test(function(t) {
   var getKeyframe = function(composite) {
@@ -177,25 +186,16 @@ gKeyframeSequenceTests.forEach(function(
 gInvalidKeyframesTests.forEach(function(subtest) {
   test(function(t) {
     assert_throws(subtest.expected, function() {
       new KeyframeEffectReadOnly(target, subtest.input);
     });
   }, "KeyframeEffectReadOnly constructor throws with " + subtest.desc);
 });
 
-gInvalidEasingInKeyframeSequenceTests.forEach(function(subtest) {
-  test(function(t) {
-    assert_throws(new TypeError, function() {
-      new KeyframeEffectReadOnly(target, subtest.input);
-    });
-  }, "Invalid easing [" + subtest.desc + "] in keyframe sequence " +
-     "should be thrown");
-});
-
 test(function(t) {
   var effect = new KeyframeEffectReadOnly(target,
                                           { left: ["10px", "20px"] });
 
   var timing = effect.timing;
   assert_equals(timing.delay, 0, "default delay");
   assert_equals(timing.endDelay, 0, "default endDelay");
   assert_equals(timing.fill, "auto", "default fill");
--- a/testing/web-platform/tests/web-animations/resources/easing-tests.js
+++ b/testing/web-platform/tests/web-animations/resources/easing-tests.js
@@ -82,16 +82,19 @@ var gEasingTests = [
 
 const gInvalidEasings = [
   '',
   '7',
   'test',
   'initial',
   'inherit',
   'unset',
+  'unrecognized',
+  'var(--x)',
+  'ease-in-out, ease-out',
   'cubic-bezier(1.1, 0, 1, 1)',
   'cubic-bezier(0, 0, 1.1, 1)',
   'cubic-bezier(-0.1, 0, 1, 1)',
   'cubic-bezier(0, 0, -0.1, 1)',
   'cubic-bezier(0.1, 0, 4, 0.4)',
   'steps(-1, start)',
   'steps(0.1, start)',
   'steps(3, nowhere)',
--- a/testing/web-platform/tests/web-animations/resources/keyframe-utils.js
+++ b/testing/web-platform/tests/web-animations/resources/keyframe-utils.js
@@ -35,31 +35,16 @@ function assert_frames_equal(a, b, name)
 // [specified easing value, expected easing value]
 var gEasingValueTests = [
   ["linear", "linear"],
   ["ease-in-out", "ease-in-out"],
   ["Ease\\2d in-out", "ease-in-out"],
   ["ease /**/", "ease"],
 ];
 
-var gInvalidEasingInKeyframeSequenceTests = [
-  { desc:   "a blank easing",
-    input:  [{ easing: "" }] },
-  { desc:   "an unrecognized easing",
-    input:  [{ easing: "unrecognized" }] },
-  { desc:   "an 'initial' easing",
-    input:  [{ easing: "initial" }] },
-  { desc:   "an 'inherit' easing",
-    input:  [{ easing: "inherit" }] },
-  { desc:   "a variable easing",
-    input:  [{ easing: "var(--x)" }] },
-  { desc:   "a multi-value easing",
-    input:  [{ easing: "ease-in-out, ease-out" }] }
-];
-
 // ------------------------------
 //  Composite values
 // ------------------------------
 
 var gGoodKeyframeCompositeValueTests = [
   "replace", "add", "accumulate", undefined
 ];