Permalink
Browse files

Resolves ticket #4100

  • Loading branch information...
dereuromark committed Sep 25, 2013
1 parent c713927 commit 2455af09c54a41a5d10f27040be9b313d6d35872
Showing with 35 additions and 1 deletion.
  1. +34 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  2. +1 −1 lib/Cake/View/Helper/FormHelper.php
@@ -3978,6 +3978,40 @@ public function testRadioDisabled() {
'/div'
);
$this->assertTags($result, $expected);
+
+ $result = $this->Form->input('Model.field', array(
+ 'type' => 'radio',
+ 'options' => array(
+ 1 => 'A',
+ 2 => 'B',
+ 3 => 'C'
+ ),
+ 'disabled' => array(1)
+ ));
+
+ $expected = array(
+ 'div' => array('class' => 'input radio'),
+ 'fieldset' => array(),
+ 'legend' => array(),
+ 'Field',
+ '/legend',
+ array('input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'id' => 'ModelField_', 'value' => '')),
+ array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField1', 'disabled' => 'disabled', 'value' => '1')),
+ array('label' => array('for' => 'ModelField1')),
+ 'A',
+ '/label',
+ array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField2', 'value' => '2')),
+ array('label' => array('for' => 'ModelField2')),
+ 'B',
+ '/label',
+ array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField3', 'value' => '3')),
+ array('label' => array('for' => 'ModelField3')),
+ 'C',
+ '/label',
+ '/fieldset',
+ '/div'
+ );
+ $this->assertTags($result, $expected);
}
/**
@@ -1506,7 +1506,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) {
}
foreach ($options as $optValue => $optTitle) {
- $optionsHere = array('value' => $optValue);
+ $optionsHere = array('value' => $optValue, 'disabled' => false);
if (isset($value) && strval($optValue) === strval($value)) {
$optionsHere['checked'] = 'checked';

0 comments on commit 2455af0

Please sign in to comment.