mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 18:42:40 +00:00
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5971 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d303a64f65
commit
18c916fc76
2 changed files with 8 additions and 11 deletions
|
@ -843,15 +843,6 @@ class FormHelper extends AppHelper {
|
|||
* @access public
|
||||
*/
|
||||
function hidden($fieldName, $options = array()) {
|
||||
/*$class = null;
|
||||
if (isset($options['class'])) {
|
||||
$class = $options['class'];
|
||||
}
|
||||
unset($options['class']);
|
||||
if (!empty($class)) {
|
||||
$options['class'] = $class;
|
||||
}*/
|
||||
|
||||
$options = $this->__initInputField($fieldName, $options);
|
||||
$model = $this->model();
|
||||
$value = '';
|
||||
|
@ -1247,7 +1238,6 @@ class FormHelper extends AppHelper {
|
|||
// build out an array version
|
||||
foreach ($elements as $element) {
|
||||
$selectAttrName = 'select' . $element . 'Attr';
|
||||
${$selectAttrName} = $selectAttr;
|
||||
${$selectAttrName}['id'] = $attributes['id'] . $element;
|
||||
}
|
||||
} elseif (is_array($attributes['id'])) {
|
||||
|
|
|
@ -392,6 +392,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
function testFormInput() {
|
||||
$result = $this->Form->input('Contact.email', array('id' => 'custom'));
|
||||
$expected = '<div class="input"><label for="custom">Email</label><input name="data[Contact][email]" type="text" id="custom" value="" /></div>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Form->hidden('Contact/idontexist');
|
||||
$expected = '<input type="hidden" name="data[Contact][idontexist]" value="" id="ContactIdontexist" />';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
@ -420,7 +424,9 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertPattern('/option value="12"/', $result[0]);
|
||||
$this->assertNoPattern('/option value="13"/', $result[0]);
|
||||
|
||||
$result = $this->Form->input('Model.field', array('type' => 'datetime', 'timeFormat' => 24));
|
||||
$result = $this->Form->input('Model.field', array('type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'));
|
||||
$this->assertPattern('/id="customIDDay"/', $result);
|
||||
$this->assertPattern('/id="customIDHour"/', $result);
|
||||
$result = explode('</select><select', $result);
|
||||
$result = explode(':', $result[1]);
|
||||
$this->assertPattern('/option value="23"/', $result[0]);
|
||||
|
@ -855,6 +861,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
|
||||
function testMonth() {
|
||||
$result = $this->Form->month('Model.field');
|
||||
$this->assertPattern('/^<select[^<>]+name="data\[Model\]\[field\]\[month\]"[^<>]*>/', $result);
|
||||
$this->assertPattern('/<option\s+value="01"[^>]*>January<\/option>\s+/i', $result);
|
||||
$this->assertPattern('/<option\s+value="02"[^>]*>February<\/option>\s+/i', $result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue