@@ -7,32 +7,32 @@ describe('absolute url to stylesheet', () => {
7
7
8
8
it ( 'can handle relative path' , ( ) => {
9
9
expect ( absoluteToStylesheet ( 'url(a.jpg)' , href ) ) . to . equal (
10
- `url(' http://localhost/css/a.jpg' )` ,
10
+ `url(http://localhost/css/a.jpg)` ,
11
11
) ;
12
12
} ) ;
13
13
14
14
it ( 'can handle same level path' , ( ) => {
15
15
expect ( absoluteToStylesheet ( 'url("./a.jpg")' , href ) ) . to . equal (
16
- `url(' http://localhost/css/a.jpg' )` ,
16
+ `url(" http://localhost/css/a.jpg" )` ,
17
17
) ;
18
18
} ) ;
19
19
20
20
it ( 'can handle parent level path' , ( ) => {
21
21
expect ( absoluteToStylesheet ( 'url("../a.jpg")' , href ) ) . to . equal (
22
- `url(' http://localhost/a.jpg' )` ,
22
+ `url(" http://localhost/a.jpg" )` ,
23
23
) ;
24
24
} ) ;
25
25
26
26
it ( 'can handle absolute path' , ( ) => {
27
27
expect ( absoluteToStylesheet ( 'url("/a.jpg")' , href ) ) . to . equal (
28
- `url(' http://localhost/a.jpg' )` ,
28
+ `url(" http://localhost/a.jpg" )` ,
29
29
) ;
30
30
} ) ;
31
31
32
32
it ( 'can handle external path' , ( ) => {
33
33
expect (
34
34
absoluteToStylesheet ( 'url("http://localhost/a.jpg")' , href ) ,
35
- ) . to . equal ( `url(' http://localhost/a.jpg' )` ) ;
35
+ ) . to . equal ( `url(" http://localhost/a.jpg" )` ) ;
36
36
} ) ;
37
37
38
38
it ( 'can handle single quote path' , ( ) => {
@@ -43,7 +43,7 @@ describe('absolute url to stylesheet', () => {
43
43
44
44
it ( 'can handle no quote path' , ( ) => {
45
45
expect ( absoluteToStylesheet ( 'url(./a.jpg)' , href ) ) . to . equal (
46
- `url(' http://localhost/css/a.jpg' )` ,
46
+ `url(http://localhost/css/a.jpg)` ,
47
47
) ;
48
48
} ) ;
49
49
@@ -54,8 +54,8 @@ describe('absolute url to stylesheet', () => {
54
54
href ,
55
55
) ,
56
56
) . 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;` ,
59
59
) ;
60
60
} ) ;
61
61
@@ -71,6 +71,14 @@ describe('absolute url to stylesheet', () => {
71
71
) . to . equal ( 'url(data:application/font-woff;base64,d09GMgABAAAAAAm)' ) ;
72
72
} ) ;
73
73
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
+ } ) ;
74
82
it ( 'can handle empty path' , ( ) => {
75
83
expect ( absoluteToStylesheet ( `url('')` , href ) ) . to . equal ( `url('')` ) ;
76
84
} ) ;
0 commit comments