Bug 1402170 - Merge gInvalidEasingInKeyframeSequenceTests with gInvalidEasings; r?hiro
MozReview-Commit-ID: CIjKWyU2GIs
--- 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
];