Merge branch '2.0-hiddenclass' into 2.0

This commit is contained in:
mark_story 2011-04-21 22:25:31 -04:00
commit dbb3149c08
2 changed files with 9 additions and 7 deletions

View file

@ -1238,7 +1238,7 @@ class FormHelper extends AppHelper {
$this->__secure(null, '' . $options['value']); $this->__secure(null, '' . $options['value']);
} }
return $this->Html->useTag('hidden', $options['name'], array_diff_key($options, array('name' => '', 'class' => ''))); return $this->Html->useTag('hidden', $options['name'], array_diff_key($options, array('name' => '')));
} }
/** /**

View file

@ -3687,7 +3687,7 @@ class FormHelperTest extends CakeTestCase {
'div' => false 'div' => false
)); ));
$expected = array( $expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'), 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'),
array('div' => array('class' => 'checkbox form-error')), array('div' => array('class' => 'checkbox form-error')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')), array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')),
array('label' => array('for' => 'ModelTags0')), array('label' => array('for' => 'ModelTags0')),
@ -3705,7 +3705,7 @@ class FormHelperTest extends CakeTestCase {
'div' => false 'div' => false
)); ));
$expected = array( $expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'), 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][tags]', 'value' => '', 'id' => 'ModelTags'),
array('div' => array('class' => 'mycheckbox form-error')), array('div' => array('class' => 'mycheckbox form-error')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')), array('input' => array('type' => 'checkbox', 'name' => 'data[Model][tags][]', 'value' => '0', 'id' => 'ModelTags0')),
array('label' => array('for' => 'ModelTags0')), array('label' => array('for' => 'ModelTags0')),
@ -3900,14 +3900,14 @@ class FormHelperTest extends CakeTestCase {
$this->Form->request->data['Model']['field'] = 'myvalue'; $this->Form->request->data['Model']['field'] = 'myvalue';
$result = $this->Form->checkbox('Model.field', array('id' => 'theID', 'value' => 'myvalue')); $result = $this->Form->checkbox('Model.field', array('id' => 'theID', 'value' => 'myvalue'));
$expected = array( $expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_'), 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_'),
array('input' => array('preg:/[^<]+/', 'value' => 'myvalue', 'id' => 'theID', 'checked' => 'checked', 'class' => 'form-error')) array('input' => array('preg:/[^<]+/', 'value' => 'myvalue', 'id' => 'theID', 'checked' => 'checked', 'class' => 'form-error'))
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$result = $this->Form->checkbox('Model.field', array('value' => 'myvalue')); $result = $this->Form->checkbox('Model.field', array('value' => 'myvalue'));
$expected = array( $expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'ModelField_'), 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'ModelField_'),
array('input' => array('preg:/[^<]+/', 'value' => 'myvalue', 'id' => 'ModelField', 'checked' => 'checked', 'class' => 'form-error')) array('input' => array('preg:/[^<]+/', 'value' => 'myvalue', 'id' => 'ModelField', 'checked' => 'checked', 'class' => 'form-error'))
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
@ -3915,7 +3915,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->request->data['Model']['field'] = ''; $this->Form->request->data['Model']['field'] = '';
$result = $this->Form->checkbox('Model.field', array('id' => 'theID')); $result = $this->Form->checkbox('Model.field', array('id' => 'theID'));
$expected = array( $expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_'), 'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_'),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => '1', 'id' => 'theID', 'class' => 'form-error')) array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => '1', 'id' => 'theID', 'class' => 'form-error'))
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
@ -5316,7 +5316,9 @@ class FormHelperTest extends CakeTestCase {
$this->Form->validationErrors['Model']['field'] = 1; $this->Form->validationErrors['Model']['field'] = 1;
$this->Form->request->data['Model']['field'] = 'test'; $this->Form->request->data['Model']['field'] = 'test';
$result = $this->Form->hidden('Model.field', array('id' => 'theID')); $result = $this->Form->hidden('Model.field', array('id' => 'theID'));
$this->assertTags($result, array('input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'id' => 'theID', 'value' => 'test'))); $this->assertTags($result, array(
'input' => array('type' => 'hidden', 'class' => 'form-error', 'name' => 'data[Model][field]', 'id' => 'theID', 'value' => 'test'))
);
} }
/** /**