X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FSanitizerTest.php;h=c237c509a7751f9a41b9bb14b3a7620eaeb16405;hb=f7e1770fb832aa77bf4e16ce8cc815f2b24dd10d;hp=12db1a198fce57ade366fc126227be292b665d51;hpb=37751ee23e7b7019307eafe36f18c8450bf2e420;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/SanitizerTest.php b/tests/phpunit/includes/SanitizerTest.php index 12db1a198f..c237c509a7 100644 --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@ -211,7 +211,7 @@ class SanitizerTest extends MediaWikiTestCase { [ [ 'foo6' => 'baz' ], 'foo6=baz', 'Numbers are allowed' ], # This bit is more relaxed than XML rules, but some extensions use - # it, like ProofreadPage (see bug 27539) + # it, like ProofreadPage (see T29539) [ [ '1foo' => 'baz' ], '1foo=baz', 'Leading numbers are allowed' ], [ [], 'foo$=baz', 'Symbols are not allowed' ], [ [], 'foo@=baz', 'Symbols are not allowed' ], @@ -286,7 +286,7 @@ class SanitizerTest extends MediaWikiTestCase { [ ' ', '/* /* */' ], [ 'display: block;', "display:/* foo */block;" ], [ 'display: block;', "display:\\2f\\2a foo \\2a\\2f block;", - 'Backslash-escaped comments must be stripped (bug 28450)' ], + 'Backslash-escaped comments must be stripped (T30450)' ], [ '', '/* unfinished comment structure', 'Remove anything after a comment-start token' ], [ '', "\\2f\\2a unifinished comment'", @@ -362,4 +362,25 @@ class SanitizerTest extends MediaWikiTestCase { [ '+1 +2', '+1', '+2' ], ]; } + + /** + * @dataProvider provideIsReservedDataAttribute + */ + public function testIsReservedDataAttribute( $attr, $expected ) { + $this->assertSame( $expected, Sanitizer::isReservedDataAttribute( $attr ) ); + } + + public static function provideIsReservedDataAttribute() { + return [ + [ 'foo', false ], + [ 'data', false ], + [ 'data-foo', false ], + [ 'data-mw', true ], + [ 'data-ooui', true ], + [ 'data-parsoid', true ], + [ 'data-mw-foo', true ], + [ 'data-ooui-foo', true ], + [ 'data-mwfoo', true ], // could be false but this is how it's implemented currently + ]; + } }