Skip to content

Commit

Permalink
Add test for FormHelper::input() for hidden field.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Apr 25, 2014
1 parent 7e0e8d0 commit 42b4c9e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2195,6 +2195,30 @@ public function testInputCheckbox() {
$this->assertTags($result, $expected);
}

/**
* Test that input() does not create wrapping div and label tag for hidden fields
*
* @return void
*/
public function testInputHidden() {
TableRegistry::get('ValidateUsers', [
'className' => __NAMESPACE__ . '\ValidateUsersTable'
]);
$this->Form->create([], ['context' => ['table' => 'ValidateUsers']]);

$result = $this->Form->input('ValidateUser.id');
$expected = array(
'input' => array('name', 'type' => 'hidden', 'id')
);
$this->assertTags($result, $expected);

$result = $this->Form->input('ValidateUser.custom', ['type' => 'hidden']);
$expected = array(
'input' => array('name', 'type' => 'hidden', 'id')
);
$this->assertTags($result, $expected);
}

/**
* test form->input() with datetime
*
Expand Down

0 comments on commit 42b4c9e

Please sign in to comment.