Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false positives for interpolation in keyframes-name-pattern (#6265)
- Loading branch information
1 parent
32cc05a
commit df98339
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
const isStandardSyntaxKeyframesName = require('../isStandardSyntaxKeyframesName'); | ||
|
||
describe('isStandardSyntaxKeyframesName', () => { | ||
it('standard name', () => { | ||
expect(isStandardSyntaxKeyframesName('slidein')).toBe(true); | ||
}); | ||
it('hyphenated name', () => { | ||
expect(isStandardSyntaxKeyframesName('slide-in')).toBe(true); | ||
}); | ||
it('name with underscore', () => { | ||
expect(isStandardSyntaxKeyframesName('slide_in')).toBe(true); | ||
}); | ||
it('scss interpolation', () => { | ||
expect(isStandardSyntaxKeyframesName('frame-#{$name}')).toBe(false); | ||
}); | ||
it('scss interpolation start', () => { | ||
expect(isStandardSyntaxKeyframesName('#{$name}-frame')).toBe(false); | ||
}); | ||
it('scss interpolation single quoted', () => { | ||
expect(isStandardSyntaxKeyframesName("'frame-#{$name}'")).toBe(false); | ||
}); | ||
it('scss interpolation single quoted start', () => { | ||
expect(isStandardSyntaxKeyframesName("'#{$name}-frame'")).toBe(false); | ||
}); | ||
it('scss interpolation double quoted', () => { | ||
expect(isStandardSyntaxKeyframesName('"frame-#{$name}"')).toBe(false); | ||
}); | ||
it('scss interpolation doubled quoted start', () => { | ||
expect(isStandardSyntaxKeyframesName('"#{$name}-frame"')).toBe(false); | ||
}); | ||
it('less interpolation', () => { | ||
expect(isStandardSyntaxKeyframesName('frame-@{name}')).toBe(false); | ||
}); | ||
it('less interpolation start', () => { | ||
expect(isStandardSyntaxKeyframesName('@{name}-frame')).toBe(false); | ||
}); | ||
it('less interpolation single quoted', () => { | ||
expect(isStandardSyntaxKeyframesName("'frame-@{name}'")).toBe(false); | ||
}); | ||
it('less interpolation single quoted start', () => { | ||
expect(isStandardSyntaxKeyframesName("'@{name}-frame'")).toBe(false); | ||
}); | ||
it('less interpolation double quoted', () => { | ||
expect(isStandardSyntaxKeyframesName('"frame-@{name}"')).toBe(false); | ||
}); | ||
it('less interpolation doubled quoted start', () => { | ||
expect(isStandardSyntaxKeyframesName('"@{name}-frame"')).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const hasInterpolation = require('./hasInterpolation'); | ||
|
||
/** | ||
* Check whether a keyframes name is standard | ||
* | ||
* @param {string} keyframesName | ||
* @returns {boolean} | ||
*/ | ||
module.exports = function isStandardSyntaxKeyframesName(keyframesName) { | ||
if (hasInterpolation(keyframesName)) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}; |