Additional table tests to spec parser behavior.
authorSubramanya Sastry <ssastry@wikimedia.org>
Wed, 28 Nov 2012 20:13:21 +0000 (14:13 -0600)
committerSubramanya Sastry <ssastry@wikimedia.org>
Wed, 28 Nov 2012 20:27:44 +0000 (14:27 -0600)
Change-Id: I4f4852744d463d77fc622c1bcce27e3d9751bc6b

tests/parser/parserTests.txt

index 319e6f6..31c2ba6 100644 (file)
@@ -2740,25 +2740,88 @@ Multiplication table
 
 !! end
 
+!! test
+Accept "||" in table headings
+!! input
+{|
+!h1 || h2
+|}
+!! result
+<table>
+<tr>
+<th>h1 </th>
+<th> h2
+</th></tr></table>
+
+!! end
+
+!! test
+Accept "||" in indented table headings
+!! input
+:{|
+!h1 || h2
+|}
+!! result
+<dl><dd><table>
+<tr>
+<th>h1 </th>
+<th> h2
+</th></tr></table></dd></dl>
+
+!! end
+
+!! test
+Accept empty attributes in td/th cells (td/th cells starting with leading ||)
+!! input
+{|
+!| h1
+|| a
+|}
+!! result
+<table>
+<tr>
+<th> h1
+</th>
+<td> a
+</td></tr></table>
+
+!! end
+
 !!test
-Allow +/- in 2nd and later cells in a row
+Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- 
 !!input
 {|
+|-
+|style='color:red;'|+1
+|style='color:blue;'|-1
+|-
 | 1 || 2 || 3
+| 1 ||+2 ||-3
 |-
-| 1 || +2 || -3
+| +1
+| -1
 |}
 !!result
 <table>
+
+<tr>
+<td style="color:red;">+1
+</td>
+<td style="color:blue;">-1
+</td></tr>
 <tr>
 <td> 1 </td>
 <td> 2 </td>
 <td> 3
+</td>
+<td> 1 </td>
+<td>+2 </td>
+<td>-3
 </td></tr>
 <tr>
-<td> 1 </td>
-<td> +2 </td>
-<td> -3
+<td> +1
+</td>
+<td> -1
 </td></tr></table>
 
 !!end