diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2012-07-21 13:34:03 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2012-07-22 11:37:54 +0300 |
commit | dacbcbe55745aa9e5484b10b11f65ccca7db1c54 (patch) | |
tree | 9fb1d84730a91563fe135922c5d3e65dba221e91 /actionpack/test | |
parent | 98f4aee8dac22d9e9bb3c122b43e9e5ee8ba7d1c (diff) | |
download | rails-dacbcbe55745aa9e5484b10b11f65ccca7db1c54.tar.gz rails-dacbcbe55745aa9e5484b10b11f65ccca7db1c54.tar.bz2 rails-dacbcbe55745aa9e5484b10b11f65ccca7db1c54.zip |
don't escape options in option_html_attributes method
we don't need to escape values in this method as we pass
these html attributes to `tag_options` method that handle escaping as
well.
it fixes the case when we want to pass html5 data options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 2322fb0406..96d99367be 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -1130,6 +1130,13 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_options_for_select_with_data_element + assert_dom_equal( + "<option value=\"<Denmark>\" data-test=\"bold\"><Denmark></option>", + options_for_select([ [ "<Denmark>", { :data => { :test => 'bold' } } ] ]) + ) + end + def test_options_for_select_with_element_attributes_and_selection assert_dom_equal( "<option value=\"<Denmark>\"><Denmark></option>\n<option value=\"USA\" class=\"bold\" selected=\"selected\">USA</option>\n<option value=\"Sweden\">Sweden</option>", @@ -1144,6 +1151,13 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_options_for_select_with_special_characters + assert_dom_equal( + "<option value=\"<Denmark>\" onclick=\"alert("<code>")\"><Denmark></option>", + options_for_select([ [ "<Denmark>", { :onclick => %(alert("<code>")) } ] ]) + ) + end + def test_option_html_attributes_from_without_hash assert_equal( {}, @@ -1172,13 +1186,6 @@ class FormOptionsHelperTest < ActionView::TestCase ) end - def test_option_html_attributes_with_special_characters - assert_equal( - {:onclick => "alert("<code>")"}, - option_html_attributes([ 'foo', 'bar', { :onclick => %(alert("<code>")) } ]) - ) - end - def test_grouped_collection_select @post = Post.new @post.origin = 'dk' |