提交 1de47a0d 编写于 作者: S Santiago Pastorino

button_tag should escape it content

上级 20897a6c
...@@ -457,7 +457,7 @@ def button_tag(label = "Button", options = {}) ...@@ -457,7 +457,7 @@ def button_tag(label = "Button", options = {})
options[option] = "button" unless options[option] options[option] = "button" unless options[option]
end end
content_tag :button, label.to_s.html_safe, { "type" => options.delete("type") }.update(options) content_tag :button, label, { "type" => options.delete("type") }.update(options)
end end
# Displays an image which when clicked will submit the form. # Displays an image which when clicked will submit the form.
......
...@@ -413,6 +413,13 @@ def test_button_tag_with_disabled_option ...@@ -413,6 +413,13 @@ def test_button_tag_with_disabled_option
) )
end end
def test_button_tag_escape_content
assert_dom_equal(
%(<button name="button" type="reset" disabled="disabled">&lt;b&gt;Reset&lt;/b&gt;</button>),
button_tag("<b>Reset</b>", :type => "reset", :disabled => true)
)
end
def test_image_submit_tag_with_confirmation def test_image_submit_tag_with_confirmation
assert_dom_equal( assert_dom_equal(
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />), %(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册