Skip to content
Permalink
Browse files

Add test case for FormHelper::checkbox().

  • Loading branch information...
ADmad committed Feb 22, 2014
1 parent b850f9f commit 4e68d0532b7f0d22fef86b0c4771141bd13b8753
Showing with 40 additions and 0 deletions.
  1. +40 −0 tests/TestCase/View/Helper/FormHelperTest.php
@@ -4147,6 +4147,46 @@ public function testRadio() {
$this->assertTags($result, $expected);
}
/**
* test generating radio input inside label ala twitter bootstrap
*
* @return void
*/
public function testRadioInputInsideLabel() {
$this->Form->templates([
'label' => '<label{{attrs}}>{{input}}{{text}}</label>',
'radioContainer' => '{{label}}'
]);
$result = $this->Form->radio('Model.field', ['option A', 'option B']);
$expected = [
['input' => [
'type' => 'hidden',
'name' => 'Model[field]',
'value' => ''
]],
['label' => ['for' => 'model-field-0']],
['input' => [
'type' => 'radio',
'name' => 'Model[field]',
'value' => '0',
'id' => 'model-field-0'
]],
'option A',
'/label',
['label' => ['for' => 'model-field-1']],
['input' => [
'type' => 'radio',
'name' => 'Model[field]',
'value' => '1',
'id' => 'model-field-1'
]],
'option B',
'/label',
];
$this->assertTags($result, $expected);
}
/**
* test disabling the hidden input for radio buttons
*

0 comments on commit 4e68d05

Please sign in to comment.
You can’t perform that action at this time.