Merge "Remove WikiPage::isBigDeletion() (deprecated since 1.19)"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 10 Jul 2014 17:29:38 +0000 (17:29 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 10 Jul 2014 17:29:38 +0000 (17:29 +0000)
includes/Html.php
skins/common/images/tipsy-arrow.gif [deleted file]
skins/common/shared.css
tests/phpunit/includes/HtmlTest.php

index 5262ffe..5f4655c 100644 (file)
@@ -386,7 +386,7 @@ class Html {
         * For instance, it will omit quotation marks if $wgWellFormedXml is false,
         * and will treat boolean attributes specially.
         *
-        * Attributes that should contain space-separated lists (such as 'class') array
+        * Attributes that can contain space-separated lists ('class', 'accesskey' and 'rel') array
         * values are allowed as well, which will automagically be normalized
         * and converted to a space-separated string. In addition to a numerical
         * array, the attribute value may also be an associative array. See the
@@ -413,6 +413,8 @@ class Html {
         *   A value of false means to omit the attribute.  For boolean attributes,
         *   you can omit the key, e.g., array( 'checked' ) instead of
         *   array( 'checked' => 'checked' ) or such.
+        *
+        * @throws MWException if an attribute that doesn't allow lists is set to an array
         * @return string HTML fragment that goes between element name and '>'
         *   (starting with a space if at least one attribute is output)
         */
@@ -500,6 +502,8 @@ class Html {
 
                                // Remove duplicates and create the string
                                $value = implode( ' ', array_unique( $value ) );
+                       } else if ( is_array( $value ) ) {
+                               throw new MWException( "HTML attribute $key can not contain a list of values" );
                        }
 
                        // See the "Attributes" section in the HTML syntax part of HTML5,
diff --git a/skins/common/images/tipsy-arrow.gif b/skins/common/images/tipsy-arrow.gif
deleted file mode 100644 (file)
index 9f1a15b..0000000
Binary files a/skins/common/images/tipsy-arrow.gif and /dev/null differ
index a5612e2..e72b252 100644 (file)
@@ -1128,37 +1128,6 @@ ol:lang(or) li {
        margin-left: 20px;
 }
 
-.tipsy {
-       padding: 5px 5px 10px;
-       font-size: 12px;
-       position: absolute;
-       z-index: 100000;
-       overflow: visible;
-}
-
-.tipsy-inner {
-       padding: 5px 8px 4px 8px;
-       background-color: #d6f3ff;
-       color: black;
-       border: 1px solid #5dc9f4;
-       max-width: 300px;
-       text-align: left;
-}
-
-.tipsy-arrow {
-       position: absolute;
-       /* @embed */
-       background: url(images/tipsy-arrow.gif) no-repeat top left;
-       width: 13px;
-       height: 13px;
-}
-
-.tipsy-se .tipsy-arrow {
-       bottom: -2px;
-       right: 10px;
-       background-position: 0% 100%;
-}
-
 #mw-clearyourcache,
 #mw-sitecsspreview,
 #mw-sitejspreview,
index e934965..c561e70 100644 (file)
@@ -112,7 +112,8 @@ class HtmlTest extends MediaWikiTestCase {
                        Html::expandAttributes( array( 'foo' => false ) ),
                        'skip keys with false value'
                );
-               $this->assertNotEmpty(
+               $this->assertEquals(
+                       ' foo=""',
                        Html::expandAttributes( array( 'foo' => '' ) ),
                        'keep keys with an empty string'
                );
@@ -153,6 +154,33 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers HTML::expandAttributes
+        */
+       public function testExpandAttributesForNumbers() {
+               $this->assertEquals(
+                       ' value=1',
+                       Html::expandAttributes( array( 'value' => 1 ) ),
+                       'Integer value is cast to a string'
+               );
+               $this->assertEquals(
+                       ' value=1.1',
+                       Html::expandAttributes( array( 'value' => 1.1 ) ),
+                       'Float value is cast to a string'
+               );
+       }
+
+       /**
+        * @covers HTML::expandAttributes
+        */
+       public function testExpandAttributesForObjects() {
+               $this->assertEquals(
+                       ' value=stringValue',
+                       Html::expandAttributes( array( 'value' => new HtmlTestValue() ) ),
+                       'Object value is converted to a string'
+               );
+       }
+
        /**
         * Test for Html::expandAttributes()
         * Please note it output a string prefixed with a space!
@@ -299,6 +327,21 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers Html::expandAttributes
+        * @expectedException MWException
+        */
+       public function testExpandAttributes_ArrayOnNonListValueAttribute_ThrowsException() {
+               // Real-life test case found in the Popups extension (see Gerrit cf0fd64),
+               // when used with an outdated BetaFeatures extension (see Gerrit deda1e7)
+               Html::expandAttributes( array(
+                       'src' => array(
+                               'ltr' => 'ltr.svg',
+                               'rtl' => 'rtl.svg'
+                       )
+               ) );
+       }
+
        /**
         * @covers Html::namespaceSelector
         */
@@ -665,3 +708,9 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 }
+
+class HtmlTestValue {
+       function __toString() {
+               return 'stringValue';
+       }
+}