From: jeroendedauw Date: Fri, 5 Oct 2012 13:54:58 +0000 (+0200) Subject: Fix behaviour of namespaceSelector to match the documentation X-Git-Tag: 1.31.0-rc.0~22126^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=37d9c1a6dcdb1605918a891f0320c23c0c41b4d9;p=lhc%2Fweb%2Fwiklou.git Fix behaviour of namespaceSelector to match the documentation Change-Id: I3d1bb232905095ae2d5177adc225025178d5f5a3 --- diff --git a/includes/Html.php b/includes/Html.php index 9fcdc521bd..f4a3b55571 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -810,6 +810,14 @@ class Html { ); } + if ( !array_key_exists( 'id', $selectAttribs ) ) { + $selectAttribs['id'] = 'namespace'; + } + + if ( !array_key_exists( 'name', $selectAttribs ) ) { + $selectAttribs['name'] = 'namespace'; + } + $ret = ''; if ( isset( $params['label'] ) ) { $ret .= Html::element( diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index 6e936aac80..05dea35d81 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -239,7 +239,7 @@ class HtmlTest extends MediaWikiTestCase { function testNamespaceSelector() { $this->assertEquals( - '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . @@ -290,8 +290,8 @@ class HtmlTest extends MediaWikiTestCase { ); $this->assertEquals( - ' ' . -'' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . @@ -318,7 +318,7 @@ class HtmlTest extends MediaWikiTestCase { function testCanFilterOutNamespaces() { $this->assertEquals( -'' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . @@ -340,7 +340,7 @@ class HtmlTest extends MediaWikiTestCase { function testCanDisableANamespaces() { $this->assertEquals( -'' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" .