mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 19:16:16 +00:00
Adding domReady to prototype
This commit is contained in:
parent
8cc5990e09
commit
55eafaf112
2 changed files with 5 additions and 2 deletions
|
@ -88,7 +88,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
||||||
* @return string completed domReady method
|
* @return string completed domReady method
|
||||||
**/
|
**/
|
||||||
function domReady($functionBody) {
|
function domReady($functionBody) {
|
||||||
|
$this->selection = 'document';
|
||||||
|
return $this->event('dom:loaded', $functionBody, array('stop' => false));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create an iteration over the current selection result.
|
* Create an iteration over the current selection result.
|
||||||
|
|
|
@ -94,7 +94,9 @@ class PrototypeEngineHelperTestCase extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
function testDomReady() {
|
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
|
* test Each method
|
||||||
|
|
Loading…
Add table
Reference in a new issue