Skip to content

Commit

Permalink
Add test for multiple=false input.
Browse files Browse the repository at this point in the history
Refs #11771
  • Loading branch information
markstory committed Mar 2, 2018
1 parent 2b5fc9e commit 3427600
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/FormHelper.php
Expand Up @@ -1288,7 +1288,7 @@ protected function _magicOptions($fieldName, $options, $allowOverride)

if ($allowOverride && substr($fieldName, -5) === '._ids') {
$options['type'] = 'select';
if ( (!isset($options['multiple']) || ($options['multiple'] && $options['multiple'] != 'checkbox')) ) {
if ((!isset($options['multiple']) || ($options['multiple'] && $options['multiple'] != 'checkbox'))) {
$options['multiple'] = true;
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -5033,6 +5033,13 @@ public function testSelectMultiple()
['multiple' => 'multiple', 'form' => 'my-form']
);
$this->assertHtml($expected, $result);

$result = $this->Form->select(
'Model.multi_field',
$options,
['form' => 'my-form', 'multiple' => false]
);
$this->assertNotContains('multiple', $result);
}

/**
Expand Down

0 comments on commit 3427600

Please sign in to comment.