Add tests for collapsing boolean attributes.
authorJuriy Zaytsev <kangax@gmail.com>
Thu, 11 Feb 2010 21:08:08 +0000 (16:08 -0500)
committerJuriy Zaytsev <kangax@gmail.com>
Thu, 11 Feb 2010 21:08:08 +0000 (16:08 -0500)
index.html
tests/index.html

index 1f46526..00b5d99 100644 (file)
       <div id="todo">
         TODO:
         <ul>
-          <li>Write more unit tests (~80 so far)</li>
+          <li>Write more unit tests (~90 so far)</li>
           <li>Detect repeating attributes (e.g. multiple styles, classes, etc.)</li>
           <li>Strip whitespace from attributes where allowed</li>
           <li>Report deprecated (or presentational) attributes (e.g.: <code>&lt;td width="..." height="..."></code>)</li>
index cf59346..91e0b90 100644 (file)
           output = '<div>hello<span>world</span></div>';
           equals(minify(input, { removeEmptyElements: true }), output);
         });
+        
+        test('collapsing boolean attributes', function(){
+          input = '<input disabled="disabled">';
+          equals(minify(input, { collapseBooleanAttributes: true }), '<input disabled>');
+          
+          input = '<input CHECKED = "checked" readonly="readonly">';
+          equals(minify(input, { collapseBooleanAttributes: true }), '<input checked readonly>');
+          
+          input = '<option name="blah" selected="selected">moo</option>';
+          equals(minify(input, { collapseBooleanAttributes: true }), '<option name="blah" selected>moo</option>');
+        });
       })(this);
     </script>
   </body>