From 9d8e34808f0d20d4bbc1cfb0cdf294b35d8bd224 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 19 Apr 2006 18:08:15 +0000 Subject: Change link_to_function and button_to_function to (optionally) take an update_page block instead of a JavaScript string. Closes #4804. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/javascript_helper_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/test/template/javascript_helper_test.rb') diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index f0a405fae3..d186d11dd5 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -31,8 +31,23 @@ class JavaScriptHelperTest < Test::Unit::TestCase link_to_function("Greeting", "alert('Hello world!')", :onclick => "confirm('Sanity!')") end + def test_link_to_function_with_rjs_block + html = link_to_function( "Greet me!" ) do |page| + page.replace_html 'header', "

Greetings

" + end + assert_dom_equal %(Greet me!), html + end + + def test_button_to_function assert_dom_equal %(), button_to_function("Greeting", "alert('Hello world!')") end + + def test_button_to_function_with_rjs_block + html = button_to_function( "Greet me!" ) do |page| + page.replace_html 'header', "

Greetings

" + end + assert_dom_equal %(), html + end end -- cgit v1.2.3