From 37d9c1a6dcdb1605918a891f0320c23c0c41b4d9 Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Fri, 5 Oct 2012 15:54:58 +0200 Subject: [PATCH] Fix behaviour of namespaceSelector to match the documentation Change-Id: I3d1bb232905095ae2d5177adc225025178d5f5a3 --- includes/Html.php | 8 ++++++++ tests/phpunit/includes/HtmlTest.php | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) 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" . -- 2.20.1