Adding 'style' as a known html attribute. Fixes #1573

This commit is contained in:
mark_story 2011-03-07 21:58:11 -05:00
parent 2e76d32cf9
commit 7853189328
2 changed files with 6 additions and 3 deletions

View file

@ -428,7 +428,10 @@ class JsHelper extends AppHelper {
* @access protected
*/
function _getHtmlOptions($options, $additional = array()) {
$htmlKeys = array_merge(array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title'), $additional);
$htmlKeys = array_merge(
array('class', 'id', 'escape', 'onblur', 'onfocus', 'rel', 'title', 'style'),
$additional
);
$htmlOptions = array();
foreach ($htmlKeys as $key) {
if (isset($options[$key])) {

View file

@ -402,7 +402,7 @@ CODE;
function testSubmitWithMock() {
$this->_useMock();
$options = array('update' => '#content', 'id' => 'test-submit');
$options = array('update' => '#content', 'id' => 'test-submit', 'style' => 'margin: 0');
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeform', '*'));
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'serialize-code', array('serializeForm', '*'));
$this->Js->TestJsEngine->setReturnValue('dispatchMethod', 'ajax-code', array('request', '*'));
@ -422,7 +422,7 @@ CODE;
$result = $this->Js->submit('Save', $options);
$expected = array(
'div' => array('class' => 'submit'),
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save'),
'input' => array('type' => 'submit', 'id' => $options['id'], 'value' => 'Save', 'style' => 'margin: 0'),
'/div'
);
$this->assertTags($result, $expected);