Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/77847


Change subject: Reorganize image-related parser tests.
......................................................................

Reorganize image-related parser tests.

Tag test with php/parsoid and move the parsoid versions of the image
tests directly adjacent to the php versions, so we can easily see that
the two versions are testing the same features.

The image-with-external-link tests fail wt2html, due to bug 49293.

Change-Id: I49e7d387c41320ba7e4157a3e6e84686ae13c370
---
M js/tests/parserTests-blacklist.js
M js/tests/parserTests.txt
2 files changed, 260 insertions(+), 131 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/47/77847/1

diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index bb32dce..48c486e 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -195,24 +195,14 @@
 add("wt2html", "{{#speciale:}} page name, known");
 add("wt2html", "{{#speciale:}} page name with subpage, known");
 add("wt2html", "{{#speciale:}} page name, unknown");
-add("wt2html", "Simple image");
-add("wt2html", "Right-aligned image");
-add("wt2html", "Simple image (using File: namespace, now canonical)");
-add("wt2html", "Image with caption");
-add("wt2html", "Image with empty attribute");
-add("wt2html", "Image with attributes from template.");
-add("wt2html", "Image with link tails");
-add("wt2html", "Image with multiple captions -- only last one is accepted");
-add("wt2html", "Image with width attribute at different positions");
-add("wt2html", "Image with link parameter, wiki target");
-add("wt2html", "Image with link parameter, URL target");
+add("wt2html", "Image with attributes from template (parsoid)");
+add("wt2html", "Image with link parameter, URL target (parsoid)");
+add("wt2html", "Image with link parameter, protocol-less URL target 
(parsoid)");
 add("wt2html", "Image with link parameter, wgExternalLinkTarget");
 add("wt2html", "Image with link parameter, wgNoFollowLinks set to false");
 add("wt2html", "Image with link parameter, wgNoFollowDomainExceptions");
 add("wt2html", "Image with link parameter, wgExternalLinkTarget, unnamed 
parameter");
-add("wt2html", "Image with empty link parameter");
-add("wt2html", "Image with link parameter (wiki target) and unnamed 
parameter");
-add("wt2html", "Image with link parameter (URL target) and unnamed parameter");
+add("wt2html", "Image with link parameter (URL target) and unnamed parameter 
(parsoid)");
 add("wt2html", "Image with frame and link");
 add("wt2html", "Image with frame and link and explicit alt");
 add("wt2html", "Image with wiki markup in implicit alt");
@@ -603,7 +593,7 @@
 add("wt2wt", "pre-save transform: mixed tag case");
 add("wt2wt", "pre-save transform: Signature expansion");
 add("wt2wt", "pre-save transform: Signature expansion in nowiki tags (bug 
93)");
-add("wt2wt", "Image with multiple captions -- only last one is accepted");
+add("wt2wt", "Image with multiple captions -- only last one is accepted 
(parsoid)");
 add("wt2wt", "SVG thumbnails with language de");
 add("wt2wt", "SVG thumbnails with invalid language code");
 add("wt2wt", "BUG 561: {{/Subpage}}");
@@ -902,24 +892,13 @@
 add("html2html", "{{#speciale:}} page name, known");
 add("html2html", "{{#speciale:}} page name with subpage, known");
 add("html2html", "{{#speciale:}} page name, unknown");
-add("html2html", "Simple image");
-add("html2html", "Right-aligned image");
-add("html2html", "Simple image (using File: namespace, now canonical)");
-add("html2html", "Image with caption");
-add("html2html", "Image with empty attribute");
-add("html2html", "Image with attributes from template.");
-add("html2html", "Image with link tails");
-add("html2html", "Image with multiple captions -- only last one is accepted");
-add("html2html", "Image with width attribute at different positions");
-add("html2html", "Image with link parameter, wiki target");
-add("html2html", "Image with link parameter, URL target");
+add("html2html", "Image with link tails (parsoid)");
+add("html2html", "Image with link parameter, URL target (parsoid)");
 add("html2html", "Image with link parameter, wgExternalLinkTarget");
 add("html2html", "Image with link parameter, wgNoFollowLinks set to false");
 add("html2html", "Image with link parameter, wgNoFollowDomainExceptions");
 add("html2html", "Image with link parameter, wgExternalLinkTarget, unnamed 
parameter");
-add("html2html", "Image with empty link parameter");
-add("html2html", "Image with link parameter (wiki target) and unnamed 
parameter");
-add("html2html", "Image with link parameter (URL target) and unnamed 
parameter");
+add("html2html", "Image with link parameter (URL target) and unnamed parameter 
(parsoid)");
 add("html2html", "Image with frame and link");
 add("html2html", "Image with frame and link and explicit alt");
 add("html2html", "Image with wiki markup in implicit alt");
@@ -1684,24 +1663,19 @@
 add("html2wt", "{{#speciale:}} page name, known");
 add("html2wt", "{{#speciale:}} page name with subpage, known");
 add("html2wt", "{{#speciale:}} page name, unknown");
-add("html2wt", "Simple image");
-add("html2wt", "Right-aligned image");
-add("html2wt", "Simple image (using File: namespace, now canonical)");
-add("html2wt", "Image with caption");
-add("html2wt", "Image with empty attribute");
-add("html2wt", "Image with attributes from template.");
-add("html2wt", "Image with link tails");
-add("html2wt", "Image with multiple captions -- only last one is accepted");
-add("html2wt", "Image with width attribute at different positions");
-add("html2wt", "Image with link parameter, wiki target");
-add("html2wt", "Image with link parameter, URL target");
+add("html2wt", "Image with attributes from template (parsoid)");
+add("html2wt", "Image with link tails (parsoid)");
+add("html2wt", "Image with multiple captions -- only last one is accepted 
(parsoid)");
+add("html2wt", "Image with width attribute at different positions (parsoid)");
+add("html2wt", "Image with link parameter, wiki target (parsoid)");
+add("html2wt", "Image with link parameter, URL target (parsoid)");
+add("html2wt", "Image with link parameter, protocol-less URL target 
(parsoid)");
 add("html2wt", "Image with link parameter, wgExternalLinkTarget");
 add("html2wt", "Image with link parameter, wgNoFollowLinks set to false");
 add("html2wt", "Image with link parameter, wgNoFollowDomainExceptions");
 add("html2wt", "Image with link parameter, wgExternalLinkTarget, unnamed 
parameter");
-add("html2wt", "Image with empty link parameter");
-add("html2wt", "Image with link parameter (wiki target) and unnamed 
parameter");
-add("html2wt", "Image with link parameter (URL target) and unnamed parameter");
+add("html2wt", "Image with link parameter (wiki target) and unnamed parameter 
(parsoid)");
+add("html2wt", "Image with link parameter (URL target) and unnamed parameter 
(parsoid)");
 add("html2wt", "Image with frame and link");
 add("html2wt", "Image with frame and link and explicit alt");
 add("html2wt", "Image with wiki markup in implicit alt");
@@ -1734,9 +1708,6 @@
 add("html2wt", "\"border\", \"frameless\" and \"class\" attributes on an 
image.");
 add("html2wt", "Redirected image");
 add("html2wt", "Missing image with uploads disabled");
-add("html2wt", "Parsoid-specific image handling - simple image");
-add("html2wt", "Parsoid-specific image handling - simple image without link");
-add("html2wt", "Parsoid-specific image handling - simple image with specific 
link");
 add("html2wt", "Parsoid-specific image handling - simple image with size and 
middle alignment");
 add("html2wt", "Parsoid-specific image handling - simple image with both 
sizes, a baseline alignment, and a caption");
 add("html2wt", "Parsoid-specific image handling - simple image with border and 
size spec");
@@ -3163,9 +3134,9 @@
 add("selser", "pre-save transform: Signature expansion in nowiki tags (bug 93) 
[4,4,2,0,3,0,0,[1,[3],0],0,4,3,0,0,2,0,[2,2,0]]");
 add("selser", "pre-save transform: Signature expansion in nowiki tags (bug 93) 
[4,0,[1],0,3,0,3,3,2,[4,2,3],2,1,0,[0,2,0,1,2,2,0,0],0,2]");
 add("selser", "pre-save transform: Signature expansion in nowiki tags (bug 93) 
[1,3,[2],0,0,0,2,0,0,2,0,0,3,2,0,[0,2,2]]");
-add("selser", "Image with multiple captions -- only last one is accepted 
[[0,[3]]]");
-add("selser", "Image with multiple captions -- only last one is accepted 
[[0,[2]]]");
-add("selser", "Image with multiple captions -- only last one is accepted 
[[0,[4]]]");
+add("selser", "Image with multiple captions -- only last one is accepted 
(parsoid) [[0,[4]]]");
+add("selser", "Image with multiple captions -- only last one is accepted 
(parsoid) [[0,[2]]]");
+add("selser", "Image with multiple captions -- only last one is accepted 
(parsoid) [[0,[3]]]");
 add("selser", "SVG thumbnails with language de [[0,[2]]]");
 add("selser", "SVG thumbnails with language de [[0,[4]]]");
 add("selser", "SVG thumbnails with language de [[0,[3]]]");
diff --git a/js/tests/parserTests.txt b/js/tests/parserTests.txt
index 1b3f80d..ff53a72 100644
--- a/js/tests/parserTests.txt
+++ b/js/tests/parserTests.txt
@@ -8035,8 +8035,13 @@
 ###
 ### Images
 ###
+### For Parsoid-specific tests, see
+#### http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
+
 !! test
-Simple image
+Simple image (php)
+!! options
+php
 !! input
 [[Image:foobar.jpg]]
 !! result
@@ -8045,16 +8050,20 @@
 !! end
 
 !! test
-Right-aligned image
+Simple image (parsoid)
+!! options
+parsoid=wt2html
 !! input
-[[Image:foobar.jpg|right]]
+[[Image:foobar.jpg]]
 !! result
-<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" 
height="220" /></a></div>
-
+<p><span class="mw-default-size" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
+</p>
 !! end
 
 !! test
-Simple image (using File: namespace, now canonical)
+Simple image (using File: namespace, now canonical) (php)
+!! options
+php
 !! input
 [[File:foobar.jpg]]
 !! result
@@ -8063,38 +8072,108 @@
 !! end
 
 !! test
-Image with caption
+Simple image (using File: namespace, now canonical) (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|right|Caption text]]
+[[File:Foobar.jpg]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span>
+</p>
+!! end
+
+!! test
+Right-aligned image (php)
+!! options
+php
+!! input
+[[Image:foobar.jpg|right]]
+!! result
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img 
alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" 
height="220" /></a></div>
+
+!! end
+
+!! test
+Right-aligned image (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|right]]
+!! result
+<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></figure>
+!! end
+
+!! test
+Image with caption (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|right|Caption text]]
 !! result
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption text"><img alt="Caption text" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a></div>
 
 !! end
 
 !! test
-Image with empty attribute
+Image with caption (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|right||Caption text]]
+[[File:Foobar.jpg|right|Caption text]]
+!! result
+<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a><figcaption>Caption text</figcaption></figure>
+!! end
+
+!! test
+Image with empty attribute (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|right||Caption text]]
 !! result
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption text"><img alt="Caption text" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a></div>
 
 !! end
 
 !! test
-Image with attributes from template.
+Image with empty attribute (parsoid)
+!! options
+parsoid=wt2html
 !! input
-[[Image:foobar.jpg|{{image_attribs}}]]
+[[File:Foobar.jpg|right||Caption text]]
+!! result
+<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a><figcaption>Caption text</figcaption></figure>
+!! end
+
+!! test
+Image with attributes from template (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|{{image_attribs}}]]
 !! result
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption text"><img alt="Caption text" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a></div>
 
 !! end
 
 !! test
-Image with link tails
+Image with attributes from template (parsoid)
+!! options
+parsoid
 !! input
-123[[Image:foobar.jpg]]456
-123[[Image:foobar.jpg|right]]456
-123[[Image:foobar.jpg|thumb]]456
+[[File:Foobar.jpg|{{image_attribs}}]]
+!! result
+<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a><figcaption>Caption text</figcaption></figure>
+!! end
+
+!! test
+Image with link tails (php)
+!! options
+php
+!! input
+123[[File:Foobar.jpg]]456
+123[[File:Foobar.jpg|right]]456
+123[[File:Foobar.jpg|thumb]]456
 !! result
 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a>456
 </p>
@@ -8104,20 +8183,48 @@
 !! end
 
 !! test
-Image with multiple captions -- only last one is accepted
+Image with link tails (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - 
accepted]]
+123[[File:Foobar.jpg]]456
+123[[File:Foobar.jpg|right]]456
+123[[File:Foobar.jpg|thumb]]456
+!! result
+<p>123<span class="mw-default-size" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></span>456</p>
+123<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></figure>456
+123<figure class="mw-default-size" typeof="mw:Image/Thumb"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="20" 
width="180"></a></figure>456
+!! end
+
+!! test
+Image with multiple captions -- only last one is accepted (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - 
accepted]]
 !! result
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption3 - accepted"><img alt="Caption3 - accepted" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" 
/></a></div>
 
 !! end
 
 !! test
-Image with width attribute at different positions
+Image with multiple captions -- only last one is accepted (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|200px|right|Caption]]
-[[Image:foobar.jpg|right|200px|Caption]]
-[[Image:foobar.jpg|right|Caption|200px]]
+[[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - 
accepted]]
+!! result
+<figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
+!! end
+
+!! test
+Image with width attribute at different positions (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|200px|right|Caption]]
+[[File:Foobar.jpg|right|200px|Caption]]
+[[File:Foobar.jpg|right|Caption|200px]]
 !! result
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption"><img alt="Caption" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" 
/></a></div>
 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" 
title="Caption"><img alt="Caption" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg"; 
width="200" height="23" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" 
/></a></div>
@@ -8126,21 +8233,82 @@
 !! end
 
 !! test
-Image with link parameter, wiki target
+Image with width attribute at different positions (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|link=Target page]]
+[[File:Foobar.jpg|200px|right|Caption]]
+[[File:Foobar.jpg|right|200px|Caption]]
+[[File:Foobar.jpg|right|Caption|200px]]
 !! result
-<p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
+<figure class="mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" 
width="200"></a><figcaption>Caption</figcaption></figure>
+<figure class="mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" 
width="200"></a><figcaption>Caption</figcaption></figure>
+<figure class="mw-halign-right" typeof="mw:Image"><a 
href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" height="23" 
width="200"></a><figcaption>Caption</figcaption></figure>
+!! end
+
+!! test
+Image with link parameter, wiki target (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|link=Main Page]]
+!! result
+<p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
 </p>
 !! end
 
 !! test
-Image with link parameter, URL target
+Image with link parameter, wiki target (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|link=http://example.com/]]
+[[File:Foobar.jpg|link=Main Page]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941"></a></span></p>
+!! end
+
+!! test
+Image with link parameter, URL target (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|link=http://example.com/]]
 !! result
 <p><a href="http://example.com/"; rel="nofollow"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
 </p>
+!! end
+
+# parsoid bug 49293 (part 1)
+!! test
+Image with link parameter, URL target (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|link=http://example.com/]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image"><a 
href="http://example.com";><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></span></p>
+!! end
+
+!! test
+Image with link parameter, protocol-less URL target (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|link=//example.com/]]
+!! result
+<p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
+</p>
+!! end
+
+# parsoid bug 49293 (part 2)
+!! test
+Image with link parameter, protocol-less URL target (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|link=//example.com/]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image"><a 
href="//example.com"><img resource="./File:Foobar.jpg" 
src="//example.com/images/3/3a/Foobar.jpg" height="220" 
width="1941"></a></span></p>
 !! end
 
 !! test
@@ -8188,30 +8356,66 @@
 !! end
 
 !! test
-Image with empty link parameter
+Image with empty link parameter (php)
+!! options
+php
 !! input
-[[Image:foobar.jpg|link=]]
+[[File:Foobar.jpg|link=]]
 !! result
 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg"; 
width="1941" height="220" />
 </p>
 !! end
 
 !! test
-Image with link parameter (wiki target) and unnamed parameter
+Image with empty link parameter (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|link=Target page|Title]]
+[[File:Foobar.jpg|link=]]
 !! result
-<p><a href="/wiki/Target_page" title="Title"><img alt="Title" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
+<p><span class="mw-default-size" typeof="mw:Image"><span><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941"></span></span></p>
+!! end
+
+!! test
+Image with link parameter (wiki target) and unnamed parameter (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|link=Main Page|Title]]
+!! result
+<p><a href="/wiki/Main_Page" title="Title"><img alt="Title" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
 </p>
 !! end
 
 !! test
-Image with link parameter (URL target) and unnamed parameter
+Image with link parameter (wiki target) and unnamed parameter (parsoid)
+!! options
+parsoid
 !! input
-[[Image:foobar.jpg|link=http://example.com/|Title]]
+[[File:Foobar.jpg|link=Main Page|Title]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image" 
data-mw='{"caption":"Title"}'><a href="Main_Page"><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941"></a></span></p>
+!! end
+
+!! test
+Image with link parameter (URL target) and unnamed parameter (php)
+!! options
+php
+!! input
+[[File:Foobar.jpg|link=http://example.com/|Title]]
 !! result
 <p><a href="http://example.com/"; title="Title" rel="nofollow"><img alt="Title" 
src="http://example.com/images/3/3a/Foobar.jpg"; width="1941" height="220" /></a>
 </p>
+!! end
+
+!! test
+Image with link parameter (URL target) and unnamed parameter (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|link=http://example.com/|Title]]
+!! result
+<p><span class="mw-default-size" typeof="mw:Image" 
data-mw='{"caption":"Title"}'><a href="http://example.com";><img 
resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941"></a></span></p>
 !! end
 
 !! test
@@ -8592,54 +8796,8 @@
 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
 # Currently imperfect due to a flaw in the Parsoid testrunner
 # Work in progress
-
-!! test
-Parsoid-specific image handling - simple image
-!! options
-parsoid
-!! input
-[[Image:Foobar.jpg]]
-!! result
-<p>
-<span class="mw-default-size" typeof="mw:Image">
-<a href="File:Foobar.jpg">
-<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941">
-</a>
-</span>
-</p>
-!! end
-
-!! test
-Parsoid-specific image handling - simple image without link
-!! options
-parsoid
-!! input
-[[Image:Foobar.jpg|link=]]
-!! result
-<p>
-<span class="mw-default-size" typeof="mw:Image">
-<span>
-<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941">
-</span>
-</span>
-</p>
-!! end
-
-!! test
-Parsoid-specific image handling - simple image with specific link
-!! options
-parsoid
-!! input
-[[Image:Foobar.jpg|link=Main Page]]
-!! result
-<p>
-<span class="mw-default-size" typeof="mw:Image">
-<a href="Main_Page">
-<img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 
height="220" width="1941">
-</a>
-</span>
-</p>
-!! end
+# THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
+# image tests.
 
 !! test
 Parsoid-specific image handling - simple image with size and middle alignment

-- 
To view, visit https://gerrit.wikimedia.org/r/77847
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49e7d387c41320ba7e4157a3e6e84686ae13c370
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to