diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-14 00:56:29 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-14 01:07:03 +0100 |
commit | 214b548485f9313639059e8de1ad08611f734fe2 (patch) | |
tree | fb6701f290abf58c31f12b4d2e0a9a094dc3a995 /actionpack/test/template | |
parent | d50bf47b008ae4c1a84ccc44e8fc7633bfffa650 (diff) | |
download | rails-214b548485f9313639059e8de1ad08611f734fe2.tar.gz rails-214b548485f9313639059e8de1ad08611f734fe2.tar.bz2 rails-214b548485f9313639059e8de1ad08611f734fe2.zip |
Make check boxes accept :multiple as option so they can handle collections (such as HABTM).
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 13 |
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 2f6d97de3d..7712883e9c 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -245,6 +245,19 @@ class FormHelperTest < ActionView::TestCase ) end + def test_check_box_with_multiple_behavior + @post.comment_ids = [2,3] + assert_dom_equal( + '<input name="post[comment_ids][]" type="hidden" value="0" /><input id="post_comment_ids_1" name="post[comment_ids][]" type="checkbox" value="1" />', + check_box("post", "comment_ids", { :multiple => true }, 1) + ) + assert_dom_equal( + '<input name="post[comment_ids][]" type="hidden" value="0" /><input checked="checked" id="post_comment_ids_3" name="post[comment_ids][]" type="checkbox" value="3" />', + check_box("post", "comment_ids", { :multiple => true }, 3) + ) + end + + def test_checkbox_disabled_still_submits_checked_value assert_dom_equal( '<input name="post[secret]" type="hidden" value="1" /><input checked="checked" disabled="disabled" id="post_secret" name="post[secret]" type="checkbox" value="1" />', |