diff --git a/cake/libs/view/helpers/prototype_engine.php b/cake/libs/view/helpers/prototype_engine.php index ea5304641..1ec594bba 100644 --- a/cake/libs/view/helpers/prototype_engine.php +++ b/cake/libs/view/helpers/prototype_engine.php @@ -164,14 +164,9 @@ class PrototypeEngineHelper extends JsBaseEngineHelper { $options = $this->_mapOptions('request', $options); $type = '.Request'; $data = null; - /*if (isset($options['type']) && strtolower($options['type']) == 'json') { - $type = '.JSON'; - if (!empty($options['data'])) { - $data = $this->object($options['data']); - unset($options['data']); - } + if (isset($options['type']) && strtolower($options['type']) == 'json') { unset($options['type']); - }*/ + } if (isset($options['update'])) { $url = '"' . str_replace('#', '', $options['update']) . '", ' . $url; $type = '.Updater'; diff --git a/cake/tests/cases/libs/view/helpers/prototype_engine.test.php b/cake/tests/cases/libs/view/helpers/prototype_engine.test.php index 485e60be2..df9a41856 100644 --- a/cake/tests/cases/libs/view/helpers/prototype_engine.test.php +++ b/cake/tests/cases/libs/view/helpers/prototype_engine.test.php @@ -196,32 +196,16 @@ class PrototypeEngineHelperTestCase extends CakeTestCase { $expected = 'var jsRequest = new Ajax.Updater("update-zone", "/people/edit/1", {method:"post", onComplete:doSuccess});'; $this->assertEqual($result, $expected); -/* $result = $this->Proto->request('/people/edit/1', array( + $result = $this->Proto->request('/people/edit/1', array( 'method' => 'post', 'complete' => 'doSuccess', 'error' => 'handleError', 'type' => 'json', 'data' => array('name' => 'jim', 'height' => '185cm') )); - $expected = 'var jsRequest = new Request.JSON({method:"post", onComplete:doSuccess, onFailure:handleError, url:"/people/edit/1"}).send({"name":"jim","height":"185cm"});'; + $expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:doSuccess, onFailure:handleError, parameters:{"name":"jim","height":"185cm"}});'; $this->assertEqual($result, $expected); - $result = $this->Proto->request('/people/edit/1', array( - 'method' => 'post', - 'complete' => 'doSuccess', - 'update' => '#update-zone' - )); - $expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:doSuccess, update:"update-zone", url:"/people/edit/1"}).send();'; - $this->assertEqual($result, $expected); - - $result = $this->Proto->request('/people/edit/1', array( - 'method' => 'post', - 'complete' => 'doSuccess', - 'update' => 'update-zone' - )); - $expected = 'var jsRequest = new Request.HTML({method:"post", onComplete:doSuccess, update:"update-zone", url:"/people/edit/1"}).send();'; - $this->assertEqual($result, $expected); - */ } /** * test sortable list generation