From: Jakub Pawlowicz Date: Tue, 27 Dec 2016 13:10:08 +0000 (+0100) Subject: See #801 - adds test cases to avoid regression. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f20a2d05f77a0a25479e31b3d688af358aa0be11;p=clean-css.git See #801 - adds test cases to avoid regression. Why: * It works as expected since 426127a, but there were no explicit tests for this feature. --- diff --git a/test/integration-test.js b/test/integration-test.js index d79375d3..12f241fa 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -1985,6 +1985,10 @@ vows.describe('integration tests') 'a{display:block}@import url(test/fixtures/partials/one.css);body{margin:0}', 'a{display:block}body{margin:0}' ], + 'with content between': [ + '@import url(test/fixtures/partials/one.css);@import url(test/fixtures/partials/extra/three.css);@import url(test/fixtures/partials/extra/four.css);.two { color:#fff; }@import url(test/fixtures/partials/extra/sub.css);.base { margin:0px }', + '.one{color:red}.three{color:#0f0}.four{color:#00f}.two{color:#fff}.base{margin:0}' + ], 'after quoted content': [ '/*a{display:block}*/@import url(test/fixtures/partials/one.css);', '.one{color:red}' diff --git a/test/module-test.js b/test/module-test.js index b04b162c..69eba5d1 100644 --- a/test/module-test.js +++ b/test/module-test.js @@ -478,6 +478,14 @@ vows.describe('module tests').addBatch({ 'should give right output': function (minified) { assert.equal(minified.styles, '@import url(test/fixtures/partials/one.css);@import url(test/fixtures/partials/extra/three.css);@import url(test/fixtures/partials/extra/four.css);.two{color:#fff}.base{margin:0}'); } + }, + 'and rules after': { + 'topic': function () { + return new CleanCSS().minify(['./test/fixtures/partials/two.css', './test/fixtures/partials-absolute/base.css']); + }, + 'should give right output': function (minified) { + assert.equal(minified.styles, '.one{color:red}.three{color:#0f0}.four{color:#00f}.two{color:#fff}.base2{border-width:0}.sub{padding:0}.base{margin:0}'); + } } } }, @@ -655,6 +663,14 @@ vows.describe('module tests').addBatch({ 'gives right output without reading resources': function (minified) { assert.equal(minified.styles, '.one{background-color:red}.test{color:#000}'); } + }, + 'with @import and rules after': { + 'topic': function () { + return new CleanCSS().minify(sourcesAsHash(['./test/fixtures/partials/two.css', './test/fixtures/partials-absolute/base.css'])); + }, + 'should give right output': function (minified) { + assert.equal(minified.styles, '.one{color:red}.three{color:#0f0}.four{color:#00f}.two{color:#fff}.base2{border-width:0}.sub{padding:0}.base{margin:0}'); + } } } }).export(module);