Adding test case for FormHelper::input() for generation multiple checkboxes with space in option values. Refs #1465

This commit is contained in:
ADmad 2011-01-19 02:25:39 +05:30
parent 932533c5c8
commit d4e4957563

View file

@ -2173,6 +2173,35 @@ class FormHelperTest extends CakeTestCase {
'/div'
);
$this->assertTags($result, $expected);
$this->Form->data = array();
$result = $this->Form->input('Publisher.id', array(
'label' => 'Publisher',
'type' => 'select',
'multiple' => 'checkbox',
'options' => array('Value 1' => 'Label 1', 'Value 2' => 'Label 2')
));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => 'PublisherId')),
'Publisher',
'/label',
'input' => array('type' => 'hidden', 'name' => 'data[Publisher][id]', 'value' => '', 'id' => 'PublisherId'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Publisher][id][]', 'value' => 'Value 1', 'id' => 'PublisherIdValue1')),
array('label' => array('for' => 'PublisherIdValue1')),
'Label 1',
'/label',
'/div',
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Publisher][id][]', 'value' => 'Value 2', 'id' => 'PublisherIdValue2')),
array('label' => array('for' => 'PublisherIdValue2')),
'Label 2',
'/label',
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**