Browse files

Merge branch '1.3' of git://github.com/cakephp/cakephp into 1.3

  • Loading branch information...
2 parents 2e55b85 + 197c9bf commit 87c659d653322f4d10943c0376e9b9582e782550 @ceeram ceeram committed Mar 3, 2011
Showing with 27 additions and 5 deletions.
  1. +1 −5 cake/libs/view/helpers/form.php
  2. +26 −0 cake/tests/cases/libs/view/helpers/form.test.php
View
6 cake/libs/view/helpers/form.php
@@ -363,10 +363,6 @@ function end($options = null) {
unset($options['label']);
}
$submitOptions = $options;
-
- if (!$submit) {
- $submit = __('Submit', true);
- }
}
$out .= $this->submit($submit, $submitOptions);
}
@@ -1309,7 +1305,7 @@ function button($title, $options = array()) {
* @link http://book.cakephp.org/view/1431/submit
*/
function submit($caption = null, $options = array()) {
- if (!$caption) {
+ if (!is_string($caption) && empty($caption)) {
$caption = __('Submit', true);
}
$out = null;
View
26 cake/tests/cases/libs/view/helpers/form.test.php
@@ -5284,6 +5284,14 @@ function testButton() {
* @return void
*/
function testSubmitButton() {
+ $result = $this->Form->submit('');
+ $expected = array(
+ 'div' => array('class' => 'submit'),
+ 'input' => array('type' => 'submit', 'value' => ''),
+ '/div'
+ );
+ $this->assertTags($result, $expected);
+
$result = $this->Form->submit('Test Submit');
$expected = array(
'div' => array('class' => 'submit'),
@@ -6333,6 +6341,24 @@ function testFormMagicInputLabel() {
function testFormEnd() {
$this->assertEqual($this->Form->end(), '</form>');
+ $result = $this->Form->end('');
+ $expected = array(
+ 'div' => array('class' => 'submit'),
+ 'input' => array('type' => 'submit', 'value' => ''),
+ '/div',
+ '/form'
+ );
+ $this->assertTags($result, $expected);
+
+ $result = $this->Form->end(array('label' => ''));
+ $expected = array(
+ 'div' => array('class' => 'submit'),
+ 'input' => array('type' => 'submit', 'value' => ''),
+ '/div',
+ '/form'
+ );
+ $this->assertTags($result, $expected);
+
$result = $this->Form->end('save');
$expected = array(
'div' => array('class' => 'submit'),

0 comments on commit 87c659d

Please sign in to comment.