From 64a80ef756ae89e85470b598e9c09b66d50a8103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Mon, 15 Jan 2007 15:11:29 +0000 Subject: 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 --- actionpack/test/template/prototype_helper_test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'actionpack/test') 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' -- cgit v1.2.3