@@ -46,6 +46,9 @@ describe("url", function() {
4646 test ( "import" , "@import url(test.css);\n.class { a: b c d; }" ,
4747 [ "require(" + JSON . stringify ( "!" + path . join ( __dirname , ".." , "index.js" ) + "!./test.css" ) + ")" ,
4848 "\"\\n.class { a: b c d; }\"" ] ) ;
49+ test ( "import 2" , "@import url('test.css');" ,
50+ [ "require(" + JSON . stringify ( "!" + path . join ( __dirname , ".." , "index.js" ) + "!./test.css" ) + ")" ,
51+ "\"\"" ] ) ;
4952 test ( "import with media" , "@import url(~test/css) screen and print;\n.class { a: b c d; }" ,
5053 [ "\"@media screen and print{\"" ,
5154 "require(" + JSON . stringify ( "!" + path . join ( __dirname , ".." , "index.js" ) + "!test/css" ) + ")" ,
@@ -59,13 +62,18 @@ describe("url", function() {
5962 [ "\".class { background: green url( \"+require(\"./img.png\")+\" ) xyz }\"" ] ) ;
6063 test ( "background img 2" , ".class { background: green url(~img/png ) url(aaa) xyz }" ,
6164 [ "\".class { background: green url(\"+require(\"img/png\")+\" ) url(\"+require(\"./aaa\")+\") xyz }\"" ] ) ;
65+ test ( "background img 3" , ".class { background: green url( 'img.png' ) xyz }" ,
66+ [ "\".class { background: green url( \"+require(\"./img.png\")+\" ) xyz }\"" ] ) ;
6267 test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" ,
6368 [ "\".class { background: green url(/img.png) xyz }\"" ] ) ;
6469 test ( "background img absolute with root" , ".class { background: green url(/img.png) xyz }" ,
6570 [ "\".class { background: green url(\"+require(\"./img.png\")+\") xyz }\"" ] , "?root=." ) ;
6671 test ( "background img external" ,
6772 ".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }" ,
6873 [ "\".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }\"" ] ) ;
74+ test ( "background img external data" ,
75+ ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\") }" ,
76+ [ "\".class { background-image: url(\\\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\\\") }\"" ] ) ;
6977 test ( "filter hash" ,
7078 ".highlight { filter: url(#highlight); }" ,
7179 [ "\".highlight { filter: url(#highlight); }\"" ] ) ;
0 commit comments