Debian Codegraph @

extensions/ImageMap/tests/parser/imageMapParserTests.txt

raw
1 !! options
2 version=2
3 parsoid-compatible=wt2html,wt2wt,selser
4 !! end
5
6 # Force the test runner to ensure the extension is loaded
7 !! hooks
8 imagemap
9 !! endhooks
10
11 !! test
12 imagemap test 1
13 !! config
14 wgParserEnableLegacyMediaDOM=false
15 !! wikitext
16 <imagemap>
17 Image:Foobar.jpg
18 </imagemap>
19 !! html/php
20 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><span><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/File:Foobar.jpg" /></span><figcaption></figcaption></figure>
21 !! html/parsoid
22 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption></figcaption></figure>
23 !! end
24
25 !! test
26 imagemap test 1 (legacy)
27 !! config
28 wgParserEnableLegacyMediaDOM=true
29 !! wikitext
30 <imagemap>
31 Image:Foobar.jpg
32 </imagemap>
33 !! html/php
34 <div class="noresize" style="height: 220px; width: 1941px; "><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /><div style="margin-left: 1921px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/resources/desc-20.png?15600" style="border: none;" /></a></div></div>
35 !! html/parsoid
36 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption></figcaption></figure>
37 !! end
38
39 !! test
40 imagemap test 2
41 !! config
42 wgParserEnableLegacyMediaDOM=false
43 !! wikitext
44 <imagemap>
45 File:Foobar.jpg
46
47 poly 10.1 10.9 10 30 -30 15 [[Main Page]]
48 </imagemap>
49 !! html/php
50 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><span><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" usemap="#ImageMap_79ccc6c89d422b0c" resource="/wiki/File:Foobar.jpg" /></span><map name="ImageMap_79ccc6c89d422b0c"><area href="/wiki/Main_Page" shape="poly" coords="10,11,10,30,-30,15" alt="Main Page" title="Main Page" /></map><figcaption></figcaption></figure>
51 !! html/parsoid
52 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\n\npoly 10.1 10.9 10 30 -30 15 [[Main Page]]\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element" usemap="#ImageMap_02c94d3ca4bfc187"/></span><map name="ImageMap_02c94d3ca4bfc187"><area href="./Main_Page" shape="poly" coords="10,11,10,30,-30,15"/></map><figcaption></figcaption></figure>
53 !! end
54
55 !! test
56 imagemap test 2 (legacy)
57 !! config
58 wgParserEnableLegacyMediaDOM=true
59 !! wikitext
60 <imagemap>
61 File:Foobar.jpg
62
63 poly 10.1 10.9 10 30 -30 15 [[Main Page]]
64 </imagemap>
65 !! html/php
66 <div class="noresize" style="height: 220px; width: 1941px; "><map name="ImageMap_79ccc6c89d422b0c"><area href="/wiki/Main_Page" shape="poly" coords="10,11,10,30,-30,15" alt="Main Page" title="Main Page" /></map><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" usemap="#ImageMap_79ccc6c89d422b0c" /><div style="margin-left: 1921px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/resources/desc-20.png?15600" style="border: none;" /></a></div></div>
67 !! html/parsoid
68 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\n\npoly 10.1 10.9 10 30 -30 15 [[Main Page]]\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element" usemap="#ImageMap_02c94d3ca4bfc187"/></span><map name="ImageMap_02c94d3ca4bfc187"><area href="./Main_Page" shape="poly" coords="10,11,10,30,-30,15"/></map><figcaption></figcaption></figure>
69 !! end
70
71 !! test
72 imagemap test 3
73 !! config
74 wgParserEnableLegacyMediaDOM=false
75 !! wikitext
76 <imagemap>
77 File:Foobar.jpg|150px|alt=Alt text
78 default [[Main Page|Go to main page]]
79 </imagemap>
80 !! html/php
81 <figure class="noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><a href="/wiki/Main_Page" title="Go to main page"><img alt="Alt text" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" width="150" height="17" class="mw-file-element" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" resource="/wiki/File:Foobar.jpg" /></a><figcaption></figcaption></figure>
82 !! html/parsoid
83 <figure typeof="mw:File mw:Extension/imagemap" class="noresize mw-ext-imagemap-desc-bottom-right" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|150px|alt=Alt text\ndefault [[Main Page|Go to main page]]\n"}}'><a href="./Main_Page" title="Go to main page"><img alt="Alt text" resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" class="mw-file-element"/></a><figcaption></figcaption></figure>
84 !! end
85
86 !! test
87 imagemap test 3 (legacy)
88 !! config
89 wgParserEnableLegacyMediaDOM=true
90 !! wikitext
91 <imagemap>
92 File:Foobar.jpg|150px|alt=Alt text
93 default [[Main Page|Go to main page]]
94 </imagemap>
95 !! html/php
96 <div class="noresize" style="height: 17px; width: 150px; "><a href="/wiki/Main_Page" title="Go to main page"><img alt="Alt text" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" width="150" height="17" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" /></a><div style="margin-left: 130px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/resources/desc-20.png?15600" style="border: none;" /></a></div></div>
97 !! html/parsoid
98 <figure typeof="mw:File mw:Extension/imagemap" class="noresize mw-ext-imagemap-desc-bottom-right" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|150px|alt=Alt text\ndefault [[Main Page|Go to main page]]\n"}}'><a href="./Main_Page" title="Go to main page"><img alt="Alt text" resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" class="mw-file-element"/></a><figcaption></figcaption></figure>
99 !! end
100
101 !! test
102 Empty imagemap
103 !! wikitext
104 <imagemap>
105 </imagemap>
106 !! html/php
107 <p class="error">Error: Must specify an image in the first line.</p>
108 !! html/parsoid
109 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\n"},"errors":[{"key":"imagemap_no_image"}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_no_image","params":null}}'></span></p>
110 !! end
111
112 !! test
113 Invalid image title
114 !! wikitext
115 <imagemap>
116 [[x|xx]]]]
117 </imagemap>
118 !! html/php
119 <p class="error">Error: Must specify an image in the first line.</p>
120 !! html/parsoid
121 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\n[[x|xx]]]]\n"},"errors":[{"key":"imagemap_no_image"}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_no_image","params":null}}'></span></p>
122 !! end
123
124 !! test
125 Image does not exist
126 !! wikitext
127 <imagemap>
128 File:Nopenopenope.jpg
129 </imagemap>
130 !! html/php
131 <p class="error">Error: Image is invalid or non-existent.</p>
132 !! html/parsoid
133 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Nopenopenope.jpg\n"},"errors":[{"key":"imagemap_invalid_image"}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_invalid_image","params":null}}'></span></p>
134 !! end
135
136 !! test
137 Invalid description type
138 !! wikitext
139 <imagemap>
140 Image:Foobar.jpg
141 desc nopenopenope
142 </imagemap>
143 !! html/php
144 <p class="error">Error: Invalid desc specification, must be one of: <code>top-right, bottom-right, bottom-left, top-left, none</code>.</p>
145 !! html/parsoid
146 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\ndesc nopenopenope\n"},"errors":[{"key":"imagemap_invalid_desc","params":["top-right, bottom-right, bottom-left, top-left, none"]}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_invalid_desc","params":["top-right, bottom-right, bottom-left, top-left, none"]}}'></span></p>
147 !! end
148
149 !! test
150 Empty description type
151 !! wikitext
152 <imagemap>
153 Image:Foobar.jpg
154 desc
155 </imagemap>
156 !! html/php
157 <p class="error">Error: Invalid desc specification, must be one of: <code>top-right, bottom-right, bottom-left, top-left, none</code>.</p>
158 !! html/parsoid
159 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\ndesc\n"},"errors":[{"key":"imagemap_invalid_desc","params":["top-right, bottom-right, bottom-left, top-left, none"]}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_invalid_desc","params":["top-right, bottom-right, bottom-left, top-left, none"]}}'></span></p>
160 !! end
161
162 !! test
163 Non-default description type
164 !! config
165 wgParserEnableLegacyMediaDOM=false
166 !! wikitext
167 <imagemap>
168 Image:Foobar.jpg
169 desc top-left
170 </imagemap>
171 !! html/php
172 <figure class="mw-default-size noresize mw-ext-imagemap-desc-top-left" typeof="mw:File"><span><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/File:Foobar.jpg" /></span><figcaption></figcaption></figure>
173 !! html/parsoid
174 <figure class="mw-default-size noresize mw-ext-imagemap-desc-top-left" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\ndesc top-left\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption></figcaption></figure>
175 !! end
176
177 !! test
178 Non-default localized (French) description type
179 !! options
180 language=fr
181 !! config
182 wgParserEnableLegacyMediaDOM=false
183 !! wikitext
184 <imagemap>
185 Image:Foobar.jpg
186 desc haut-gauche
187 </imagemap>
188 !! html/php
189 <figure class="mw-default-size noresize mw-ext-imagemap-desc-top-left" typeof="mw:File"><span><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/Fichier:Foobar.jpg" /></span><figcaption></figcaption></figure>
190 !! html/parsoid
191 <figure class="mw-default-size noresize mw-ext-imagemap-desc-top-left" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\ndesc haut-gauche\n"}}'><span><img resource="./Fichier:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption></figcaption></figure>
192 !! end
193
194 !! test
195 None description type
196 !! config
197 wgParserEnableLegacyMediaDOM=false
198 !! wikitext
199 <imagemap>
200 Image:Foobar.jpg
201 desc none
202 </imagemap>
203 !! html/php
204 <figure class="mw-default-size noresize" typeof="mw:File"><span><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></span><figcaption></figcaption></figure>
205 !! html/parsoid
206 <figure class="mw-default-size noresize" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nImage:Foobar.jpg\ndesc none\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption></figcaption></figure>
207 !! end
208
209 !! test
210 No link title
211 !! wikitext
212 <imagemap>
213 File:Foobar.jpg
214 123
215 </imagemap>
216 !! html/php
217 <p class="error">Error: No valid link was found at the end of line 3.</p>
218 !! html/parsoid
219 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\n123\n"},"errors":[{"key":"imagemap_no_link","params":[3]}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_no_link","params":[3]}}'></span></p>
220 !! end
221
222 !! test
223 Invalid link title
224 !! wikitext
225 <imagemap>
226 File:Foobar.jpg
227 [[<]]
228 </imagemap>
229 !! html/php
230 <p class="error">Error: Invalid title in link at line 3.</p>
231 !! html/parsoid
232 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\n[[&lt;]]\n"},"errors":[{"key":"imagemap_invalid_title","params":[3]}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_invalid_title","params":[3]}}'></span></p>
233 !! end
234
235 ## FIXME: Note the difference in the link alt
236 !! test
237 Link with wikitext syntax in content
238 !! config
239 wgParserEnableLegacyMediaDOM=false
240 !! wikitext
241 <imagemap>
242 File:Foobar.jpg|150px|alt=Alt text
243 default [[Main Page|Go to ''main page'']]
244 </imagemap>
245 !! html/php
246 <figure class="noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><a href="/wiki/Main_Page" title="Go to ''main page''"><img alt="Alt text" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" width="150" height="17" class="mw-file-element" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" resource="/wiki/File:Foobar.jpg" /></a><figcaption></figcaption></figure>
247 !! html/parsoid
248 <figure typeof="mw:File mw:Extension/imagemap" class="noresize mw-ext-imagemap-desc-bottom-right" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|150px|alt=Alt text\ndefault [[Main Page|Go to &apos;&apos;main page&apos;&apos;]]\n"}}'><a href="./Main_Page" title="Go to main page"><img alt="Alt text" resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" class="mw-file-element"/></a><figcaption></figcaption></figure>
249 !! end
250
251 ## FIXME: Note the difference in the link alt
252 !! test
253 Link with wikitext syntax in content (legacy)
254 !! config
255 wgParserEnableLegacyMediaDOM=true
256 !! wikitext
257 <imagemap>
258 File:Foobar.jpg|150px|alt=Alt text
259 default [[Main Page|Go to ''main page'']]
260 </imagemap>
261 !! html/php
262 <div class="noresize" style="height: 17px; width: 150px; "><a href="/wiki/Main_Page" title="Go to ''main page''"><img alt="Alt text" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" width="150" height="17" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" /></a><div style="margin-left: 130px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/resources/desc-20.png?15600" style="border: none;" /></a></div></div>
263 !! html/parsoid
264 <figure typeof="mw:File mw:Extension/imagemap" class="noresize mw-ext-imagemap-desc-bottom-right" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|150px|alt=Alt text\ndefault [[Main Page|Go to &apos;&apos;main page&apos;&apos;]]\n"}}'><a href="./Main_Page" title="Go to main page"><img alt="Alt text" resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/225px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 2x" class="mw-file-element"/></a><figcaption></figcaption></figure>
265 !! end
266
267 !! test
268 File with link= option
269 !! config
270 wgParserEnableLegacyMediaDOM=false
271 !! wikitext
272 <imagemap>
273 File:Foobar.jpg|link=|Hi ho
274 </imagemap>
275 !! html/php
276 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><span title="Hi ho"><img alt="Hi ho" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/File:Foobar.jpg" /></span><figcaption>Hi ho</figcaption></figure>
277 !! html/parsoid
278 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=|Hi ho\n"}}'><span title="Hi ho"><img alt="Hi ho" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption>Hi ho</figcaption></figure>
279 !! end
280
281 !! test
282 File with link= option (legacy)
283 !! config
284 wgParserEnableLegacyMediaDOM=true
285 !! wikitext
286 <imagemap>
287 File:Foobar.jpg|link=|Hi ho
288 </imagemap>
289 !! html/php
290 <div class="noresize" style="height: 220px; width: 1941px; "><img alt="Hi ho" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="Hi ho" width="1941" height="220" /><div style="margin-left: 1921px; margin-top: -20px; text-align: left;"><a href="/wiki/File:Foobar.jpg" title="About this image"><img alt="About this image" src="/extensions/ImageMap/resources/desc-20.png?15600" style="border: none;" /></a></div></div>
291 !! html/parsoid
292 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=|Hi ho\n"}}'><span title="Hi ho"><img alt="Hi ho" resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></span><figcaption>Hi ho</figcaption></figure>
293 !! end
294
295 !! test
296 File with <br> in caption (T113791)
297 !! config
298 wgParserEnableLegacyMediaDOM=false
299 !! wikitext
300 <imagemap>
301 File:Foobar.jpg|thumb|a<br>b
302 </imagemap>
303 !! html/php
304 <figure class="mw-default-size noresize" typeof="mw:File/Thumb"><span><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="mw-file-element" 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" resource="/wiki/File:Foobar.jpg" /></span><figcaption>a<br />b</figcaption></figure>
305 !! html/parsoid
306 <figure class="mw-default-size noresize" typeof="mw:File/Thumb mw:Extension/imagemap" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|thumb|a&lt;br>b\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180" 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" class="mw-file-element"/></span><figcaption>a<br/>b</figcaption></figure>
307 !! end
308
309 !! test
310 File with <br /> in caption (T113791)
311 !! config
312 wgParserEnableLegacyMediaDOM=false
313 !! wikitext
314 <imagemap>
315 File:Foobar.jpg|thumb|a<br />b
316 </imagemap>
317 !! html/php
318 <figure class="mw-default-size noresize" typeof="mw:File/Thumb"><span><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" width="180" height="20" class="mw-file-element" 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" resource="/wiki/File:Foobar.jpg" /></span><figcaption>a<br />b</figcaption></figure>
319 !! html/parsoid
320 <figure class="mw-default-size noresize" typeof="mw:File/Thumb mw:Extension/imagemap" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|thumb|a&lt;br />b\n"}}'><span><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180" 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" class="mw-file-element"/></span><figcaption>a<br/>b</figcaption></figure>
321 !! end
322
323 ## In contrast with galleries
324 !! test
325 Imagemap without file namespace
326 !! config
327 wgParserEnableLegacyMediaDOM=false
328 !! wikitext
329 <imagemap>
330 Foobar.jpg
331 </imagemap>
332 !! html/php
333 <p class="error">Error: Must specify an image in the first line.</p>
334 !! html/parsoid
335 <p><span typeof="mw:I18n mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFoobar.jpg\n"},"errors":[{"key":"imagemap_no_image"}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_no_image","params":null}}'></span></p>
336 !! end
337
338 !! test
339 Imagemap with external link
340 !! config
341 wgParserEnableLegacyMediaDOM=false
342 wgExternalLinkTarget="_blank"
343 !! wikitext
344 <imagemap>
345 File:Foobar.jpg
346 default [http://google.com]
347 </imagemap>
348 !! html/php
349 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><a target="_blank" rel="nofollow noreferrer noopener" href="http://google.com" class="plainlinks" title="http://google.com"><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/File:Foobar.jpg" /></a><figcaption></figcaption></figure>
350 !! html/parsoid
351 <figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\ndefault [http://google.com]\n"}}'><a href="http://google.com" class="plainlinks" rel="nofollow noreferrer noopener" target="_blank"><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></a><figcaption></figcaption></figure>
352 !! end