mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't use html_escape
to test the escaping
This commit is contained in:
parent
39f4f28993
commit
5edfc46348
4 changed files with 4 additions and 4 deletions
|
@ -1124,7 +1124,7 @@ class FormOptionsHelperTest < ActionView::TestCase
|
|||
|
||||
def test_options_for_select_with_element_attributes
|
||||
assert_dom_equal(
|
||||
"<option value=\"<Denmark>\" class=\"bold\"><Denmark></option>\n<option value=\"USA\" onclick=\"" + ERB::Util.html_escape("alert('Hello World');") + "\">USA</option>\n<option value=\"Sweden\">Sweden</option>\n<option value=\"Germany\">Germany</option>",
|
||||
"<option value=\"<Denmark>\" class=\"bold\"><Denmark></option>\n<option value=\"USA\" onclick=\"alert('Hello World');\">USA</option>\n<option value=\"Sweden\">Sweden</option>\n<option value=\"Germany\">Germany</option>",
|
||||
options_for_select([ [ "<Denmark>", { :class => 'bold' } ], [ "USA", { :onclick => "alert('Hello World');" } ], [ "Sweden" ], "Germany" ])
|
||||
)
|
||||
end
|
||||
|
|
|
@ -379,7 +379,7 @@ class FormTagHelperTest < ActionView::TestCase
|
|||
|
||||
def test_submit_tag
|
||||
assert_dom_equal(
|
||||
%(<input name='commit' data-disable-with="Saving..." onclick=") + ERB::Util.html_escape("alert('hello!')") + %(" type="submit" value="Save" />),
|
||||
%(<input name='commit' data-disable-with="Saving..." onclick="alert('hello!')" type="submit" value="Save" />),
|
||||
submit_tag("Save", :onclick => "alert('hello!')", :data => { :disable_with => "Saving..." })
|
||||
)
|
||||
end
|
||||
|
|
|
@ -149,7 +149,7 @@ class TextHelperTest < ActionView::TestCase
|
|||
end
|
||||
|
||||
def test_truncate_with_block_should_escape_the_block
|
||||
assert_equal "Here is a long test and ...<script>" + ERB::Util.html_escape("alert('foo');") + "</script>",
|
||||
assert_equal "Here is a long test and ...<script>alert('foo');</script>",
|
||||
truncate("Here is a long test and I need a continue to read link", :length => 27) { "<script>alert('foo');</script>" }
|
||||
end
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ class UrlHelperTest < ActiveSupport::TestCase
|
|||
|
||||
def test_link_tag_with_custom_onclick
|
||||
link = link_to("Hello", "http://www.example.com", :onclick => "alert('yay!')")
|
||||
expected = %{<a href="http://www.example.com" onclick="} + ERB::Util.html_escape("alert('yay!')") + %{">Hello</a>}
|
||||
expected = %{<a href="http://www.example.com" onclick="alert('yay!')">Hello</a>}
|
||||
assert_dom_equal expected, link
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue