@@ -226,7 +226,7 @@ describe('gulp-clean-css: base functionality', function () {
226
226
. pipe ( cleanCSS ( { debug : true } , function ( details ) {
227
227
expect ( details . warnings ) . to . exist &&
228
228
expect ( details . warnings . length ) . to . equal ( 1 ) &&
229
- expect ( details . warnings [ 0 ] ) . to . equal ( 'Missing \'}\' at 1:14.' ) ;
229
+ expect ( details . warnings [ 0 ] ) . to . equal ( 'Missing \'}\' at fixtures/test.css: 1:14.' ) ;
230
230
} ) )
231
231
. on ( 'data' , function ( file ) {
232
232
i += 1 ;
@@ -305,4 +305,30 @@ describe('gulp-clean-css: rebase', function () {
305
305
} )
306
306
. once ( 'end' , done ) ;
307
307
} ) ;
308
+
309
+ it ( 'should rebase to current relative file location - relative imports are resolved like in the browser' , function ( done ) {
310
+
311
+ gulp . src ( [ 'test/fixtures/rebasing/subdir/import.css' ] )
312
+ . pipe ( cleanCSS ( { } ) )
313
+ . on ( 'data' , function ( file ) {
314
+
315
+ let expected = `
316
+ p.imported_nested{background:url(../otherdir/nestedsub/nested.png)}
317
+ p.imported_same{background:url(../otherdir/imported.png)}
318
+ p.imported_parent{background:url(../parent.png)}
319
+ p.imported_other{background:url(../othersub/inother.png)}
320
+ p.imported_absolute{background:url(/inroot.png)}
321
+ p.insub_same{background:url(insub.png)}
322
+ p.insub_child{background:url(child/child.png)}
323
+ p.insub_parent{background:url(../parent.png)}
324
+ p.insub_other{background:url(../othersub/inother.png)}
325
+ p.insub_absolute{background:url(/inroot.png)}
326
+ p.import{background:url(import.png)}` ;
327
+
328
+ let actual = file . contents . toString ( ) ;
329
+
330
+ expect ( actual ) . to . equalIgnoreSpaces ( expected )
331
+ } )
332
+ . once ( 'end' , done ) ;
333
+ } ) ;
308
334
} ) ;
0 commit comments