Skip to content

Commit

Permalink
Adding each() to prototype engine
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 28, 2009
1 parent 55eafaf commit 768941b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cake/libs/view/helpers/prototype_engine.php
Expand Up @@ -99,7 +99,7 @@ function domReady($functionBody) {
* @return string completed iteration
**/
function each($callback) {

return $this->selection . '.each(function (item, index) {' . $callback . '});';
}
/**
* Trigger an Effect.
Expand Down
4 changes: 3 additions & 1 deletion cake/tests/cases/libs/view/helpers/prototype_engine.test.php
Expand Up @@ -104,7 +104,9 @@ function testDomReady() {
* @return void
**/
function testEach() {

$result = $this->Proto->get('#foo li')->each('item.hide();');
$expected = '$$("#foo li").each(function (item, index) {item.hide();});';
$this->assertEqual($result, $expected);
}
/**
* test Effect generation
Expand Down

0 comments on commit 768941b

Please sign in to comment.