Skip to content

Commit

Permalink
Template for file input already has the type in the string, removing the
Browse files Browse the repository at this point in the history
option so that it does not appear twice
  • Loading branch information
lorenzo committed Feb 23, 2014
1 parent 2a35a74 commit 6a72a8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/View/Helper/FormHelper.php
Expand Up @@ -1311,6 +1311,7 @@ public function file($fieldName, $options = array()) {
);
}

unset($options['type']);
return $this->widget('file', $options);
}

Expand Down
18 changes: 9 additions & 9 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2499,27 +2499,27 @@ public function testInputCustomization() {

$result = $this->Form->input('Contact.5.email', array('type' => 'text'));
$expected = array(
'div' => array('class' => 'input text'),
'label' => array('for' => 'Contact5Email'),
'div' => array('class' => 'text'),
'label' => array('for' => 'contact-5-email'),
'Email',
'/label',
array('input' => array(
'type' => 'text', 'name' => 'Contact[5][email]',
'id' => 'Contact5Email'
'id' => 'contact-5-email', 'maxlength' => '255'
)),
'/div'
);
$this->assertTags($result, $expected);

$result = $this->Form->input('Contact.password');
$expected = array(
'div' => array('class' => 'input password'),
'label' => array('for' => 'ContactPassword'),
'div' => array('class' => 'password'),
'label' => array('for' => 'contact-password'),
'Password',
'/label',
array('input' => array(
'type' => 'password', 'name' => 'Contact[password]',
'id' => 'ContactPassword'
'id' => 'contact-password'
)),
'/div'
);
Expand All @@ -2529,13 +2529,13 @@ public function testInputCustomization() {
'type' => 'file', 'class' => 'textbox'
));
$expected = array(
'div' => array('class' => 'input file'),
'label' => array('for' => 'ContactEmail'),
'div' => array('class' => 'file'),
'label' => array('for' => 'contact-email'),
'Email',
'/label',
array('input' => array(
'type' => 'file', 'name' => 'Contact[email]', 'class' => 'textbox',
'id' => 'ContactEmail'
'id' => 'contact-email'
)),
'/div'
);
Expand Down

0 comments on commit 6a72a8b

Please sign in to comment.