Fixing typo in prototype engine helper. Fixes #172

This commit is contained in:
mark_story 2009-10-15 11:09:13 -04:00
parent 38f65bdc24
commit 906eb82e9b
2 changed files with 13 additions and 2 deletions

View file

@ -37,7 +37,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
**/
var $_optionMap = array(
'request' => array(
'async' => 'asyncrhronous',
'async' => 'asynchronous',
'data' => 'parameters',
'before' => 'onCreate',
'success' => 'onSuccess',

View file

@ -227,7 +227,7 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
));
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:doSuccess, onFailure:handleError, parameters:$("element").serialize()});';
$this->assertEqual($result, $expected);
$result = $this->Proto->request('/people/edit/1', array(
'method' => 'post',
'before' => 'doBefore();',
@ -237,6 +237,17 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
));
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {method:"post", onComplete:function (transport) {doComplete();}, onCreate:function (transport) {doBefore();}, onFailure:function (response, jsonHeader) {handleError();}, onSuccess:function (response, jsonHeader) {doSuccess();}});';
$this->assertEqual($result, $expected);
$result = $this->Proto->request('/people/edit/1', array(
'async' => false,
'method' => 'post',
'before' => 'doBefore();',
'success' => 'doSuccess();',
'complete' => 'doComplete();',
'error' => 'handleError();',
));
$expected = 'var jsRequest = new Ajax.Request("/people/edit/1", {asynchronous:false, method:"post", onComplete:function (transport) {doComplete();}, onCreate:function (transport) {doBefore();}, onFailure:function (response, jsonHeader) {handleError();}, onSuccess:function (response, jsonHeader) {doSuccess();}});';
$this->assertEqual($result, $expected);
}
/**