Mark the result of grouped_options_for_select as HTML safe [#4322 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
This commit is contained in:
parent
66b55dbfea
commit
001ca893c6
|
@ -444,7 +444,7 @@ module ActionView
|
|||
body << content_tag(:optgroup, options_for_select(group[1], selected_key), :label => group[0])
|
||||
end
|
||||
|
||||
body
|
||||
body.html_safe
|
||||
end
|
||||
|
||||
# Returns a string of option tags for pretty much any time zone in the
|
||||
|
|
|
@ -207,6 +207,10 @@ class FormOptionsHelperTest < ActionView::TestCase
|
|||
)
|
||||
end
|
||||
|
||||
def test_grouped_options_for_select_returns_html_safe_string
|
||||
assert grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]]).html_safe?
|
||||
end
|
||||
|
||||
def test_optgroups_with_with_options_with_hash
|
||||
assert_dom_equal(
|
||||
"<optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>\n<option value=\"Germany\">Germany</option></optgroup><optgroup label=\"North America\"><option value=\"United States\">United States</option>\n<option value=\"Canada\">Canada</option></optgroup>",
|
||||
|
|
Loading…
Reference in New Issue