aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-07-22 08:10:31 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-07-22 08:10:31 -0700
commit440a5ebd7a72fca1e655e5f4ff98435eddc4750a (patch)
tree7286d4bc175cde9b655d10125ed8131f1476f131 /actionpack/test/template
parent1b2a7bad671cf39252dc539a673cd217a25235a8 (diff)
parentdacbcbe55745aa9e5484b10b11f65ccca7db1c54 (diff)
downloadrails-440a5ebd7a72fca1e655e5f4ff98435eddc4750a.tar.gz
rails-440a5ebd7a72fca1e655e5f4ff98435eddc4750a.tar.bz2
rails-440a5ebd7a72fca1e655e5f4ff98435eddc4750a.zip
Merge pull request #7123 from nashby/data-in-options
don't escape options in option_html_attributes method
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_options_helper_test.rb21
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=\"&lt;Denmark&gt;\" data-test=\"bold\">&lt;Denmark&gt;</option>",
+ options_for_select([ [ "<Denmark>", { :data => { :test => 'bold' } } ] ])
+ )
+ end
+
def test_options_for_select_with_element_attributes_and_selection
assert_dom_equal(
"<option value=\"&lt;Denmark&gt;\">&lt;Denmark&gt;</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=\"&lt;Denmark&gt;\" onclick=\"alert(&quot;&lt;code&gt;&quot;)\">&lt;Denmark&gt;</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(&quot;&lt;code&gt;&quot;)"},
- option_html_attributes([ 'foo', 'bar', { :onclick => %(alert("<code>")) } ])
- )
- end
-
def test_grouped_collection_select
@post = Post.new
@post.origin = 'dk'