Permalink
Browse files

Merge pull request #10989 from petetnt/linear-keyword-detection-fix

Detect keyword 'linear' on lines containing word 'animation' too
  • Loading branch information...
MarcelGerber committed Jun 20, 2015
2 parents 1a74ece + bef5f9a commit 7159b144fb0d478096866f817d77cb58a8f1aa9a
@@ -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\((.*)\)/,
@@ -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
@@ -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);

0 comments on commit 7159b14

Please sign in to comment.