aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_helper_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-02 15:21:35 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-02 15:21:35 -0700
commitc449462f45d342258a01313c0ff46279d268719d (patch)
tree0ff0203900608db71dfb96c58412ae7c976d18ff /actionpack/test/template/form_helper_test.rb
parent743d07ea2c3303b0f400f145f45686848e4bb762 (diff)
parent175ba04cf38134e156208c7e59808c40e8c25aa5 (diff)
downloadrails-c449462f45d342258a01313c0ff46279d268719d.tar.gz
rails-c449462f45d342258a01313c0ff46279d268719d.tar.bz2
rails-c449462f45d342258a01313c0ff46279d268719d.zip
Merge pull request #8108 from Casecommons/fix-multiple-and-index-in-instance-tag
Support :multiple option on input tags that also have :index
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r--actionpack/test/template/form_helper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index fbfc73deda..c730e3ab74 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -525,6 +525,19 @@ class FormHelperTest < ActionView::TestCase
)
end
+ def test_check_box_with_multiple_behavior_and_index
+ @post.comment_ids = [2,3]
+ assert_dom_equal(
+ '<input name="post[foo][comment_ids][]" type="hidden" value="0" /><input id="post_foo_comment_ids_1" name="post[foo][comment_ids][]" type="checkbox" value="1" />',
+ check_box("post", "comment_ids", { :multiple => true, :index => "foo" }, 1)
+ )
+ assert_dom_equal(
+ '<input name="post[bar][comment_ids][]" type="hidden" value="0" /><input checked="checked" id="post_bar_comment_ids_3" name="post[bar][comment_ids][]" type="checkbox" value="3" />',
+ check_box("post", "comment_ids", { :multiple => true, :index => "bar" }, 3)
+ )
+
+ end
+
def test_checkbox_disabled_disables_hidden_field
assert_dom_equal(
'<input name="post[secret]" type="hidden" value="0" disabled="disabled"/><input checked="checked" disabled="disabled" id="post_secret" name="post[secret]" type="checkbox" value="1" />',