@@ -15,12 +15,12 @@ describe("url", function() {
1515test ( "background img 4" , ".class { background: green url( img.png ) xyz }" , [
1616[ 1 , ".class { background: green url({./img.png}) xyz }" , "" ]
1717] ) ;
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+ ] ) ;
2424test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" , [
2525[ 1 , ".class { background: green url(/img.png) xyz }" , "" ]
2626] ) ;
@@ -79,6 +79,30 @@ describe("url", function() {
7979test ( "-webkit-image-set" , ".a { background-image: -webkit-image-set(url('url1x.png') 1x, url('url2x.png') 2x) }" , [
8080[ 1 , ".a { background-image: -webkit-image-set(url({./url1x.png}) 1x, url({./url2x.png}) 2x) }" , "" ]
8181] ) ;
82+ test ( "empty url" , ".class { background: green url() xyz }" , [
83+ [ 1 , ".class { background: green url() xyz }" , "" ]
84+ ] ) ;
85+ test ( "empty url with quotes" , ".class { background: green url('') xyz }" , [
86+ [ 1 , ".class { background: green url('') xyz }" , "" ]
87+ ] ) ;
88+ test ( "empty url with spaces and quotes" , ".class { background: green url(' ') xyz }" , [
89+ [ 1 , ".class { background: green url('') xyz }" , "" ]
90+ ] ) ;
91+ test ( "empty url with newline and quotes" , ".class { background: green url('\n') xyz }" , [
92+ [ 1 , ".class { background: green url('') xyz }" , "" ]
93+ ] ) ;
94+ test ( "empty url with CRLF and quotes" , ".class { background: green url('\r\n') xyz }" , [
95+ [ 1 , ".class { background: green url('') xyz }" , "" ]
96+ ] ) ;
97+ test ( "empty url with tab and quotes" , ".class { background: green url('\t') xyz }" , [
98+ [ 1 , ".class { background: green url('') xyz }" , "" ]
99+ ] ) ;
100+ test ( "external absolute url" , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
101+ [ 1 , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
102+ ] ) ;
103+ test ( "external schema-less url" , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
104+ [ 1 , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
105+ ] ) ;
82106
83107test ( "background img with url" , ".class { background: green url( \"img.png\" ) xyz }" , [
84108[ 1 , ".class { background: green url( \"img.png\" ) xyz }" , "" ]
@@ -141,4 +165,28 @@ describe("url", function() {
141165test ( "keyframe background img with url" , "@keyframes anim { background: green url('img.png') xyz }" , [
142166[ 1 , "@keyframes anim { background: green url('img.png') xyz }" , "" ]
143167] , "?-url" ) ;
168+ test ( "empty url" , ".class { background: green url() xyz }" , [
169+ [ 1 , ".class { background: green url() xyz }" , "" ]
170+ ] , "?-url" ) ;
171+ test ( "empty url with quotes" , ".class { background: green url('') xyz }" , [
172+ [ 1 , ".class { background: green url('') xyz }" , "" ]
173+ ] , "?-url" ) ;
174+ test ( "empty url with spaces and quotes" , ".class { background: green url(' ') xyz }" , [
175+ [ 1 , ".class { background: green url(' ') xyz }" , "" ]
176+ ] , "?-url" ) ;
177+ test ( "empty url with newline and quotes" , ".class { background: green url('\n') xyz }" , [
178+ [ 1 , ".class { background: green url('\n') xyz }" , "" ]
179+ ] , "?-url" ) ;
180+ test ( "empty url with CRLF and quotes" , ".class { background: green url('\r\n') xyz }" , [
181+ [ 1 , ".class { background: green url('\r\n') xyz }" , "" ]
182+ ] , "?-url" ) ;
183+ test ( "empty url with tab and quotes" , ".class { background: green url('\t') xyz }" , [
184+ [ 1 , ".class { background: green url('\t') xyz }" , "" ]
185+ ] , "?-url" ) ;
186+ test ( "external absolute url" , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
187+ [ 1 , ".class { background: green url(https://raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
188+ ] , "?-url" ) ;
189+ test ( "external schema-less url" , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , [
190+ [ 1 , ".class { background: green url(//raw.githubusercontent.com/webpack/media/master/logo/icon.png) xyz }" , "" ]
191+ ] , "?-url" ) ;
144192} ) ;
0 commit comments