From: alexlamsl Date: Mon, 1 Feb 2016 09:19:28 +0000 (+0800) Subject: restore disabled tests X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c80d0b40325dd5a42a43f80dbef9db42a669475a;p=html-minifier.git restore disabled tests --- diff --git a/tests/minifier.js b/tests/minifier.js index eff12b6..026d22c 100644 --- a/tests/minifier.js +++ b/tests/minifier.js @@ -832,33 +832,35 @@ // https://github.com/kangax/html-minifier/issues/10 test('Ignore custom fragments', function() { - // var reFragments = [ /<\?[^\?]+\?>/g, /<%[^%]+%>/g ]; + var reFragments = [ /<\?[^\?]+\?>/, /<%[^%]+%>/ ]; - // input = 'This is the start. <% ... %>\r\n<%= ... %>\r\n\r\n\r\nNo comment, but middle.\r\n\r\n\r\n\r\nHello, this is the end!'; - // output = 'This is the start.<% ... %><%= ... %>No comment, but middle.Hello, this is the end!'; + input = 'This is the start. <% ... %>\r\n<%= ... %>\r\n\r\n\r\nNo comment, but middle.\r\n\r\n\r\n\r\nHello, this is the end!'; + output = 'This is the start.<% ... %><%= ... %>No comment, but middle.Hello, this is the end!'; - // equal(minify(input, {}), input); - // equal(minify(input, { removeComments: true, collapseWhitespace: true }), output); + equal(minify(input, {}), input); + equal(minify(input, { removeComments: true, collapseWhitespace: true }), output); - // output = 'This is the start.No comment, but middle. Hello, this is the end!'; + output = 'This is the start. <% ... %>\r\n<%= ... %>\r\n\r\nNo comment, but middle.\r\n\r\n\r\n\r\nHello, this is the end!'; - // equal(minify(input, { - // removeComments: true, - // collapseWhitespace: true, - // ignoreCustomFragments: reFragments - // }), output); + equal(minify(input, { + removeComments: true, + collapseWhitespace: true, + ignoreCustomFragments: reFragments + }), output); + + input = '<% if foo? %>\r\n
\r\n ...\r\n
\r\n<% end %>'; + output = '<% if foo? %>
...
<% end %>'; - // input = '<% if foo? %>\r\n
\r\n ...\r\n
\r\n<% end %>'; - // output = '<% if foo? %>
...
<% end %>'; - // equal(minify(input, {}), input); - // equal(minify(input, { collapseWhitespace: true }), output); - // output = '
...
'; - // equal(minify(input, { collapseWhitespace: true, ignoreCustomFragments: reFragments }), output); + equal(minify(input, {}), input); + equal(minify(input, { collapseWhitespace: true }), output); - // input = ''; - // equal(minify(input, {}), input); - // output = ''; - // equal(minify(input, { ignoreCustomFragments: reFragments }), output); + output = '<% if foo? %>\r\n
...
\r\n<% end %>'; + + equal(minify(input, { collapseWhitespace: true, ignoreCustomFragments: reFragments }), output); + + input = ''; + equal(minify(input, {}), input); + equal(minify(input, { ignoreCustomFragments: reFragments }), input); input = ''; output = ''; @@ -874,8 +876,6 @@ '{% endfor %}' + '{% endif %}' + '

'; - output = ''; - equal(minify(input, { ignoreCustomFragments: [ /\{\%[\s\S]*?\%\}/g, @@ -1008,22 +1008,21 @@ equal(minify(input, { minifyJS: { mangle: false } }), output); - // input = ''; - - // output = ''; - - // equal(minify(input, { - // removeCommentsFromCDATA: true, - // minifyJS: true - // }), output); + input = ''; + output = ''; + + equal(minify(input, { + removeCommentsFromCDATA: true, + minifyJS: true + }), output); }); test('minification of scripts with different mimetypes', function() {