aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/url_helper_test.rb
diff options
context:
space:
mode:
authorMax Lapshin <max@maxidoors.ru>2009-03-16 18:20:15 +0300
committerPratik Naik <pratiknaik@gmail.com>2009-08-10 00:58:40 +0100
commit0af4b0755f507d41590b5315966c9a20949f79f9 (patch)
tree3b11dce6f30360286de233f76714b43f8a8e8f3d /actionpack/test/template/url_helper_test.rb
parenta0f69722be00cd546558b067054e9e7ae2564274 (diff)
downloadrails-0af4b0755f507d41590b5315966c9a20949f79f9.tar.gz
rails-0af4b0755f507d41590b5315966c9a20949f79f9.tar.bz2
rails-0af4b0755f507d41590b5315966c9a20949f79f9.zip
Make sure link_to generates the form with the specified :href if any [#2254 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r--actionpack/test/template/url_helper_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index 9eeb26831c..0e24fbd24d 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -220,6 +220,14 @@ class UrlHelperTest < ActionView::TestCase
)
end
+ def test_link_tag_using_delete_javascript_and_href_and_confirm
+ assert_dom_equal(
+ "<a href='\#' onclick=\"if (confirm('Are you serious?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = 'http://www.example.com';var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); };return false;\">Destroy</a>",
+ link_to("Destroy", "http://www.example.com", :method => :delete, :href => '#', :confirm => "Are you serious?"),
+ "When specifying url, form should be generated with it, but not this.href"
+ )
+ end
+
def test_link_tag_using_post_javascript_and_popup
assert_raise(ActionView::ActionViewError) { link_to("Hello", "http://www.example.com", :popup => true, :method => :post, :confirm => "Are you serious?") }
end