Adding test to show that select() doesn't always auto select options named 'Array'. Disproves #412

This commit is contained in:
Mark Story 2010-03-12 23:17:11 -05:00
parent 677ff2d8b7
commit e304c48ec4

View file

@ -3237,6 +3237,36 @@ class FormHelperTest extends CakeTestCase {
'/div' '/div'
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Form->data = array('Model' => array('tags' => array(1)));
$result = $this->Form->select(
'Model.tags', array('1' => 'first', 'Array' => 'Array'), null, array('multiple' => 'checkbox')
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'
),
array('div' => array('class' => 'checkbox')),
array('input' => array(
'type' => 'checkbox', 'name' => 'data[Model][tags][]',
'value' => '1', 'id' => 'ModelTags1', 'checked' => 'checked'
)),
array('label' => array('for' => 'ModelTags1', 'class' => 'selected')),
'first',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array(
'type' => 'checkbox', 'name' => 'data[Model][tags][]',
'value' => 'Array', 'id' => 'ModelTagsArray'
)),
array('label' => array('for' => 'ModelTagsArray')),
'Array',
'/label',
'/div'
);
$this->assertTags($result, $expected);
} }
/** /**