!! Version 2
#
# This file will hold tests for table fixup dom handlers.
# For now, we are only adding tests for unsupported scenarios here.
# Eventually, once the monolithic parser test file is split up,
# all table fixup tests will move here.
!! article
Template:1x
!! text
{{{1}}}
!! endarticle
!! article
Template:td_class
!! text
class="foo"
!! endarticle
!! article
Template:td_content
!! text
| foobar
!! endarticle
!! article
Template:td_attrs_and_content
!! text
{{{1}}} | foobar
!! endarticle
!! article
Template:td_attrs_and_content_with_newlines
!! text
class="foo" | foobar
baz
!! endarticle
!! article
No Merging Here
!! text
Dummy article to suppress redlinks in tests
!! end
!! test
Unsupported scenario: Cell combining with captions
!! options
parsoid=wt2html
!! wikitext
{|
|+class="foo"{{1x|1={{!}}some caption}}
|bar
|}
!! html/php
!! html/parsoid
class="foo"some caption |
bar |
!! end
!! test
Unsupported scenario: Templated cell cannot merged with another templated cell
!! options
parsoid=wt2html
!! wikitext
{|
|{{1x|1=class="foo"}}{{1x|1={{!}}foo}}
|}
!! html/php
!! html/parsoid
!! end
!! test
Unsupported scenario: Templated cell with attributes cannot combine with previous cell
!! options
parsoid=wt2html
!! wikitext
{|
|class="foo"{{1x|1={{!}}title="foo"{{!}}foo}}
|}
!! html/php
!! html/parsoid
class="foo" | title="foo" | foo |
!! end
!! test
Unsupported scenario: Templated cell cannot combine with previous cell with attributes
!! options
parsoid=wt2html
!! wikitext
{|
|class="foo"|title="foo"{{1x|1={{!}}foo}}
|}
!! html/php
!! html/parsoid
!! end
!! test
Table cell attributes and content from multiple templates
!! wikitext
{|
|-
| {{td_class}} {{td_attrs_and_content|1=style='border:1px solid blue'}} baz
|}
!! html/php
!! html/parsoid
!! end
!! test
Table cell attribute merging edge cases
!! config
wgParserEnableLegacyMediaDOM=false
!! wikitext
{|
| {{td_attrs_and_content|1=foo
class="foo"}} baz
|-
|{{td_attrs_and_content|1=[[No Merging Here]] class="foo"}} baz
|-
|{{td_attrs_and_content|1=[[File:Foo.jpg]] class="foo"}} baz
|}
!! html/php
!! html/parsoid
!! end
!! test
Fixup of interrupted table-cell parsing because of multi-line transclusion
!! wikitext
{|
! class="c1" |Col 1.1!! class="c2" |{{1x|
1=Col 1.2}}!! class="c3" |Col 1.3!! class="c4" |Col 1.4
! class="d1" |Col 2.1!! class="d2" |{{1x|
1=Col 2.2}}!! class="d3" |Col 2.3! abcd!! class="d4" |Col 2.4
| class="e1" |Col 3.1|| class="e2" |{{1x|
1=Col 3.2}}|| class="e3" |Col 3.3| abcd|| class="e4" |Col 3.4
|}
!! html/php
Col 1.1 |
Col 1.2 |
Col 1.3 |
Col 1.4
|
Col 2.1 |
Col 2.2 |
Col 2.3! abcd |
Col 2.4
|
Col 3.1 |
Col 3.2 |
Col 3.3| abcd |
Col 3.4
|
!! html/parsoid
Col 1.1 | Col 1.2 | Col 1.3 | Col 1.4 |
Col 2.1 | Col 2.2 | Col 2.3! abcd | Col 2.4 |
Col 3.1 | Col 3.2 | Col 3.3| abcd | Col 3.4 |
!! end
!! test
Ensure newlines in collected attribute doesn't trip up reparsing
!! wikitext
{|
|rowspan="1" {{td_attrs_and_content_with_newlines}}
|}
!! html/php
!! html/parsoid
!! end
!! test
Ensure a cell with newlines doesn't combine with following cell
!! wikitext
{|
|-
| combined-and-lost {{td_content|}}
|-
|not combined
{{td_content|}}
|}
!! html/php
foobar
|
not combined
|
foobar
|
!! html/parsoid
foobar |
not combined
| foobar |
!! end
!! test
Table cell attributes and nested transclusions
!! wikitext
{|
| '''{{td_attrs_and_content|1=style='border:1px solid blue;'}}'''
|}
!! html/php
!! html/parsoid
!! end
!! test
T331486: Newline entities should be properly handled while fixing up table cells
!! wikitext
{|
|{{td_attrs_and_content|1=title="a
b" class="xyz"}}
|}
!! html/php
!! html/parsoid
!! end