@@ -15,12 +15,12 @@ describe("url", function() {
1515 test ( "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+ ] ) ;
2424 test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" , [
2525 [ 1 , ".class { background: green url(/img.png) xyz }" , "" ]
2626 ] ) ;
@@ -70,6 +70,30 @@ describe("url", function() {
7070 test ( "-webkit-image-set" , ".a { background-image: -webkit-image-set(url('url1x.png') 1x, url('url2x.png') 2x) }" , [
7171 [ 1 , ".a { background-image: -webkit-image-set(url({./url1x.png}) 1x, url({./url2x.png}) 2x) }" , "" ]
7272 ] ) ;
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+ ] ) ;
7397
7498 test ( "background img with url" , ".class { background: green url( \"img.png\" ) xyz }" , [
7599 [ 1 , ".class { background: green url( \"img.png\" ) xyz }" , "" ]
@@ -132,4 +156,28 @@ describe("url", function() {
132156 test ( "keyframe background img with url" , "@keyframes anim { background: green url('img.png') xyz }" , [
133157 [ 1 , "@keyframes anim { background: green url('img.png') xyz }" , "" ]
134158 ] , "?-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" ) ;
135183} ) ;
0 commit comments