Permalink
Browse files

Minor refactoring and removal of duplicate test.

  • Loading branch information...
1 parent 2331cfd commit 44d7742b85926840a30a828af55079738c021282 @markstory markstory committed Oct 31, 2009
Showing with 7 additions and 22 deletions.
  1. +4 −11 cake/libs/view/helpers/form.php
  2. +3 −11 cake/tests/cases/libs/view/helpers/form.test.php
@@ -1193,7 +1193,7 @@ function submit($caption = null, $options = array()) {
$div = $options['div'];
unset($options['div']);
}
- $options += array('type' => 'submit');
+ $options += array('type' => 'submit', 'before' => null, 'after' => null);
$divOptions = array('tag' => 'div');
if ($div === true) {
@@ -1206,16 +1206,9 @@ function submit($caption = null, $options = array()) {
$divOptions = array_merge(array('class' => 'submit', 'tag' => 'div'), $div);
}
- $before = "";
- $after = "";
- if (isset($options['before'])) {
- $before = $options['before'];
- unset($options['before']);
- }
- if (isset($options['after'])) {
- $after = $options['after'];
- unset($options['after']);
- }
+ $before = $options['before'];
+ $after = $options['after'];
+ unset($options['before'], $options['after']);
if (strpos($caption, '://') !== false) {
unset($options['type']);
@@ -2724,7 +2724,7 @@ function testRadio() {
**/
function testRadioHiddenInputDisabling() {
$result = $this->Form->input('Model.1.field', array(
- 'type' => 'radio',
+ 'type' => 'radio',
'options' => array('option A'),
'hiddenField' => false
)
@@ -3370,7 +3370,7 @@ function testCheckboxHiddenDisabling() {
*/
function testCheckboxHiddenFieldOmission() {
$result = $this->Form->input('UserForm.something', array(
- 'type' => 'checkbox',
+ 'type' => 'checkbox',
'hiddenField' => false
)
);
@@ -4652,14 +4652,6 @@ function testSubmitButton() {
);
$this->assertTags($result, $expected);
- $result = $this->Form->submit('Next >', array('escape' => false));
- $expected = array(
- 'div' => array('class' => 'submit'),
- 'input' => array('type' => 'submit', 'value' => 'Next >'),
- '/div'
- );
- $this->assertTags($result, $expected);
-
$result = $this->Form->submit('Reset!', array('type' => 'reset'));
$expected = array(
'div' => array('class' => 'submit'),
@@ -4766,7 +4758,7 @@ function testSubmitImage() {
'/div'
);
$this->assertTags($result, $expected);
-
+
$result = $this->Form->submit('Not.an.image', array('before' => $before, 'after' => $after));
$expected = array(
'div' => array('class' => 'submit'),

0 comments on commit 44d7742

Please sign in to comment.