From: jenkins-bot Date: Fri, 15 Feb 2013 16:56:00 +0000 (+0000) Subject: Merge "Support WAI-ARIA's role="presentation" inside of WikiText." X-Git-Tag: 1.31.0-rc.0~20678 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=aeae4fedda78715690ce50236f4f38f0b9c2a9f9;p=lhc%2Fweb%2Fwiklou.git Merge "Support WAI-ARIA's role="presentation" inside of WikiText." --- aeae4fedda78715690ce50236f4f38f0b9c2a9f9 diff --cc tests/phpunit/includes/SanitizerTest.php index 92abb9e45e,402e6b739c..9707f4968e --- a/tests/phpunit/includes/SanitizerTest.php +++ b/tests/phpunit/includes/SanitizerTest.php @@@ -211,18 -211,40 +211,40 @@@ class SanitizerTest extends MediaWikiTe array( ' ', "\\2f\\2a foo \\2a\\2f", 'Backslash-escaped comments must be stripped (bug 28450)' ), array( '', '/* unfinished comment structure', - 'Remove anything after a comment-start token' ), + 'Remove anything after a comment-start token' ), array( '', "\\2f\\2a unifinished comment'", - 'Remove anything after a backslash-escaped comment-start token' ), - array( '/* insecure input */', 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'asdf.png\',sizingMethod=\'scale\');'), - array( '/* insecure input */', '-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'asdf.png\',sizingMethod=\'scale\')";'), - array( '/* insecure input */', 'width: expression(1+1);'), - array( '/* insecure input */', 'background-image: image(asdf.png);'), - array( '/* insecure input */', 'background-image: -webkit-image(asdf.png);'), - array( '/* insecure input */', 'background-image: -moz-image(asdf.png);'), - array( '/* insecure input */', 'background-image: image-set("asdf.png" 1x, "asdf.png" 2x);'), - array( '/* insecure input */', 'background-image: -webkit-image-set("asdf.png" 1x, "asdf.png" 2x);'), - array( '/* insecure input */', 'background-image: -moz-image-set("asdf.png" 1x, "asdf.png" 2x);'), + 'Remove anything after a backslash-escaped comment-start token' ), + array( '/* insecure input */', 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'asdf.png\',sizingMethod=\'scale\');' ), + array( '/* insecure input */', '-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'asdf.png\',sizingMethod=\'scale\')";' ), + array( '/* insecure input */', 'width: expression(1+1);' ), + array( '/* insecure input */', 'background-image: image(asdf.png);' ), + array( '/* insecure input */', 'background-image: -webkit-image(asdf.png);' ), + array( '/* insecure input */', 'background-image: -moz-image(asdf.png);' ), + array( '/* insecure input */', 'background-image: image-set("asdf.png" 1x, "asdf.png" 2x);' ), + array( '/* insecure input */', 'background-image: -webkit-image-set("asdf.png" 1x, "asdf.png" 2x);' ), + array( '/* insecure input */', 'background-image: -moz-image-set("asdf.png" 1x, "asdf.png" 2x);' ), ); } + + /** + * Test for support or lack of support for specific attributes in the attribute whitelist. + */ + function provideAttributeSupport() { + /** array( , , ) */ + return array( + array( 'div', ' role="presentation"', ' role="presentation"', 'Support for WAI-ARIA\'s role="presentation".' ), + array( 'div', ' role="main"', '', "Other WAI-ARIA roles are currently not supported." ), + ); + } + + /** + * @dataProvider provideAttributeSupport + */ + function testAttributeSupport( $tag, $attributes, $expected, $message ) { + $this->assertEquals( $expected, + Sanitizer::fixTagAttributes( $attributes, $tag ), + $message + ); + } + }