diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/tag_helper_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb index 8611f4c9bd..bda57c4e9b 100644 --- a/actionpack/test/template/tag_helper_test.rb +++ b/actionpack/test/template/tag_helper_test.rb @@ -39,6 +39,10 @@ class TagHelperTest < Test::Unit::TestCase assert_equal "<![CDATA[<hello world>]]>", cdata_section("<hello world>") end + def test_escape_once + assert_equal '1 < 2 & 3', escape_once('1 < 2 & 3') + end + def test_double_escaping_attributes ['1&2', '1 < 2', '“test“'].each do |escaped| assert_equal %(<a href="#{escaped}" />), tag('a', :href => escaped) diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 77ca8094f7..ba813f72ce 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -38,6 +38,10 @@ class UrlHelperTest < Test::Unit::TestCase 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_escaped_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 |