Skip to content

Commit 0def28e

Browse files
committed
fix(compiler): shadow CSS @import test in some browsers
Closes #4629
1 parent b967847 commit 0def28e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

modules/angular2/src/test_lib/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export function normalizeCSS(css: string): string {
8888
css = StringWrapper.replaceAll(css, /:\s/g, ':');
8989
css = StringWrapper.replaceAll(css, /'/g, '"');
9090
css = StringWrapper.replaceAll(css, / }/g, '}');
91-
css = StringWrapper.replaceAllMapped(css, /url\(\"(.+)\\"\)/g, (match) => `url(${match[1]})`);
91+
css = StringWrapper.replaceAllMapped(css, /url\((\"|\s)(.+)(\"|\s)\)(\s*)/g,
92+
(match) => `url("${match[2]}")`);
9293
css = StringWrapper.replaceAllMapped(css, /\[(.+)=([^"\]]+)\]/g,
9394
(match) => `[${match[1]}="${match[2]}"]`);
9495
return css;

modules/angular2/test/core/compiler/shadow_css_spec.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,14 @@ export function main() {
155155
expect(css).toEqual('x[a] y[a] {}');
156156
});
157157

158-
it('should pass through @import directives', () => {
159-
var styleStr = '@import url("https://fonts.googleapis.com/css?family=Roboto");';
160-
var css = s(styleStr, 'a');
161-
expect(css).toEqual(styleStr);
162-
});
158+
// TODO: can't work in Firefox, see https://bugzilla.mozilla.org/show_bug.cgi?id=625013
159+
// Issue opened to track that: https://github.com/angular/angular/issues/4628
160+
if (!browserDetection.isFirefox) {
161+
it('should pass through @import directives', () => {
162+
var styleStr = '@import url("https://fonts.googleapis.com/css?family=Roboto");';
163+
var css = s(styleStr, 'a');
164+
expect(css).toEqual(styleStr);
165+
});
166+
}
163167
});
164168
}

0 commit comments

Comments
 (0)