diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-06 01:31:04 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-09-06 01:31:04 +0000 |
commit | 8c9ce617c9989c74209235f68ba4497b905234fd (patch) | |
tree | 0956fcfd957e7fcd8ff3535ec46964b69053ebf5 /actionpack/test/template | |
parent | 7441b19d0c6f944b8547725f1f51349c79608576 (diff) | |
download | rails-8c9ce617c9989c74209235f68ba4497b905234fd.tar.gz rails-8c9ce617c9989c74209235f68ba4497b905234fd.tar.bz2 rails-8c9ce617c9989c74209235f68ba4497b905234fd.zip |
Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5039 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/javascript_helper_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index d186d11dd5..7cb08ec498 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -38,6 +38,12 @@ class JavaScriptHelperTest < Test::Unit::TestCase assert_dom_equal %(<a href="#" onclick="Element.update("header", "<h1>Greetings</h1>");; return false;">Greet me!</a>), html end + def test_link_to_function_with_rjs_block_and_options + html = link_to_function( "Greet me!", :class => "updater" ) do |page| + page.replace_html 'header', "<h1>Greetings</h1>" + end + assert_dom_equal %(<a href="#" class="updater" onclick="Element.update("header", "<h1>Greetings</h1>");; return false;">Greet me!</a>), html + end def test_button_to_function assert_dom_equal %(<input type="button" onclick="alert('Hello world!');" value="Greeting" />), @@ -50,4 +56,11 @@ class JavaScriptHelperTest < Test::Unit::TestCase end assert_dom_equal %(<input type="button" onclick="Element.update("header", "<h1>Greetings</h1>");;" value="Greet me!" />), html end + + def test_button_to_function_with_rjs_block_and_options + html = button_to_function( "Greet me!", :class => "greeter" ) do |page| + page.replace_html 'header', "<h1>Greetings</h1>" + end + assert_dom_equal %(<input type="button" class="greeter" onclick="Element.update("header", "<h1>Greetings</h1>");;" value="Greet me!" />), html + end end |