Debian Codegraph @

extensions/Poem/tests/parser/parserTests.txt

raw
1 !! options
2 version=2
3 parsoid-compatible=wt2html,wt2wt,html2wt,html2html,selser
4 !! end
5
6 # Force the test runner to ensure the extension is loaded
7 !! hooks
8 poem
9 !! endhooks
10
11 !! article
12 Template:1x
13 !! text
14 {{{1}}}
15 !! endarticle
16
17 #Regression tests for existing functionality, to ensure nothing was broken.
18 !! test
19 <poem>
20 !! wikitext
21 <poem>
22 this
23 is
24 a
25 test
26 </poem>
27 !! html/php
28 <div class="poem">
29 <p>this<br />
30 is<br />
31 a<br />
32 test
33 </p>
34 </div>
35 !! html/parsoid
36 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\nthis\nis\na\ntest\n"}}'><p>this<br/>
37 is<br/>
38 a<br/>
39 test</p></div>
40 !! end
41
42 !!test
43 <poem> with recursive parsing
44 !!wikitext
45 <poem>
46 this ''is'' a '''test'''
47 </poem>
48 !! html/php
49 <div class="poem">
50 <p>this <i>is</i> a <b>test</b>
51 </p>
52 </div>
53 !! html/parsoid
54 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\nthis &apos;&apos;is&apos;&apos; a &apos;&apos;&apos;test&apos;&apos;&apos;\n"}}'><p>this <i>is</i> a <b>test</b></p></div>
55 !!end
56
57 ## FIXME: Is Parsoid output the right output wrt how it actually renders?
58 !!test
59 <poem> with leading whitespace
60 !!wikitext
61 <poem>
62
63 test
64
65 </poem>
66 !! html/php
67 <div class="poem">
68 <p><br />
69 &#160;&#160;&#160;test<br />
70 </p>
71 </div>
72 !! html/parsoid
73 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\n\n test\n\n"}}'><p><br/>
74 <span typeof="mw:Entity"> </span> test<br/></p>
75 </div>
76 !!end
77
78 ## FIXME: Parsoid adds <p> wrapper around the THML <br/> tag
79 !!test
80 Horizontal rule
81 !!wikitext
82 <poem>
83 some
84 -----
85 text
86 </poem>
87 !! html/php
88 <div class="poem">
89 <p>some<br />
90 </p>
91 <hr />
92 <p>text
93 </p>
94 </div>
95 !! html/parsoid
96 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\nsome\n-----\ntext\n"}}'><p>some<br/></p>
97 <hr/>
98 <p>text</p></div>
99 !!end
100
101 !! test
102 nested <poem><nowiki>
103 !! wikitext
104 <poem><nowiki>
105 this
106 is
107 a
108 test
109 </nowiki></poem>
110 !! html/php
111 <div class="poem">
112 <p><br />
113 this<br />
114 is<br />
115 a<br />
116 test<br />
117
118 </p>
119 </div>
120 !! html/parsoid
121 <div class="poem" typeof="mw:Extension/poem" about="#mwt4" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"&lt;nowiki>\nthis\nis\na\ntest\n&lt;/nowiki>"}}'><p><br/>
122 this<br/>
123 is<br/>
124 a<br/>
125 test<br/>
126 </p></div>
127 !!end
128
129 !! test
130 nested <poem><nowiki> with formatting
131 !! wikitext
132 <poem><nowiki>
133 this
134 '''is'''
135 a
136 test
137 </nowiki></poem>
138 !! html/php
139 <div class="poem">
140 <p><br />
141 this<br />
142 '''is'''<br />
143 a<br />
144 test<br />
145
146 </p>
147 </div>
148 !! html/parsoid
149 <div class="poem" typeof="mw:Extension/poem" about="#mwt4" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"&lt;nowiki>\nthis\n&apos;&apos;&apos;is&apos;&apos;&apos;\na\ntest\n&lt;/nowiki>"}}'><p><br/>
150 this<br/>
151 '''is'''<br/>
152 a<br/>
153 test<br/>
154 </p></div>
155 !! end
156
157 !! test
158 Basic <poem> usage with style
159 !! wikitext
160 <poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
161 A stately pleasure-dome decree:
162 Where Alph, the sacred river, ran
163 Through caverns measureless to man
164 Down to a sunless sea.
165 </poem>
166 !! html/php
167 <div style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;" class="poem">
168 <p>A stately pleasure-dome decree:<br />
169 Where Alph, the sacred river, ran<br />
170 Through caverns measureless to man<br />
171 Down to a sunless sea.
172 </p>
173 </div>
174 !! html/parsoid
175 <div style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;" class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{"style":"border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;"},"body":{"extsrc":"\nA stately pleasure-dome decree:\nWhere Alph, the sacred river, ran\nThrough caverns measureless to man\nDown to a sunless sea.\n"}}'><p>A stately pleasure-dome decree:<br/>
176 Where Alph, the sacred river, ran<br/>
177 Through caverns measureless to man<br/>
178 Down to a sunless sea.</p></div>
179 !! end
180
181 # FIXME: This test should be removed once we stop span-wrapping entities in nowikis
182 !! test
183 Verify Parsoid handles entities in nowikis in poem correctly
184 !! wikitext
185 <poem>
186 L1
187 L2
188 <nowiki>
189 <ref>Not a ref</ref>
190 foo &amp; bar
191 [[Not a link]]
192 </nowiki>
193 L3
194 </poem>
195 !! html/php
196 <div class="poem">
197 <p>L1<br />
198 L2<br />
199 <br />
200 &lt;ref&gt;Not a ref&lt;/ref&gt;<br />
201 foo &amp; bar<br />
202 [[Not a link]]<br />
203 <br />
204 L3
205 </p>
206 </div>
207 !! html/parsoid
208 <div class="poem" typeof="mw:Extension/poem" about="#mwt4" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\nL1\nL2\n&lt;nowiki>\n&lt;ref>Not a ref&lt;/ref>\nfoo &amp;amp; bar\n[[Not a link]]\n&lt;/nowiki>\nL3\n"}}'><p>L1<br/>
209 L2<br/>
210 <br/>
211 &lt;ref>Not a ref&lt;/ref><br/>
212 foo <span typeof="mw:Entity">&amp;</span> bar<br/>
213 [[Not a link]]<br/>
214 <br/>
215 L3</p></div>
216 !! end
217
218 !! test
219 UTF-8 sequences in extension tags (T231945)
220 !! wikitext
221 <poem>
222 {{1x|ၶိူဝ်းႁဝ်ၶိူဝ်းရႃႇၸႃႇ}}
223 </poem>
224 !! html/php
225 <div class="poem">
226 <p>ၶိူဝ်းႁဝ်ၶိူဝ်းရႃႇၸႃႇ
227 </p>
228 </div>
229 !! html/parsoid
230 <div class="poem" typeof="mw:Extension/poem" about="#mwt4" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\n{{1x|ၶိူဝ်းႁဝ်ၶိူဝ်းရႃႇၸႃႇ}}\n"}}'><p><span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"ၶိူဝ်းႁဝ်ၶိူဝ်းရႃႇၸႃႇ"}},"i":0}}]}'>ၶိူဝ်းႁဝ်ၶိူဝ်းရႃႇၸႃႇ</span></p></div>
231 !! end
232
233 !! test
234 Multi-line poems with indentation use spans and breaks correctly (T235709)
235 !! wikitext
236 <poem>
237 ''CONGREGATI''
238 :'''EX TOTO ORBE'''
239 ::'''''MATHEMATICI'''''
240 :<span>foo</span>
241 </poem>
242 !! html/php
243 <div class="poem">
244 <p><i>CONGREGATI</i><br />
245 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 1em;"><b>EX TOTO ORBE</b></span><br />
246 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 2em;"><i><b>MATHEMATICI</b></i></span><br />
247 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 1em;"><span>foo</span></span>
248 </p>
249 </div>
250 !! html/parsoid
251 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw="{&quot;name&quot;:&quot;poem&quot;,&quot;attrs&quot;:{},&quot;body&quot;:{&quot;extsrc&quot;:&quot;\n''CONGREGATI''\n:'''EX TOTO ORBE'''\n::'''''MATHEMATICI'''''\n:&lt;span>foo&lt;/span>\n&quot;}}"><p data-parsoid="{}"><i data-parsoid="{}">CONGREGATI</i><br data-parsoid='{"stx":"html","selfClose":true}'/>
252 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 1em;" data-parsoid='{"stx":"html"}'><b data-parsoid="{}">EX TOTO ORBE</b></span><br data-parsoid='{"stx":"html","selfClose":true}'/>
253 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 2em;" data-parsoid='{"stx":"html"}'><i data-parsoid="{}"><b data-parsoid="{}">MATHEMATICI</b></i></span><br data-parsoid='{"stx":"html","selfClose":true}'/>
254 <span class="mw-poem-indented" style="display: inline-block; margin-inline-start: 1em;" data-parsoid='{"stx":"html"}'><span data-parsoid='{"stx":"html"}'>foo</span></span></p></div>
255 !! end
256
257 !! test
258 Indention syntax with no content
259 !! wikitext
260 <poem>
261 ::
262 </poem>
263 !! html/php
264 <div class="poem">
265 <dl><dd><dl><dd></dd></dl></dd></dl>
266 </div>
267 !! html/parsoid
268 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{},"body":{"extsrc":"\n::\n"}}'><dl><dd><dl><dd></dd></dl></dd></dl></div>
269 !! end
270
271 !! test
272 Poem with class
273 !! wikitext
274 <poem class="hiho">
275 hi ho
276 </poem>
277 !! html/php
278 <div class="poem hiho">
279 <p>hi ho
280 </p>
281 </div>
282 !! html/parsoid
283 <div class="poem hiho" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{"class":"hiho"},"body":{"extsrc":"\nhi ho\n"}}'><p>hi ho</p></div>
284 !! end
285
286 !! test
287 Poem with empty class
288 !! wikitext
289 <poem class="">
290 hi ho
291 </poem>
292 !! html/php
293 <div class="poem">
294 <p>hi ho
295 </p>
296 </div>
297 !! html/parsoid
298 <div class="poem" typeof="mw:Extension/poem" about="#mwt3" data-mw='{"name":"poem","attrs":{"class":""},"body":{"extsrc":"\nhi ho\n"}}'><p>hi ho</p></div>
299 !! end