@@ -46,6 +46,9 @@ describe("url", function() {
46
46
test ( "import" , "@import url(test.css);\n.class { a: b c d; }" ,
47
47
[ "require(" + JSON . stringify ( "!" + path . join ( __dirname , ".." , "index.js" ) + "!./test.css" ) + ")" ,
48
48
"\"\\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
+ "\"\"" ] ) ;
49
52
test ( "import with media" , "@import url(~test/css) screen and print;\n.class { a: b c d; }" ,
50
53
[ "\"@media screen and print{\"" ,
51
54
"require(" + JSON . stringify ( "!" + path . join ( __dirname , ".." , "index.js" ) + "!test/css" ) + ")" ,
@@ -59,13 +62,18 @@ describe("url", function() {
59
62
[ "\".class { background: green url( \"+require(\"./img.png\")+\" ) xyz }\"" ] ) ;
60
63
test ( "background img 2" , ".class { background: green url(~img/png ) url(aaa) xyz }" ,
61
64
[ "\".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 }\"" ] ) ;
62
67
test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" ,
63
68
[ "\".class { background: green url(/img.png) xyz }\"" ] ) ;
64
69
test ( "background img absolute with root" , ".class { background: green url(/img.png) xyz }" ,
65
70
[ "\".class { background: green url(\"+require(\"./img.png\")+\") xyz }\"" ] , "?root=." ) ;
66
71
test ( "background img external" ,
67
72
".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }" ,
68
73
[ "\".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>\\\") }\"" ] ) ;
69
77
test ( "filter hash" ,
70
78
".highlight { filter: url(#highlight); }" ,
71
79
[ "\".highlight { filter: url(#highlight); }\"" ] ) ;
0 commit comments