fix(style_url_resolver): fix data: url resolution
This commit is contained in:
@@ -24,6 +24,14 @@ export function main() {
|
||||
|
||||
expect(indexes).toEqual([1, 4, 8, 9]);
|
||||
});
|
||||
|
||||
it('should reset before it is reused', () => {
|
||||
var re = /^['"]/g;
|
||||
var str = "'";
|
||||
expect(RegExpWrapper.test(re, str)).toEqual(true);
|
||||
// If not reset, the second attempt to test results in false
|
||||
expect(RegExpWrapper.test(re, str)).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('const', () => {
|
||||
|
||||
@@ -70,5 +70,26 @@ export function main() {
|
||||
var resolvedCss = styleUrlResolver.resolveUrls(css, 'http://ng.io');
|
||||
expect(resolvedCss).toEqual(expectedCss);
|
||||
});
|
||||
|
||||
it('should not strip quotes from inlined SVG styles', () => {
|
||||
var css = `
|
||||
.selector {
|
||||
background:rgb(55,71,79) url('data:image/svg+xml;utf8,<?xml version="1.0"?>');
|
||||
background:rgb(55,71,79) url("data:image/svg+xml;utf8,<?xml version='1.0'?>");
|
||||
background:rgb(55,71,79) url("/some/data:image");
|
||||
}
|
||||
`;
|
||||
|
||||
var expectedCss = `
|
||||
.selector {
|
||||
background:rgb(55,71,79) url('data:image/svg+xml;utf8,<?xml version="1.0"?>');
|
||||
background:rgb(55,71,79) url("data:image/svg+xml;utf8,<?xml version='1.0'?>");
|
||||
background:rgb(55,71,79) url('http://ng.io/some/data:image');
|
||||
}
|
||||
`;
|
||||
|
||||
var resolvedCss = styleUrlResolver.resolveUrls(css, 'http://ng.io');
|
||||
expect(resolvedCss).toEqual(expectedCss);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user