@@ -7,32 +7,32 @@ describe('absolute url to stylesheet', () => {
77
88 it ( 'can handle relative path' , ( ) => {
99 expect ( absoluteToStylesheet ( 'url(a.jpg)' , href ) ) . to . equal (
10- `url(' http://localhost/css/a.jpg' )` ,
10+ `url(http://localhost/css/a.jpg)` ,
1111 ) ;
1212 } ) ;
1313
1414 it ( 'can handle same level path' , ( ) => {
1515 expect ( absoluteToStylesheet ( 'url("./a.jpg")' , href ) ) . to . equal (
16- `url(' http://localhost/css/a.jpg' )` ,
16+ `url(" http://localhost/css/a.jpg" )` ,
1717 ) ;
1818 } ) ;
1919
2020 it ( 'can handle parent level path' , ( ) => {
2121 expect ( absoluteToStylesheet ( 'url("../a.jpg")' , href ) ) . to . equal (
22- `url(' http://localhost/a.jpg' )` ,
22+ `url(" http://localhost/a.jpg" )` ,
2323 ) ;
2424 } ) ;
2525
2626 it ( 'can handle absolute path' , ( ) => {
2727 expect ( absoluteToStylesheet ( 'url("/a.jpg")' , href ) ) . to . equal (
28- `url(' http://localhost/a.jpg' )` ,
28+ `url(" http://localhost/a.jpg" )` ,
2929 ) ;
3030 } ) ;
3131
3232 it ( 'can handle external path' , ( ) => {
3333 expect (
3434 absoluteToStylesheet ( 'url("http://localhost/a.jpg")' , href ) ,
35- ) . to . equal ( `url(' http://localhost/a.jpg' )` ) ;
35+ ) . to . equal ( `url(" http://localhost/a.jpg" )` ) ;
3636 } ) ;
3737
3838 it ( 'can handle single quote path' , ( ) => {
@@ -43,7 +43,7 @@ describe('absolute url to stylesheet', () => {
4343
4444 it ( 'can handle no quote path' , ( ) => {
4545 expect ( absoluteToStylesheet ( 'url(./a.jpg)' , href ) ) . to . equal (
46- `url(' http://localhost/css/a.jpg' )` ,
46+ `url(http://localhost/css/a.jpg)` ,
4747 ) ;
4848 } ) ;
4949
@@ -54,8 +54,8 @@ describe('absolute url to stylesheet', () => {
5454 href ,
5555 ) ,
5656 ) . to . equal (
57- `background-image: url(' http://localhost/css/images/b.jpg' );` +
58- `background: #aabbcc url(' http://localhost/css/images/a.jpg' ) 50% 50% repeat;` ,
57+ `background-image: url(http://localhost/css/images/b.jpg);` +
58+ `background: #aabbcc url(http://localhost/css/images/a.jpg) 50% 50% repeat;` ,
5959 ) ;
6060 } ) ;
6161
@@ -71,6 +71,14 @@ describe('absolute url to stylesheet', () => {
7171 ) . to . equal ( 'url(data:application/font-woff;base64,d09GMgABAAAAAAm)' ) ;
7272 } ) ;
7373
74+ it ( 'preserves quotes around inline svgs with spaces' , ( ) => {
75+ expect (
76+ absoluteToStylesheet ( "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%2328a745' d='M3'/%3E%3C/svg%3E\")" , href ) ,
77+ ) . to . equal ( "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%2328a745' d='M3'/%3E%3C/svg%3E\")" ) ;
78+ expect (
79+ absoluteToStylesheet ( 'url(\'data:image/svg+xml;utf8,<svg width="28" height="32" viewBox="0 0 28 32" xmlns="http://www.w3.org/2000/svg"><path d="M27 14C28" fill="white"/></svg>\')' , href ) ,
80+ ) . to . equal ( 'url(\'data:image/svg+xml;utf8,<svg width="28" height="32" viewBox="0 0 28 32" xmlns="http://www.w3.org/2000/svg"><path d="M27 14C28" fill="white"/></svg>\')' ) ;
81+ } ) ;
7482 it ( 'can handle empty path' , ( ) => {
7583 expect ( absoluteToStylesheet ( `url('')` , href ) ) . to . equal ( `url('')` ) ;
7684 } ) ;
0 commit comments