@@ -15,12 +15,12 @@ describe("url", function() {
15
15
test ( "background img 4" , ".class { background: green url( img.png ) xyz }" , [
16
16
[ 1 , ".class { background: green url({./img.png}) xyz }" , "" ]
17
17
] ) ;
18
- test ( "background img contain space in name" , ".class { background: green url( \"img img.png\" ) xyz }" , [
19
- [ 1 , ".class { background: green url(\"{./img img.png}\") xyz }" , "" ]
20
- ] ) ;
21
- test ( "background 2 img contain space in name" , ".class { background: green url( 'img img.png' ) xyz }" , [
22
- [ 1 , ".class { background: green url('{./img img.png}') xyz }" , "" ]
23
- ] ) ;
18
+ test ( "background img contain space in name" , ".class { background: green url( \"img img.png\" ) xyz }" , [
19
+ [ 1 , ".class { background: green url(\"{./img img.png}\") xyz }" , "" ]
20
+ ] ) ;
21
+ test ( "background 2 img contain space in name" , ".class { background: green url( 'img img.png' ) xyz }" , [
22
+ [ 1 , ".class { background: green url('{./img img.png}') xyz }" , "" ]
23
+ ] ) ;
24
24
test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" , [
25
25
[ 1 , ".class { background: green url(/img.png) xyz }" , "" ]
26
26
] ) ;
@@ -70,6 +70,30 @@ describe("url", function() {
70
70
test ( "-webkit-image-set" , ".a { background-image: -webkit-image-set(url('url1x.png') 1x, url('url2x.png') 2x) }" , [
71
71
[ 1 , ".a { background-image: -webkit-image-set(url({./url1x.png}) 1x, url({./url2x.png}) 2x) }" , "" ]
72
72
] ) ;
73
+ test ( "empty url" , ".class { background: green url() xyz }" , [
74
+ [ 1 , ".class { background: green url() xyz }" , "" ]
75
+ ] ) ;
76
+ test ( "empty url with quotes" , ".class { background: green url('') xyz }" , [
77
+ [ 1 , ".class { background: green url('') xyz }" , "" ]
78
+ ] ) ;
79
+ test ( "empty url with spaces and quotes" , ".class { background: green url(' ') xyz }" , [
80
+ [ 1 , ".class { background: green url(' ') xyz }" , "" ]
81
+ ] ) ;
82
+ test ( "empty url with newline and quotes" , ".class { background: green url('\n') xyz }" , [
83
+ [ 1 , ".class { background: green url('\n') xyz }" , "" ]
84
+ ] ) ;
85
+ test ( "empty url with CRLF and quotes" , ".class { background: green url('\r\n') xyz }" , [
86
+ [ 1 , ".class { background: green url('\r\n') xyz }" , "" ]
87
+ ] ) ;
88
+ test ( "empty url with tab and quotes" , ".class { background: green url('\t') xyz }" , [
89
+ [ 1 , ".class { background: green url('\t') xyz }" , "" ]
90
+ ] ) ;
91
+ test ( "external absolute url" , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
92
+ [ 1 , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
93
+ ] ) ;
94
+ test ( "external schema-less url" , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
95
+ [ 1 , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
96
+ ] ) ;
73
97
74
98
test ( "background img with url" , ".class { background: green url( \"img.png\" ) xyz }" , [
75
99
[ 1 , ".class { background: green url( \"img.png\" ) xyz }" , "" ]
@@ -132,4 +156,28 @@ describe("url", function() {
132
156
test ( "keyframe background img with url" , "@keyframes anim { background: green url('img.png') xyz }" , [
133
157
[ 1 , "@keyframes anim { background: green url('img.png') xyz }" , "" ]
134
158
] , "?-url" ) ;
159
+ test ( "empty url" , ".class { background: green url() xyz }" , [
160
+ [ 1 , ".class { background: green url() xyz }" , "" ]
161
+ ] , "?-url" ) ;
162
+ test ( "empty url with quotes" , ".class { background: green url('') xyz }" , [
163
+ [ 1 , ".class { background: green url('') xyz }" , "" ]
164
+ ] , "?-url" ) ;
165
+ test ( "empty url with spaces and quotes" , ".class { background: green url(' ') xyz }" , [
166
+ [ 1 , ".class { background: green url(' ') xyz }" , "" ]
167
+ ] , "?-url" ) ;
168
+ test ( "empty url with newline and quotes" , ".class { background: green url('\n') xyz }" , [
169
+ [ 1 , ".class { background: green url('\n') xyz }" , "" ]
170
+ ] , "?-url" ) ;
171
+ test ( "empty url with CRLF and quotes" , ".class { background: green url('\r\n') xyz }" , [
172
+ [ 1 , ".class { background: green url('\r\n') xyz }" , "" ]
173
+ ] , "?-url" ) ;
174
+ test ( "empty url with tab and quotes" , ".class { background: green url('\t') xyz }" , [
175
+ [ 1 , ".class { background: green url('\t') xyz }" , "" ]
176
+ ] , "?-url" ) ;
177
+ test ( "external absolute url" , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
178
+ [ 1 , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
179
+ ] , "?-url" ) ;
180
+ test ( "external schema-less url" , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
181
+ [ 1 , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
182
+ ] , "?-url" ) ;
135
183
} ) ;
0 commit comments