@@ -2,13 +2,14 @@ var should = require("should");
22var path = require ( "path" ) ;
33var cssLoader = require ( "../index.js" ) ;
44
5- function test ( name , input , result ) {
5+ function test ( name , input , result , query ) {
66 it ( name , function ( ) {
77 var output ;
88 cssLoader . call ( {
99 loaders : [ { request : "loader" } ] ,
1010 loaderIndex : 0 ,
1111 resource : "test.css" ,
12+ query : query ,
1213 callback : function ( err , result ) {
1314 output = result ;
1415 }
@@ -58,6 +59,10 @@ describe("url", function() {
5859 [ "\".class { background: green url( \"+require(\"./img.png\")+\" ) xyz }\"" ] ) ;
5960 test ( "background img 2" , ".class { background: green url(~img/png ) url(aaa) xyz }" ,
6061 [ "\".class { background: green url(\"+require(\"img/png\")+\" ) url(\"+require(\"./aaa\")+\") xyz }\"" ] ) ;
62+ test ( "background img absolute" , ".class { background: green url(/img.png) xyz }" ,
63+ [ "\".class { background: green url(/img.png) xyz }\"" ] ) ;
64+ test ( "background img absolute with root" , ".class { background: green url(/img.png) xyz }" ,
65+ [ "\".class { background: green url(\"+require(\"./img.png\")+\") xyz }\"" ] , "?root=." ) ;
6166 test ( "background img external" ,
6267 ".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }" ,
6368 [ "\".class { background: green url(data:image/png;base64,AAA) url(http://example.com/image.jpg) url(//example.com/image.png) xyz }\"" ] ) ;
0 commit comments