Add tests for empty attribute values in tags and table syntax
authorGabriel Wicke <gwicke@wikimedia.org>
Fri, 16 Nov 2012 01:12:05 +0000 (17:12 -0800)
committerGabriel Wicke <gwicke@wikimedia.org>
Fri, 16 Nov 2012 17:03:46 +0000 (09:03 -0800)
The PHP parser implements this very inconsistently and not in line with the
HTML5 spec. We follow the HTML5 spec in Parsoid, so mark these tests as
disabled for the PHP parser and add FIXMEs.

Change-Id: Iee5d95f3ee5fcb596282097c52f729d33ccb1474

tests/parser/parserTests.txt

index ff0649b..94cad84 100644 (file)
@@ -2824,6 +2824,24 @@ Table with row followed by newlines and table heading
 
 !! end
 
+# FIXME: Preserve the attribute properly (with an empty string as value) in
+# the PHP parser. Parsoid implements the behavior below.
+!! test
+Table attributes with empty value
+!! options
+disabled
+!! input
+{|
+| style=| hello
+|}
+!! result
+<table>
+<tr>
+<td style=""> hello
+</td></tr></table>
+
+!! end
+
 ###
 ### Internal links
 ###
@@ -7080,6 +7098,37 @@ div with illegal double attributes
 
 !!end
 
+# FIXME: produce empty string instead of "class" in the PHP parser, following
+# the HTML5 spec.
+!! test
+div with empty attribute value, space before equals
+!! options
+disabled
+!! input
+<div class =>HTML rocks</div>
+!! result
+<div class="">HTML rocks</div>
+
+!! end
+
+# This it very inconsistent in the PHP parser: it returns 
+# class="class" if there is a space between the name and the equal sign (see
+# 'div with empty attribute value, space before equals'), but strips the
+# attribute completely if the space is missing. We hope that not much content
+# depends on this, so are implementing the behavior below in Parsoid for
+# consistencies' sake. Disabled for the PHP parser. 
+# FIXME: fix this behavior in the PHP parser?
+!! test
+div with empty attribute value, no space before equals
+!! options
+disabled
+!! input
+<div class=>HTML rocks</div>
+!! result
+<div class="">HTML rocks</div>
+
+!! end
+
 !! test
 HTML multiple attributes correction
 !! input