From 22784b717e6b1bd22c03d9c1a9fcdf47d12b5a35 Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Fri, 29 Mar 2013 13:33:15 -0500 Subject: [PATCH] Several Parsoid-specific tests for serializer/parser edge cases. Added several serializer tests * For catching future serializer regressions. * For fixing existing incorrect serialization. Added couple parser tests * For testing encap of partially-tpl-generated attribute key * For testing lists interrupted by comment-lines Change-Id: Ifbb7da59f65e790b66a621b7964179e4eb1f3fc4 --- tests/parser/parserTests.txt | 133 +++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index d3bd6a5a7f..0165cb2753 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3497,6 +3497,23 @@ b !! end +!! test +Table cell with a single comment +!! input +{| +| +| a +|} +!! result + + + +
+ a +
+ +!! end + # The expected HTML structure in this test is debatable. The PHP parser does # not parse this kind of table at all. The main focus for Parsoid is on # round-tripping, so this output is ok for now. TODO: revisit! @@ -4619,6 +4636,26 @@ Multiple list tags generated by templates !!end +!!test +Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do +!!input +*a + +*b + +*c + +*d +!!result + + + +!!end + ### ### Magic Words ### @@ -6006,6 +6043,15 @@ Templates: HTML Tag: 6. Generation of end piece of HTML attr value !!end +!!test +Templates: HTML Tag: 7. Generation of partial attribute key string +!!input +
foo
+!!result +
foo
+ +!!end + !!test Templates: HTML Tables: 1. Generating start of a HTML table !!input @@ -14203,6 +14249,93 @@ Empty table rows go away !! end +### +### Parsoid-centric tests for testing RTing of inter-element separators +### Edge cases not tested by existing parser tests and specific to +### Parsoid-specific serialization strategies. +### + +!!test +RT-ed inter-element separators should be valid separators +!!input +{| +|- [[foo]] +|} +!!result + + +
+ +!!end + +!!test +Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out +(Parsoid-only since PHP parser relies on Tidy for correct output) +!!options +disabled parsoid +!!input +{| +|foo +bar +|} + +{| +|foo +|} +!!result +!!end + +!!test +Empty TD followed by TD with tpl-generated attribute +!!input +{| +|- +| +|{{echo|style='color:red'}}|foo +|} +!!result + + + + +
+foo +
+ +!!end + +!!test +Empty TR followed by a template-generated TR +(Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext) +!!options +disabled parsoid +!!input +{| +|- +{{echo|foo}} +|} +!!result + + + + + +
foo
+!!end + +!!test +Multi-line image caption generated by templates with/without trailing newlines +!!options +parsoid +!!input +[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] +[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] +!!result +
File:Foo.jpg
foo\nA\nB\nC
+
File:Foo.jpg
foo\nA\nB\nC\n\n
+ +!!end + TODO: more images more tables -- 2.20.1