Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ define(function (require, exports, module) {
BEZIER_CURVE_GENERAL_REGEX = /cubic-bezier\((.*)\)/,
EASE_STRICT_REGEX = /[: ,]ease(?:-in)?(?:-out)?[ ,;]/,
EASE_LAX_REGEX = /ease(?:-in)?(?:-out)?/,
LINEAR_STRICT_REGEX = /transition.*?[: ,]linear[ ,;]/,
LINEAR_STRICT_REGEX = /(transition|animation).*?[: ,]linear[ ,;]/,
LINEAR_LAX_REGEX = /linear/,
STEPS_VALID_REGEX = /steps\(\s*(\d+)\s*(?:,\s*(\w+)\s*)?\)/,
STEPS_GENERAL_REGEX = /steps\((.*)\)/,
Expand Down Expand Up @@ -357,7 +357,7 @@ define(function (require, exports, module) {
}
} else {
// The linear keyword can occur in other values, so for strict parsing we
// only detect when it's on same line as "transition"
// only detect when it's on same line as "transition" or "animation"
match = str.match(LINEAR_STRICT_REGEX);
if (match) {
// return exact match to keyword that we need for later replacement
Expand Down
31 changes: 31 additions & 0 deletions src/extensions/default/InlineTimingFunctionEditor/unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,37 @@ define(function (require, exports, module) {
});

// Valid other functions
it("should match linear animation function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("animation-timing-function: linear;", false);
expect(match.length).toEqual(1);
expect(match[0]).toEqual("linear");
expect(match.originalString).toBeFalsy();
});
it("should match ease animation function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("animation-timing-function: ease;", false);
expect(match.length).toEqual(1);
expect(match[0]).toEqual("ease");
expect(match.originalString).toBeFalsy();
});
it("should match ease-in animation function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("animation-timing-function: ease-in;", false);
expect(match.length).toEqual(1);
expect(match[0]).toEqual("ease-in");
expect(match.originalString).toBeFalsy();
});
it("should match ease-out animation function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("animation-timing-function: ease-out;", false);
expect(match.length).toEqual(1);
expect(match[0]).toEqual("ease-out");
expect(match.originalString).toBeFalsy();
});
it("should match ease-in-out animation function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("animation-timing-function: ease-in-out;", false);
expect(match.length).toEqual(1);
expect(match[0]).toEqual("ease-in-out");
expect(match.originalString).toBeFalsy();
});

it("should match linear function in declaration in strict mode", function () {
match = TimingFunctionUtils.timingFunctionMatch("transition-timing-function: linear;", false);
expect(match.length).toEqual(1);
Expand Down