Some additional test cases for Parsoid.
authorC. Scott Ananian <cscott@cscott.net>
Sat, 23 Feb 2013 03:38:36 +0000 (22:38 -0500)
committerSubramanya Sastry <ssastry@wikimedia.org>
Fri, 1 Mar 2013 00:23:08 +0000 (18:23 -0600)
1) "border" attribute can be used in addition to "framed" / "frameless"
on images.

2) parsoid no longer adds semicolons to style attributes where they don't
exist in the source.

3) empty table rows are elided by the PHP parser.  (Parsoid doesn't do
this yet.)

4) Italicized possessive (unmatched single-quote).  (Parsoid currently
misparses this.)

5) Tests for localized Image handling; check that localized image
options are handled correctly.

Change-Id: I9771374ff167df39535ec99c5f292f739eab8fe7

tests/parser/parserTests.txt

index df8b9e2..c5151ca 100644 (file)
@@ -491,7 +491,6 @@ Italics and bold: other quote tests: (3,2,3,3)
 !!end
 
 
-
 !! test
 Italics and bold: other quote tests: (3,(2,2),3)
 !! input
@@ -501,6 +500,16 @@ Italics and bold: other quote tests: (3,(2,2),3)
 </p>
 !!end
 
+
+!! test
+Italicized possessive
+!! input
+The ''[[Main Page]]'''s talk page.
+!! result
+<p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
+</p>
+!! end
+
 ###
 ### <nowiki> test cases
 ###
@@ -7069,6 +7078,37 @@ Custom class
 </p>
 !! end
 
+!! test
+Localized image handling (1).
+!! options
+language=es
+!! input
+[[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
+!! result
+<div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
+
+!! end
+
+!! test
+Localized image handling (2).
+!! options
+language=es
+!! input
+[[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
+!! result
+<div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
+
+!! end
+
+!! test
+"border", "frameless" and "class" attributes on an image.
+!! input
+[[File:Foobar.jpg|frameless|border|class=extra|caption]]
+!! result
+<p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
+</p>
+!! end
+
 !! article
 File:Barfoo.jpg
 !! text
@@ -13662,7 +13702,7 @@ disabled
 <table>
 <tr>
 <td title="Hello world">Foo
-</td><td style="color: red;">Bar
+</td><td style="color: red">Bar
 </td></tr></table>
 
 !! end
@@ -13712,6 +13752,27 @@ Accept empty attributes in th-cells
 
 !!end
 
+!!test
+Empty table rows go away
+!!input
+{|
+| Hello
+| there
+|- class="foo"
+|-
+|}
+!! result
+<table>
+<tr>
+<td> Hello
+</td>
+<td> there
+</td></tr>
+
+</table>
+
+!! end
+
 TODO:
 more images
 more tables