1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #4804 from rafaelfranca/check_box-fix

check_box with nil as unchecked value should be HTML safe
This commit is contained in:
José Valim 2012-02-01 10:10:53 -08:00
commit 049dc500b6
2 changed files with 5 additions and 1 deletions

View file

@ -25,7 +25,7 @@ module ActionView
add_default_name_and_id(options)
end
hidden = @unchecked_value ? tag("input", "name" => options["name"], "type" => "hidden", "value" => @unchecked_value, "disabled" => options["disabled"]) : ""
hidden = @unchecked_value ? tag("input", "name" => options["name"], "type" => "hidden", "value" => @unchecked_value, "disabled" => options["disabled"]) : "".html_safe
checkbox = tag("input", options)
hidden + checkbox
end

View file

@ -398,6 +398,10 @@ class FormHelperTest < ActionView::TestCase
)
end
def test_check_box_with_nil_unchecked_value_is_html_safe
assert check_box("post", "secret", {}, "on", nil).html_safe?
end
def test_check_box_with_multiple_behavior
@post.comment_ids = [2,3]
assert_dom_equal(