aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/url_helper_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-06-23 17:11:01 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-06-23 17:11:01 +0000
commit4de8c63abbcaecbe72b925aedb8196c812463705 (patch)
tree4e6d1cbb5071c7f347ad971d75fb6366e47949bb /actionpack/test/template/url_helper_test.rb
parent4766f521ee183bf5cba66f0cdd88ec3f1d28d473 (diff)
downloadrails-4de8c63abbcaecbe72b925aedb8196c812463705.tar.gz
rails-4de8c63abbcaecbe72b925aedb8196c812463705.tar.bz2
rails-4de8c63abbcaecbe72b925aedb8196c812463705.zip
Fixed that link_to with an href of # when using :method will not allow for click-through without JavaScript (closes #7037) [stevenbristol/josh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r--actionpack/test/template/url_helper_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index 1a5521b3e4..32696165e9 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -158,6 +158,13 @@ class UrlHelperTest < Test::Unit::TestCase
)
end
+ def test_link_tag_using_delete_javascript_and_href
+ assert_dom_equal(
+ "<a href='\#' onclick=\"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 => '#')
+ )
+ end
+
def test_link_tag_using_post_javascript_and_confirm
assert_dom_equal(
"<a href=\"http://www.example.com\" onclick=\"if (confirm('Are you serious?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit(); };return false;\">Hello</a>",