Changes to make tests pass...

This commit is contained in:
Robert Sworder 2010-08-05 18:23:56 +01:00 committed by Mark Story
parent 148870f492
commit 115c6102b9
2 changed files with 9 additions and 7 deletions

View file

@ -718,7 +718,9 @@ class FormHelper extends AppHelper {
if (isset($options['options'])) {
$options['type'] = 'select';
} elseif (in_array($fieldKey, array('psword', 'passwd', 'password'))) {
$options['type'] = 'password';
$options['type'] = 'password';
} elseif (isset($options['checked'])) {
$options['type'] = 'checkbox';
} elseif (isset($this->fieldset[$modelKey]['fields'][$fieldKey])) {
$fieldDef = $this->fieldset[$modelKey]['fields'][$fieldKey];
$type = $fieldDef['type'];
@ -772,7 +774,7 @@ class FormHelper extends AppHelper {
}
$autoLength = (!array_key_exists('maxlength', $options) && isset($fieldDef['length']));
if ($autoLength && $options['type'] == 'text') {
if ($autoLength && $options['type'] == 'text') {
$options['maxlength'] = $fieldDef['length'];
}
if ($autoLength && $fieldDef['type'] == 'float') {

View file

@ -5958,18 +5958,18 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$result = $this->Form->input('User.stuff');
$result = $this->Form->input('UserForm.stuff');
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'UserStuff'),
'label' => array('for' => 'UserFormStuff'),
'Stuff',
'/label',
'input' => array(
'type' => 'text', 'name' => 'data[User][stuff]',
'id' => 'UserStuff', 'maxlength' => 10
'type' => 'text', 'name' => 'data[UserForm][stuff]',
'id' => 'UserFormStuff', 'maxlength' => 10
),
'/div'
);
);
$this->assertTags($result, $expected, true);
}