From 2ac0287cd53a910f8df30e8ec4b5d06e3da51c30 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Thu, 27 Aug 2015 07:40:38 +0100 Subject: [PATCH] Adds testing source maps in batch mode. Previous couple commits were fixes identified by this change, where output with source maps was different than one without. --- History.md | 1 + test/batch-test.js | 23 ++++++++++++++++++++++- test/fixtures/bootstrap.css | 1 - 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index 27f6c7f7..188f924d 100644 --- a/History.md +++ b/History.md @@ -6,6 +6,7 @@ * Adds inferring proxy settings from HTTP_PROXY environment variable. * Adds support for Polymer / Web Components special selectors. * Adds support for Polymer mixins. +* Adds testing source maps in batch mode. * Unifies wrappers for simple & advanced optimizations. * Fixed issue [#596](https://github.com/jakubpawlowicz/clean-css/issues/596) - support for !ie IE<8 hack. * Fixed issue [#599](https://github.com/jakubpawlowicz/clean-css/issues/599) - support for inlined source maps. diff --git a/test/batch-test.js b/test/batch-test.js index bd27cbaa..20b3d3fe 100644 --- a/test/batch-test.js +++ b/test/batch-test.js @@ -25,7 +25,7 @@ var batchContexts = function () { root: path.dirname(plainPath) }; }, - minifying: { + 'minifying': { topic: function (data) { var self = this; @@ -40,6 +40,27 @@ var batchContexts = function () { var minifiedTokens = minified.split(lineBreak); var preminifiedTokens = data.preminified.split(lineBreak); + minifiedTokens.forEach(function (line, i) { + assert.equal(line, preminifiedTokens[i]); + }); + } + }, + 'minifying with source maps': { + topic: function (data) { + var self = this; + + new CleanCSS({ + keepBreaks: true, + sourceMap: true, + root: data.root + }).minify(data.plain, function (errors, minified) { + self.callback(errors, minified.styles, data); + }); + }, + 'should output right content': function (errors, minified, data) { + var minifiedTokens = minified.split(lineBreak); + var preminifiedTokens = data.preminified.split(lineBreak); + minifiedTokens.forEach(function (line, i) { assert.equal(line, preminifiedTokens[i]); }); diff --git a/test/fixtures/bootstrap.css b/test/fixtures/bootstrap.css index c0838044..94657a21 100755 --- a/test/fixtures/bootstrap.css +++ b/test/fixtures/bootstrap.css @@ -6563,4 +6563,3 @@ button.close { display: none !important; } } -/*# sourceMappingURL=bootstrap.css.map */ -- 2.34.1