New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect keyword 'linear' on lines containing word 'animation' too #10989

Merged
merged 3 commits into from Jun 20, 2015
Jump to file or symbol
Failed to load files and symbols.
+33 −2
Diff settings

Always

Just for now

@@ -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);
ProTip! Use n and p to navigate between commits in a pull request.