X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FSanitizerTest.php;h=b74542309b3d860d5dad9d6823dd7ccf5fef0789;hb=97caae596d5493ea2f3e4ba505204a7e278d0590;hp=c84f10c9b7e68e59adfe82d039cc5d31ad07606b;hpb=91d90c5b86aa39b3ab6fc41a3afa9f42fad2d34e;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php
index c84f10c9b7..b74542309b 100644
--- a/tests/phpunit/includes/SanitizerTest.php
+++ b/tests/phpunit/includes/SanitizerTest.php
@@ -71,8 +71,6 @@ class SanitizerTest extends MediaWikiTestCase {
*/
function testRemovehtmltagsOnHtml5Tags( $tag, $escaped ) {
$this->setMwGlobals( array(
- # Enable HTML5 mode
- 'wgHtml5' => true,
'wgUseTidy' => false
) );
@@ -101,18 +99,43 @@ class SanitizerTest extends MediaWikiTestCase {
);
}
- function testSelfClosingTag() {
- $this->setMwGlobals( array(
- 'wgUseTidy' => false
- ) );
-
- $this->assertEquals(
- '
Hello world
',
- Sanitizer::removeHTMLtags( 'Hello world
' ),
- 'Self-closing closing div'
+ function dataRemoveHTMLtags() {
+ return array(
+ // former testSelfClosingTag
+ array(
+ 'Hello world
',
+ 'Hello world
',
+ 'Self-closing closing div'
+ ),
+ // Make sure special nested HTML5 semantics are not broken
+ // http://www.whatwg.org/html/text-level-semantics.html#the-kbd-element
+ array(
+ 'Shift+F3',
+ 'Shift+F3',
+ 'Nested .'
+ ),
+ // http://www.whatwg.org/html/text-level-semantics.html#the-sub-and-sup-elements
+ array(
+ 'xi, yi',
+ 'xi, yi',
+ 'Nested .'
+ ),
+ // http://www.whatwg.org/html/text-level-semantics.html#the-dfn-element
+ array(
+ 'GDO',
+ 'GDO',
+ ' inside ',
+ ),
);
}
+ /**
+ * @dataProvider dataRemoveHTMLtags
+ */
+ function testRemoveHTMLtags( $input, $output, $msg = null ) {
+ $GLOBALS['wgUseTidy'] = false;
+ $this->assertEquals( $output, Sanitizer::removeHTMLtags( $input ), $msg );
+ }
/**
* @dataProvider provideTagAttributesToDecode