From ebdb766e7956520e9e5a784e280a8f1916f50511 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Feb 2006 18:48:08 +0000 Subject: Added element and collection proxies to RJS [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3587 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/prototype_helper_test.rb | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index fc4ebeccc3..8657b1f107 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -227,4 +227,27 @@ new Insertion.Bottom("element", "

This is a test

"); Element.update("baz", "

This is a test

"); EOS end -end + + def test_element_access + assert_equal %($('hello');), @generator['hello'] + end + + def test_element_proxy_one_deep + @generator['hello'].hide + assert_equal %($('hello').hide();), @generator.to_s + end + + def test_element_proxy_two_deep + @generator['hello'].hide("first").display + assert_equal %($('hello').hide("first").display();), @generator.to_s + end + + def test_select_access + assert_equal %($$('div.hello');), @generator.select('div.hello') + end + + def test_select_proxy_one_deep + @generator.select('p.welcome b').first.hide + assert_equal %($$('p.welcome b').first().hide();), @generator.to_s + end +end \ No newline at end of file -- cgit v1.2.3