diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-13 22:44:45 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-13 22:44:45 +0000 |
commit | acb80e3d0e96725fffad7caa42cc33281714450a (patch) | |
tree | d5ebf2775c3521d34b18da308a215d3a09c5ed6f /actionpack/test/template | |
parent | 2cad95d851ae72dadc1479ea2a21cd056dc8f06e (diff) | |
download | rails-acb80e3d0e96725fffad7caa42cc33281714450a.tar.gz rails-acb80e3d0e96725fffad7caa42cc33281714450a.tar.bz2 rails-acb80e3d0e96725fffad7caa42cc33281714450a.zip |
Escape query strings in the href attribute of URLs created by url_helper. #2333
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2572 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index e85f710c44..78ad185542 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -25,6 +25,14 @@ class UrlHelperTest < Test::Unit::TestCase assert_dom_equal "<form method=\"post\" action=\"http://www.example.com\" class=\"button-to\"><div><input type=\"submit\" value=\"Hello\" /></div></form>", button_to("Hello", "http://www.example.com") end + def test_button_to_with_query + assert_dom_equal "<form method=\"post\" action=\"http://www.example.com/q1=v1&q2=v2\" class=\"button-to\"><div><input type=\"submit\" value=\"Hello\" /></div></form>", button_to("Hello", "http://www.example.com/q1=v1&q2=v2") + end + + def test_button_to_with_query_and_no_name + assert_dom_equal "<form method=\"post\" action=\"http://www.example.com?q1=v1&q2=v2\" class=\"button-to\"><div><input type=\"submit\" value=\"http://www.example.com?q1=v1&q2=v2\" /></div></form>", button_to(nil, "http://www.example.com?q1=v1&q2=v2") + end + def test_button_to_with_javascript_confirm assert_dom_equal( "<form method=\"post\" action=\"http://www.example.com\" class=\"button-to\"><div><input onclick=\"return confirm('Are you sure?');\" type=\"submit\" value=\"Hello\" /></div></form>", @@ -47,6 +55,14 @@ class UrlHelperTest < Test::Unit::TestCase assert_dom_equal "<a href=\"http://www.example.com\">Hello</a>", link_to("Hello", "http://www.example.com") end + def test_link_tag_with_query + assert_dom_equal "<a href=\"http://www.example.com?q1=v1&q2=v2\">Hello</a>", link_to("Hello", "http://www.example.com?q1=v1&q2=v2") + end + + def test_link_tag_with_query_and_no_name + assert_dom_equal "<a href=\"http://www.example.com?q1=v1&q2=v2\">http://www.example.com?q1=v1&q2=v2</a>", link_to(nil, "http://www.example.com?q1=v1&q2=v2") + end + def test_link_tag_with_custom_onclick assert_dom_equal "<a href=\"http://www.example.com\" onclick=\"alert('yay!')\">Hello</a>", link_to("Hello", "http://www.example.com", :onclick => "alert('yay!')") end |