diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-03-09 06:48:04 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-03-09 12:05:30 -0300 |
commit | a0c3c1e1f796c215685e4e4bcd3e8c9178936492 (patch) | |
tree | c087966eeeb35318a59eead42e427b8af93643b7 /actionpack/test/template | |
parent | 348d693c6a846994f0f06ce307f23374101b25f6 (diff) | |
download | rails-a0c3c1e1f796c215685e4e4bcd3e8c9178936492.tar.gz rails-a0c3c1e1f796c215685e4e4bcd3e8c9178936492.tar.bz2 rails-a0c3c1e1f796c215685e4e4bcd3e8c9178936492.zip |
Merge pull request #9616 from exviva/multiple_select_name_double_square_brackets
Fix incorrectly appended square brackets to a multiple select box
Before:
select(:category, [], {}, {:multiple => true, :name => "post[category][]"})
# => <select name="post[category][][]" ...>
After:
select(:category, [], {}, {:multiple => true, :name => "post[category][]"})
# => <select name="post[category][]" ...>
Conflicts:
actionpack/CHANGELOG.md
actionpack/lib/action_view/helpers/tags/base.rb
actionpack/test/template/form_options_helper_test.rb
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_options_helper_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 3009fa5330..72c2609a48 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -515,6 +515,14 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_with_multiple_and_with_explicit_name_ending_with_brackets + output_buffer = select(:post, :category, "", {}, :multiple => true, :name => 'post[category][]') + assert_dom_equal( + "<input type=\"hidden\" name=\"post[category][]\" value=\"\"/><select multiple=\"multiple\" id=\"post_category\" name=\"post[category][]\"></select>", + output_buffer + ) + end + def test_select_with_multiple_and_disabled_to_add_disabled_hidden_input output_buffer = select(:post, :category, "", {}, :multiple => true, :disabled => true) assert_dom_equal( |