Drop down lists: Do not use the value for 'other' as option group
Instead use them as groupless reason list Bug: T251351 Change-Id: Id691d97e3e6f205615f639e051619f3d0f67c7ba
This commit is contained in:
parent
b3eea91e21
commit
e878341bfc
2 changed files with 25 additions and 1 deletions
|
|
@ -555,7 +555,10 @@ class Xml {
|
|||
} elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
|
||||
# A new group is starting...
|
||||
$value = trim( substr( $value, 1 ) );
|
||||
$optgroup = $value;
|
||||
# Do not use the value for 'other' as option group - T251351
|
||||
$optgroup = isset( $params['other'] ) && $params['other'] === $value
|
||||
? false
|
||||
: $value;
|
||||
} elseif ( substr( $value, 0, 2 ) == '**' ) {
|
||||
# groupmember
|
||||
$opt = trim( substr( $value, 2 ) );
|
||||
|
|
|
|||
|
|
@ -534,6 +534,27 @@ class XmlTest extends MediaWikiIntegrationTestCase {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Xml::listDropDownOptions
|
||||
*/
|
||||
public function testListDropDownOptionsOthers() {
|
||||
// Do not use the value for 'other' as option group - T251351
|
||||
$this->assertEquals(
|
||||
[
|
||||
'other reasons' => 'other',
|
||||
'Foo 1' => 'Foo 1',
|
||||
'Example' => 'Example',
|
||||
'Bar' => [
|
||||
'Bar 1' => 'Bar 1',
|
||||
],
|
||||
],
|
||||
Xml::listDropDownOptions(
|
||||
"* other reasons\n** Foo 1\n** Example\n* Bar\n** Bar 1",
|
||||
[ 'other' => 'other reasons' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Xml::listDropDownOptionsOoui
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue