aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/prototype_helper_test.rb
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2007-01-15 15:11:29 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2007-01-15 15:11:29 +0000
commit64a80ef756ae89e85470b598e9c09b66d50a8103 (patch)
treea024129109969f72bd8972d642e5ab904b9f9c10 /actionpack/test/template/prototype_helper_test.rb
parent67194d9c2df972f7483177b8a33356c344e56a88 (diff)
downloadrails-64a80ef756ae89e85470b598e9c09b66d50a8103.tar.gz
rails-64a80ef756ae89e85470b598e9c09b66d50a8103.tar.bz2
rails-64a80ef756ae89e85470b598e9c09b66d50a8103.zip
Allow inGroupsOf and eachSlice to be called through rjs. Closes #7046
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5942 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/prototype_helper_test.rb')
-rw-r--r--actionpack/test/template/prototype_helper_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index 7dc366b7d9..1b4f4408e3 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -423,6 +423,29 @@ return (value.className == "welcome");
EOS
end
+ def test_collection_proxy_with_in_groups_of
+ @generator.select('p').in_groups_of('a', 3)
+ @generator.select('p').in_groups_of('a', 3, 'x')
+ assert_equal <<-EOS.strip, @generator.to_s
+var a = $$("p").inGroupsOf(3);
+var a = $$("p").inGroupsOf(3, "x");
+ EOS
+ end
+
+ def test_collection_proxy_with_each_slice
+ @generator.select('p').each_slice('a', 3)
+ @generator.select('p').each_slice('a', 3) do |group, index|
+ group.reverse
+ end
+
+ assert_equal <<-EOS.strip, @generator.to_s
+var a = $$("p").eachSlice(3);
+var a = $$("p").eachSlice(3, function(value, index) {
+return value.reverse();
+});
+ EOS
+ end
+
def test_debug_rjs
ActionView::Base.debug_rjs = true
@generator['welcome'].replace_html 'Welcome'