Adds testing source maps in batch mode.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 27 Aug 2015 06:40:38 +0000 (07:40 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 27 Aug 2015 06:44:52 +0000 (07:44 +0100)
Previous couple commits were fixes identified by this change, where
output with source maps was different than one without.

History.md
test/batch-test.js
test/fixtures/bootstrap.css

index 27f6c7f..188f924 100644 (file)
@@ -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.
index bd27cba..20b3d3f 100644 (file)
@@ -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]);
           });
index c083804..94657a2 100755 (executable)
@@ -6563,4 +6563,3 @@ button.close {
     display: none !important;
   }
 }
-/*# sourceMappingURL=bootstrap.css.map */