-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/build): correctly detect comma in Sass URL lexer
The Sass rebasing lexer was incorrectly checking for a comma in certain cases previously. This has now been corrected and url usage that immediately follows a comma within a rule will now be extracted as expected. (cherry picked from commit 8ff687d)
- Loading branch information
Showing
2 changed files
with
32 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
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,31 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.dev/license | ||
*/ | ||
|
||
import { findUrls } from './lexer'; | ||
|
||
describe('Sass URL lexer', () => { | ||
it('should find url immediately after a colon, comma, or whitespace', () => { | ||
const input = `.c{property:url("first"),url("second"), url("third");}`; | ||
|
||
const result = [...findUrls(input)]; | ||
|
||
expect(result).toEqual([ | ||
{ start: 16, end: 23, value: 'first' }, | ||
{ start: 29, end: 37, value: 'second' }, | ||
{ start: 44, end: 51, value: 'third' }, | ||
]); | ||
}); | ||
|
||
it('should find full url with string containing url function', () => { | ||
const input = `.c{property:url("url('abc')");}`; | ||
|
||
const result = [...findUrls(input)]; | ||
|
||
expect(result).toEqual([{ start: 16, end: 28, value: `url('abc')` }]); | ||
}); | ||
}); |