# We don't need to run these tests in integrated mode as well.
!! options
version=2
!! end

!!article
Bar
!!text
abcd
!!endarticle

!! article
Template:1x
!! text
{{{1}}}
!! endarticle

# We need the span in the wikilink so that the link text is
# processed as a DOMFragment which then triggers the regression
# we are testing in this file
!!article
Template:RegressionTest
!!text
[[Bar|<span>bar</span>]]
!!endarticle

# Regression test -- ensure that nested pipeline TSR information
# doesn't leak onto the top-level pipeline during DSR computation.
# We verify this indirectly via passing selser tests.
!!test
Regression Test: Ensure nested pipeline TSR doesn't impact top-level DSR values
!!wikitext
{{RegressionTest}}

Bar
!!html/parsoid
<p><a rel="mw:WikiLink" href="./Bar" title="Bar" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"RegressionTest","href":"./Template:RegressionTest"},"params":{},"i":0}}]}'><span>bar</span></a></p>

<p>Bar</p>
!!end

# As seen in T334957#9026561
!! test
Ensure proper DSR offsets are computed
!! options
parsoid=wt2html,selser
!! wikitext
{|
|-

é

''x''

* {{1x|
{{{!}}
{{!}}-
}}
!! html/parsoid
<p data-parsoid='{"fostered":true,"autoInsertedStart":true}'>

é

<i>x</i></p><ul data-parsoid='{"fostered":true}'><li class="mw-empty-elt"></li></ul><table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-\n"}},"i":0}},"{|\n|-\n\né\n\n&apos;&apos;x&apos;&apos;\n\n* {{1x|\n{{{!}}\n{{!}}-\n}}"]}'>
<tbody></tbody></table><table about="#mwt1">
<tbody>
</tbody></table>
!! end

# This is just a regression test to ensure code can handle tables with fosterable content
# in DOM fragment position (Ex: image captions). This is an edge case and didn't feel it
# belonged in media.txt which already has a number of tests with tables in captions.
!! test
Images with captions containing tables with fosterable content shouldn't crash Parsoid
!! options
parsoid=wt2html
!! wikitext
[[File:Foobar.jpg|thumb|50px|
{|
{{1x|<span>foo</span>}}
|}
]]
!! html/parsoid
<figure typeof="mw:File/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50px"},{"ck":"caption","ak":"\n{|\n{{1x|&lt;span>foo&lt;/span>}}\n|}\n"}]}'><a href="./File:Foobar.jpg" class="mw-file-description"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" class="mw-file-element" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
<p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&lt;span>foo&lt;/span>"}},"i":0}},"\n|}"]}'><span>foo</span></p><table about="#mwt2">

</table>
</figcaption></figure>
!! end
