Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test HTML comment minification #6

Closed
fernandoacorreia opened this issue Jan 29, 2014 · 2 comments
Closed

Test HTML comment minification #6

fernandoacorreia opened this issue Jan 29, 2014 · 2 comments

Comments

@fernandoacorreia
Copy link
Contributor

Minification should remove HTML comments. Changing loaderTest.js test "should minimize" to look like this:

'<!-- comment --><h3>#{number} {customer}</h3>\n<p>   {title}   </p>\n\t <!-- comment --> <img src="image.png" />'

Should still produce the same result.

I've made this modification on the test:

diff --git a/test/loaderTest.js b/test/loaderTest.js
index f2fd67f..66978f5 100644
--- a/test/loaderTest.js
+++ b/test/loaderTest.js
@@ -37,8 +37,8 @@ describe("loader", function() {
        it("should minimize", function() {
                loader.call({
                        minimize: true
-               }, '<h3>#{number} {customer}</h3>\n<p>   {title}   </p>\n\t<img src="image.png" />').should.be.eql(
+               }, '<!-- comment --><h3>#{number} {customer}</h3>\n<p>   {title}   </p>\n\t <!-- comment --> <img src="image.png" />').should.be.eql(
                        'module.exports = "<h3>#{number} {customer}</h3><p>{title}</p><img src=" + require("./image.png") + ">";'
                );
        });
-});
\ No newline at end of file
+});

After running mocha I get this error:

  1) loader should minimize:

      AssertionError: expected 'module.exports = "<!-- comment --><h3>#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=" + require("./image.png") + ">";' to equal 'module.exports = "<h3>#{number} {customer}</h3><p>{title}</p><img src=" + require("./image.png") + ">";'
      + expected - actual

      +"module.exports = \"<h3>#{number} {customer}</h3><p>{title}</p><img src=\" + require(\"./image.png\") + \">\";"
      -"module.exports = \"<!-- comment --><h3>#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=\" + require(\"./image.png\") + \">\";"

      at Assertion.prop.(anonymous function) (/home/fernando/work/github/webpack/html-loader/node_modules/should/lib/should.js:60:14)
      at Context.<anonymous> (/home/fernando/work/github/webpack/html-loader/test/loaderTest.js:40:132)
      at Test.Runnable.run (/usr/lib/node_modules/mocha/lib/runnable.js:221:32)
      at Runner.runTest (/usr/lib/node_modules/mocha/lib/runner.js:374:10)
      at /usr/lib/node_modules/mocha/lib/runner.js:452:12
      at next (/usr/lib/node_modules/mocha/lib/runner.js:299:14)
      at /usr/lib/node_modules/mocha/lib/runner.js:309:7
      at next (/usr/lib/node_modules/mocha/lib/runner.js:247:23)
      at Object._onImmediate (/usr/lib/node_modules/mocha/lib/runner.js:276:5)
      at processImmediate [as _immediateCallback] (timers.js:330:15)

I couldn't find a configuration option to activate HTML comment removal.

@sokra
Copy link
Member

sokra commented Jan 29, 2014

fixed in b766158

@sokra sokra closed this as completed Jan 29, 2014
@fernandoacorreia
Copy link
Contributor Author

Fix confirmed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants