-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(css): filter out function name suffixes with url (#3752)
- Loading branch information
1 parent
076c5a4
commit 9aa255a
Showing
2 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { cssUrlRE } from '../../plugins/css' | ||
|
||
describe('search css url function', () => { | ||
test('some spaces before it', () => { | ||
expect( | ||
cssUrlRE.test("list-style-image: url('../images/bullet.jpg');") | ||
).toBe(true) | ||
}) | ||
|
||
test('no space after colon', () => { | ||
expect(cssUrlRE.test("list-style-image:url('../images/bullet.jpg');")).toBe( | ||
true | ||
) | ||
}) | ||
|
||
test('at the beginning of line', () => { | ||
expect(cssUrlRE.test("url('../images/bullet.jpg');")).toBe(true) | ||
}) | ||
|
||
test('as suffix of a function name', () => { | ||
expect( | ||
cssUrlRE.test(`@function svg-url($string) { | ||
@return ""; | ||
}`) | ||
).toBe(false) | ||
}) | ||
|
||
test('after parenthesis', () => { | ||
expect( | ||
cssUrlRE.test( | ||
'mask-image: image(url(mask.png), skyblue, linear-gradient(rgba(0, 0, 0, 1.0), transparent));' | ||
) | ||
).toBe(true) | ||
}) | ||
|
||
test('after comma', () => { | ||
expect( | ||
cssUrlRE.test( | ||
'mask-image: image(skyblue,url(mask.png), linear-gradient(rgba(0, 0, 0, 1.0), transparent));' | ||
) | ||
).toBe(true) | ||
}) | ||
}) |
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