From: C. Scott Ananian
Date: Tue, 25 Mar 2014 16:51:15 +0000 (-0400)
Subject: Sync up with Parsoid parserTests.
X-Git-Tag: 1.31.0-rc.0~16464^2~1
X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=722f3bd7f9316ed20e37d5e629f313ac3f4c4f50;p=lhc%2Fweb%2Fwiklou.git
Sync up with Parsoid parserTests.
This now aligns with Parsoid commit b2e209c4d370a4a83f33bb1a9f6f7794e7fda3ca
Change-Id: I27e0373436cbfd16b1558ca2b2e998144b808f4b
---
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 1e0f78d529..e8e71b8047 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -10170,7 +10170,8 @@ parsoid=wt2html,wt2wt,html2html
# See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
# and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
# Foobar has actual size of 1941x220
-# 1. Thumbs & frameless always reduce, can't be enlarged
+# 1. Thumbs & frameless always reduce, can't be enlarged unless it's
+# a scalable format.
# 2. Framed images ignore width; always render at default size.
# If given a height, they respect height but continue to ignore width.
# 3. "Unspecified format" and border are the only types which can be
@@ -10224,16 +10225,20 @@ parsoid=wt2html,wt2wt,html2html
!! end
!! test
-Image: thumbs can't be enlarged past original size
+Image: bitmap thumbs can't be enlarged past original size, but vector can.
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|thumb|2000px]]
+
+[[File:Foobar.svg|thumb|2000px]]
!! html/php
+
!! html/parsoid
+
!! end
!! test
@@ -10250,16 +10255,20 @@ parsoid=wt2html,wt2wt,html2html
!! end
!! test
-Image: frameless can't be enlarged past original size
+Image: bitmap frameless can't be enlarged past original size, but vector can
!! options
parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.jpg|frameless|2000px]]
+
+[[File:Foobar.svg|frameless|2000px]]
!! html/php
+
!! html/parsoid
+
!! end
!! test
@@ -10357,153 +10366,191 @@ SVG thumbnails with no language set
!! options
!! wikitext
[[File:Foobar.svg|thumb|caption]]
-!! html
+!! html/php
caption
+!! html/parsoid
+
!! end
!! test
SVG thumbnails with language de
!! options
+parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.svg|thumb|caption|lang=de]]
-!! html
+!! html/php
caption
+!! html/parsoid
+
!! end
!! test
SVG thumbnails with invalid language code
!! options
+parsoid=wt2html,wt2wt,html2html
!! wikitext
[[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
-!! html
+!! html/php
lang=invalid.language.code
+!! html/parsoid
+
!! end
!! test
BUG 1887: A ISBN with a thumbnail
!! wikitext
-[[Image:foobar.jpg|thumb|ISBN 1235467890]]
-!! html
+[[File:Foobar.jpg|thumb|ISBN 1235467890]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 1887: A RFC with a thumbnail
!! wikitext
-[[Image:foobar.jpg|thumb|This is RFC 12354]]
-!! html
+[[File:Foobar.jpg|thumb|This is RFC 12354]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 1887: A mailto link with a thumbnail
!! wikitext
-[[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
-!! html
+[[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
+!! html/php
+!! html/parsoid
+
!! end
# Pending resolution to bug 368
!! test
BUG 648: Frameless image caption with a link
!! wikitext
-[[Image:foobar.jpg|text with a [[link]] in it]]
-!! html
+[[File:Foobar.jpg|text with a [[link]] in it]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 648: Frameless image caption with a link (suffix)
!! wikitext
-[[Image:foobar.jpg|text with a [[link]]foo in it]]
-!! html
+[[File:Foobar.jpg|text with a [[link]]foo in it]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 648: Frameless image caption with an interwiki link
!! wikitext
-[[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
-!! html
+[[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 648: Frameless image caption with a piped interwiki link
!! wikitext
-[[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
-!! html
+[[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
Escape HTML special chars in image alt text
!! wikitext
-[[Image:foobar.jpg|& < > "]]
-!! html
+[[File:Foobar.jpg|& < > "]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
BUG 499: Alt text should have Ӓ, not &1234;
!! wikitext
-[[Image:foobar.jpg|♀]]
-!! html
+[[File:Foobar.jpg|♀]]
+!! html/php
+!! html/parsoid
+
!! end
!! test
Broken image caption with link
+!! options
+parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
-!! html
+!! html/php
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
+!! html/parsoid
+
[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link.
!! end
!! test
Image caption containing another image
!! wikitext
-[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
-!! html
-
+[[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
+!! html/php
+
This is a caption with another inside it!
+!! html/parsoid
+
!! end
!! test
-Image caption containing a newline
+Image: caption containing a newline
!! wikitext
-[[Image:Foobar.jpg|This
+[[File:Foobar.jpg|This
*is some text]]
-!! html
+!! html/php
+!! html/parsoid
+
!!end
!!test
-Parsoid: Image caption containing leading space
+Image: caption containing leading space
(The leading space should not trigger nowiki escaping in wt2wt mode)
!! wikitext
-[[Image:Foobar.jpg|thumb| bar]]
-!! html
+[[File:Foobar.jpg|thumb| bar]]
+!! html/php
bar
+!! html/parsoid
+
!!end
!! test
-Images: caption containing a table
+Image: caption containing a table
+!! options
+parsoid=wt2html,wt2wt,html2html
!! wikitext
[[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
{|
@@ -14712,6 +14759,14 @@ ISBN 3-462-04561-X
!! end
+!! test
+ISBN with empty prefix (parsoid test)
+!! wikitext
+ISBN 1234567890
+!! html/parsoid
+
!!end
-# note that the data-parsoid value conflicts with the figure's class
+# Change in size is ignored so long as class='mw-default-size'
+!! test
+Image: Modifying size of an image (3)
+!! options
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["figure[class]", "removeClass", "mw-default-size"],
+ ["figure img", "attr", "height", "19"],
+ ["figure img", "attr", "width", "170"]
+ ]
+}
+!! wikitext
+[[Image:Foobar.jpg|thumb]]
+!! wikitext/edited
+[[Image:Foobar.jpg|thumb|170x170px]]
+!!end
+
!! test
Image: Modifying alignment of an image (bug 48665)
!! options
-parsoid=html2wt
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["figure[class]", "removeClass", "mw-halign-right"],
+ ["figure[class]", "addClass", "mw-halign-left"]
+ ]
+}
!! wikitext
+[[Image:Foobar.jpg|thumb|caption|right]]
+!! wikitext/edited
[[Image:Foobar.jpg|thumb|caption|left]]
-!! html
-
+!! end
+
+!! test
+Image: Modifying mw-default-size of an frameless image (bug 62805)
+!! options
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["figure.mw-default-size", "removeClass", "mw-default-size"]
+ ]
+}
+!! wikitext
+[[Image:Foobar.jpg|frameless|right]]
+!! wikitext/edited
+[[Image:Foobar.jpg|frameless|right|220x220px]]
!! end
!! test
Image: Modifying valign of an image (bug 49221)
!! options
-parsoid=html2wt
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
+ ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
+ ]
+}
!! wikitext
+[[File:Foobar.jpg|20px|middle]]
+!! wikitext/edited
[[File:Foobar.jpg|20px|text-top]]
-!! html
-
!! end
!! test
Image: Modifying alt attribute of an image (bug 56400)
!! options
-parsoid=html2wt
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["img[alt]", "attr", "alt", "some alternate edited text"]
+ ]
+}
!! wikitext
+[[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
+!! wikitext/edited
[[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
-!! html
-
!!end
!! test
Image: Modifying caption of an image
!! options
-parsoid=html2wt
+parsoid={
+ "modes": ["wt2wt"],
+ "changes": [
+ ["figcaption", "text", "new caption"]
+ ]
+}
!! wikitext
+[[Image:Foobar.jpg|thumb|original caption]]
+!! wikitext/edited
[[Image:Foobar.jpg|thumb|new caption]]
-!! html
-
!!end
!! test
@@ -19480,7 +19601,7 @@ parsoid
!!end
!! test
-Images: upright option (parsoid)
+Image: upright option (parsoid)
!! options
parsoid
!! wikitext
@@ -19492,7 +19613,7 @@ parsoid
!!end
!! test
-Images: upright option is ignored on inline and frame images (parsoid)
+Image: upright option is ignored on inline and frame images (parsoid)
!! options
parsoid
!! wikitext
@@ -19501,6 +19622,48 @@ parsoid
!!end
+!! test
+Image: from basic HTML (1)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+
+
+!! wikitext
+[[File:Foobar.jpg|link=|alt=Alt|100x100px]]
+!! end
+
+!! test
+Image: from basic HTML (2)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+!! wikitext
+[[File:Foobar.jpg|link=|alt=Alt|100x100px]]
+!! end
+
+!! test
+Image: from basic HTML (3)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+!! wikitext
+[[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
+!! end
+
+!! test
+Image: from basic HTML (4)
+!! options
+parsoid=html2wt
+!! html/parsoid
+
+!! wikitext
+[[File:Foobar.jpg|link=]]
+!! end
+
!! test
Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
!! options