From 43c470fae468ef63e0d5c3dc1e202925685fd47b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Jun 2005 06:17:51 +0000 Subject: Added button_to as a form-based solution to deal with harmful actions that should be hidden behind POSTs. This makes it just as easy as link_to to create a safe trigger for actions like destroy, although it's limited by being a block element, the fixed look, and a no-no inside other forms. #1371 [tom@moertel.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1437 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/url_helper_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'actionpack/test/template/url_helper_test.rb') diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index b1f2dd65e9..f208466118 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -21,6 +21,28 @@ class UrlHelperTest < Test::Unit::TestCase end # todo: missing test cases + def test_button_to_with_straight_url + assert_equal "
", button_to("Hello", "http://www.example.com") + end + + def test_button_to_with_javascript_confirm + assert_equal( + "
", + button_to("Hello", "http://www.example.com", :confirm => "Are you sure?") + ) + end + + def test_button_to_enabled_disabled + assert_equal( + "
", + button_to("Hello", "http://www.example.com", :disabled => false) + ) + assert_equal( + "
", + button_to("Hello", "http://www.example.com", :disabled => true) + ) + end + def test_link_tag_with_straight_url assert_equal "Hello", link_to("Hello", "http://www.example.com") end -- cgit v1.2.3