jenkins-bot has submitted this change and it was merged.

Change subject: Parser tests for page status indicators
......................................................................


Parser tests for page status indicators

https://www.mediawiki.org/wiki/Help:Page_status_indicators

Change-Id: Ic461fe889a3f8ef9f332019f72cfb732c0ec1eca
---
M tests/parser/parserTest.inc
M tests/parser/parserTests.txt
M tests/phpunit/includes/parser/NewParserTest.php
3 files changed, 93 insertions(+), 0 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index e18c22b..1cffa20 100644
--- a/tests/parser/parserTest.inc
+++ b/tests/parser/parserTest.inc
@@ -643,6 +643,14 @@
                                $out = "$title\n$out";
                        }
 
+                       if ( isset( $opts['showindicators'] ) ) {
+                               $indicators = '';
+                               foreach ( $output->getIndicators() as $id => 
$content ) {
+                                       $indicators .= "$id=$content\n";
+                               }
+                               $out = $indicators . $out;
+                       }
+
                        if ( isset( $opts['ill'] ) ) {
                                $out = implode( ' ', 
$output->getLanguageLinks() );
                        } elseif ( isset( $opts['cat'] ) ) {
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index c65e8d7..2b7f4cd 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -26,6 +26,7 @@
 # php           php-only test (not run by the parsoid parser unless
 #                 the test includes an html/parsoid section)
 # showtitle     make the first line the title
+# showindicators make the first lines the page status indicators
 # comment       run through Linker::formatComment() instead of main parser
 # local         format section links in edit comment text as local links
 # notoc         disable table of contents
@@ -19144,6 +19145,82 @@
 !! end
 
 !! test
+Page status indicators: Empty name is invalid
+!! options
+showindicators
+!! wikitext
+<indicator name=" "></indicator>
+<indicator></indicator>
+!! html
+<p><span class="error"><strong>Error:</strong> Page status indicators' 
<code>name</code> attribute must not be empty.</span>
+<span class="error"><strong>Error:</strong> Page status indicators' 
<code>name</code> attribute must not be empty.</span>
+</p>
+!! end
+
+!! test
+Page status indicators: Weird syntaxes that are okay
+!! options
+showindicators
+!! wikitext
+<indicator name="empty" />
+<indicator name></indicator>
+!! html
+empty=
+name=
+<p><br />
+</p>
+!! end
+
+!! test
+Page status indicators: Torture test
+!! options
+showindicators
+!! wikitext
+<indicator name="01">hello world</indicator>
+<indicator name="02">[[Main Page]]</indicator>
+<indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
+<indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
+<indicator name="05">* foo
+* bar</indicator>
+<indicator name="06"><nowiki>foo</nowiki></indicator>
+<indicator name="07"> Preformatted</indicator>
+<indicator name="08"><div>Broken tag</indicator>
+<indicator name="09">{| class=wikitable
+| cell
+|}</indicator>
+<indicator name="10">Two
+
+paragraphs</indicator>
+!! html
+01=hello world
+02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
+03=<img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg"; 
width="25" height="3" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
+04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg"; 
width="25" height="3" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
+05=<ul><li> foo</li>
+<li> bar</li></ul>
+
+06=foo
+07=<pre>Preformatted
+</pre>
+08=<div>Broken tag</div>
+
+09=<table class="wikitable">
+<tr>
+<td> cell
+</td></tr></table>
+
+10=<p>Two
+</p><p>paragraphs
+</p>
+<p><br />
+</p><p><br />
+</p><p><br />
+</p><p><br />
+</p><p><br />
+</p>
+!! end
+
+!! test
 preload: check <noinclude> and <includeonly>
 !! options
 preload
diff --git a/tests/phpunit/includes/parser/NewParserTest.php 
b/tests/phpunit/includes/parser/NewParserTest.php
index ccd7f96..91aad10 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -771,6 +771,14 @@
                                $out = "$title\n$out";
                        }
 
+                       if ( isset( $opts['showindicators'] ) ) {
+                               $indicators = '';
+                               foreach ( $output->getIndicators() as $id => 
$content ) {
+                                       $indicators .= "$id=$content\n";
+                               }
+                               $out = $indicators . $out;
+                       }
+
                        if ( isset( $opts['ill'] ) ) {
                                $out = implode( ' ', 
$output->getLanguageLinks() );
                        } elseif ( isset( $opts['cat'] ) ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic461fe889a3f8ef9f332019f72cfb732c0ec1eca
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to