Merge "Support WAI-ARIA's role="presentation" inside of WikiText."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 15 Feb 2013 16:56:00 +0000 (16:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Feb 2013 16:56:00 +0000 (16:56 +0000)
1  2 
RELEASE-NOTES-1.21
tests/phpunit/includes/SanitizerTest.php

diff --combined RELEASE-NOTES-1.21
@@@ -96,6 -96,9 +96,9 @@@ production
  * (bug 43915) New maintenance script deleteEqualMessages.php.
  * New collation uppercase-sv, which is like uppercase, but adapted
    to Swedish sort order.
+ * WikiText now permits the use of WAI-ARIA's role="presentation" inside of
+   html elements and tables. This allows presentational markup, especially
+   tables. To be marked up as such.
  
  === Bug fixes in 1.21 ===
  * (bug 40353) SpecialDoubleRedirect should support interwiki redirects.
    ca-edit click instead opening URL directly.
  * (bug 43964) Invalid value of "link" parameter in <gallery> no longer produces
    a fatal error.
 +* (bug 44775) The username field is not pre-filled when creating an account.
  
  === API changes in 1.21 ===
  * prop=revisions can now report the contentmodel and contentformat.
@@@ -74,9 -74,9 +74,9 @@@ class SanitizerTest extends MediaWikiTe
                        # Enable HTML5 mode
                        'wgHtml5' => true,
                        'wgUseTidy' => false
 -              ));
 +              ) );
  
 -              if( $escaped ) {
 +              if ( $escaped ) {
                        $this->assertEquals( "&lt;$tag&gt;",
                                Sanitizer::removeHTMLtags( "<$tag>" )
                        );
@@@ -91,8 -91,8 +91,8 @@@
         * Provide HTML5 tags
         */
        function provideHtml5Tags() {
 -              $ESCAPED  = true; # We want tag to be escaped
 -              $VERBATIM = false;  # We want to keep the tag
 +              $ESCAPED = true; # We want tag to be escaped
 +              $VERBATIM = false; # We want to keep the tag
                return array(
                        array( 'data', $VERBATIM ),
                        array( 'mark', $VERBATIM ),
        function testSelfClosingTag() {
                $this->setMwGlobals( array(
                        'wgUseTidy' => false
 -              ));
 +              ) );
  
                $this->assertEquals(
                        '<div>Hello world</div>',
                        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( <attributes>, <expected>, <message> ) */
+               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
+               );
+       }
  }