Warn if stateful ParserOutput transforms are used
[lhc/web/wiklou.git] / tests / phpunit / includes / HtmlTest.php
index e2ee193..e867f5e 100644 (file)
@@ -41,6 +41,9 @@ class HtmlTest extends MediaWikiTestCase {
 
        /**
         * @covers Html::element
+        * @covers Html::rawElement
+        * @covers Html::openElement
+        * @covers Html::closeElement
         */
        public function testElementBasics() {
                $this->assertEquals(
@@ -302,6 +305,7 @@ class HtmlTest extends MediaWikiTestCase {
 
        /**
         * @covers Html::namespaceSelector
+        * @covers Html::namespaceSelectorOptions
         */
        public function testNamespaceSelector() {
                $this->assertEquals(
@@ -443,6 +447,47 @@ class HtmlTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers Html::warningBox
+        * @covers Html::messageBox
+        */
+       public function testWarningBox() {
+               $this->assertEquals(
+                       Html::warningBox( 'warn' ),
+                       '<div class="warningbox">warn</div>'
+               );
+       }
+
+       /**
+        * @covers Html::errorBox
+        * @covers Html::messageBox
+        */
+       public function testErrorBox() {
+               $this->assertEquals(
+                       Html::errorBox( 'err' ),
+                       '<div class="errorbox">err</div>'
+               );
+               $this->assertEquals(
+                       Html::errorBox( 'err', 'heading' ),
+                       '<div class="errorbox"><h2>heading</h2>err</div>'
+               );
+       }
+
+       /**
+        * @covers Html::successBox
+        * @covers Html::messageBox
+        */
+       public function testSuccessBox() {
+               $this->assertEquals(
+                       Html::successBox( 'great' ),
+                       '<div class="successbox">great</div>'
+               );
+               $this->assertEquals(
+                       Html::successBox( '<script>beware no escaping!</script>' ),
+                       '<div class="successbox"><script>beware no escaping!</script></div>'
+               );
+       }
+
        /**
         * List of input element types values introduced by HTML5
         * Full list at https://www.w3.org/TR/html-markup/input.html
@@ -584,7 +629,7 @@ class HtmlTest extends MediaWikiTestCase {
                ];
 
                # <button> specific handling
-               # see remarks on http://msdn.microsoft.com/en-us/library/ie/ms535211%28v=vs.85%29.aspx
+               # see remarks on https://msdn.microsoft.com/library/ms535211(v=vs.85).aspx
                $cases[] = [ '<button type="submit"></button>',
                        'button', [ 'type' => 'submit' ],
                        'According to standard the default type is "submit". '
@@ -633,35 +678,6 @@ class HtmlTest extends MediaWikiTestCase {
                return $ret;
        }
 
-       /**
-        * @covers Html::expandAttributes
-        */
-       public function testFormValidationBlacklist() {
-               $this->assertEmpty(
-                       Html::expandAttributes( [
-                               'min' => 1,
-                               'max' => 100,
-                               'pattern' => 'abc',
-                               'required' => true,
-                               'step' => 2
-                       ] ),
-                       'Blacklist form validation attributes.'
-               );
-               $this->assertEquals(
-                       ' step="any"',
-                       Html::expandAttributes(
-                               [
-                                       'min' => 1,
-                                       'max' => 100,
-                                       'pattern' => 'abc',
-                                       'required' => true,
-                                       'step' => 'any'
-                               ],
-                               'Allow special case "step=any".'
-                       )
-               );
-       }
-
        public function testWrapperInput() {
                $this->assertEquals(
                        '<input type="radio" value="testval" name="testname"/>',