Permalink
Browse files

Make button type nullable.

Fixes #GH365
  • Loading branch information...
1 parent d46127e commit afecb713abdadb28063a11b6208104e8a6392c2e @markstory markstory committed Feb 14, 2012
View
3 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -5897,6 +5897,9 @@ public function testButton() {
$result = $this->Form->button('<Clear Form>', array('type' => 'reset', 'escape' => true));
$this->assertTags($result, array('button' => array('type' => 'reset'), '&lt;Clear Form&gt;', '/button'));
+ $result = $this->Form->button('No type', array('type' => false));
+ $this->assertTags($result, array('button' => array(), 'No type', '/button'));
+
$result = $this->Form->button('Upload Text', array('onClick' => "$('#postAddForm').ajaxSubmit({target: '#postTextUpload', url: '/posts/text'});return false;'", 'escape' => false));
$this->assertNotRegExp('/\&039/', $result);
}
View
2 lib/Cake/View/Helper/FormHelper.php
@@ -1548,7 +1548,7 @@ public function button($title, $options = array()) {
$name = str_replace(array('[', ']'), array('.', ''), $options['name']);
$this->_secure($options['secure'], $name);
}
- return $this->Html->useTag('button', $options['type'], array_diff_key($options, array('type' => '')), $title);
+ return $this->Html->useTag('button', $options, $title);
}
/**
View
2 lib/Cake/View/Helper/HtmlHelper.php
@@ -69,7 +69,7 @@ class HtmlHelper extends AppHelper {
'file_no_model' => '<input type="file" name="%s" %s/>',
'submit' => '<input %s/>',
'submitimage' => '<input type="image" src="%s" %s/>',
- 'button' => '<button type="%s"%s>%s</button>',
+ 'button' => '<button%s>%s</button>',
'image' => '<img src="%s" %s/>',
'tableheader' => '<th%s>%s</th>',
'tableheaderrow' => '<tr%s>%s</tr>',

0 comments on commit afecb71

Please sign in to comment.