parent
333a708bb6
commit
1dca575701
|
@ -43,5 +43,5 @@ export function extractStyleUrls(
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
|
const CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
|
||||||
const CSS_COMMENT_REGEXP = /\/\*.+?\*\//g;
|
const CSS_COMMENT_REGEXP = /\/\*[\s\S]+?\*\//g;
|
||||||
const URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
|
const URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
|
||||||
|
|
|
@ -40,11 +40,15 @@ export function main() {
|
||||||
const css = `
|
const css = `
|
||||||
@import '1.css';
|
@import '1.css';
|
||||||
/*@import '2.css';*/
|
/*@import '2.css';*/
|
||||||
|
/*
|
||||||
|
@import '3.css';
|
||||||
|
*/
|
||||||
`;
|
`;
|
||||||
const styleWithImports = extractStyleUrls(urlResolver, 'http://ng.io', css);
|
const styleWithImports = extractStyleUrls(urlResolver, 'http://ng.io', css);
|
||||||
expect(styleWithImports.style.trim()).toEqual('');
|
expect(styleWithImports.style.trim()).toEqual('');
|
||||||
expect(styleWithImports.styleUrls).toContain('http://ng.io/1.css');
|
expect(styleWithImports.styleUrls).toContain('http://ng.io/1.css');
|
||||||
expect(styleWithImports.styleUrls).not.toContain('http://ng.io/2.css');
|
expect(styleWithImports.styleUrls).not.toContain('http://ng.io/2.css');
|
||||||
|
expect(styleWithImports.styleUrls).not.toContain('http://ng.io/3.css');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extract "@import url()" urls', () => {
|
it('should extract "@import url()" urls', () => {
|
||||||
|
|
Loading…
Reference in New Issue