Adding domReady to prototype

This commit is contained in:
mark_story 2009-03-28 18:06:20 -04:00
parent 8cc5990e09
commit 55eafaf112
2 changed files with 5 additions and 2 deletions

View file

@ -88,7 +88,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
* @return string completed domReady method
**/
function domReady($functionBody) {
$this->selection = 'document';
return $this->event('dom:loaded', $functionBody, array('stop' => false));
}
/**
* Create an iteration over the current selection result.

View file

@ -94,7 +94,9 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
* @return void
**/
function testDomReady() {
$result = $this->Proto->domReady('foo.name = "bar";');
$expected = 'document.observe("dom:loaded", function (event) {foo.name = "bar";});';
$this->assertEqual($result, $expected);
}
/**
* test Each method