From ec19c77ca570919a78efcf2a801863e0eefe98c3 Mon Sep 17 00:00:00 2001 From: Andriel Nuernberg Date: Sun, 1 Dec 2013 04:50:21 -0200 Subject: Label only accepts `:index` and `:namespace` attributes from the input --- actionview/test/template/form_helper_test.rb | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'actionview/test/template/form_helper_test.rb') diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 3e8a2468ed..90f7a412fb 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -1300,6 +1300,24 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_with_index_and_with_collection_radio_buttons + post = Post.new + def post.active; false; end + + form_for(post, index: '1') do |f| + concat f.collection_radio_buttons(:active, [true, false], :to_s, :to_s) + end + + expected = whole_form("/posts", "new_post", "new_post") do + "" + + "" + + "" + + "" + end + + assert_dom_equal expected, output_buffer + end + def test_form_for_with_collection_check_boxes post = Post.new def post.tag_ids; [1, 3]; end @@ -1397,6 +1415,24 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_with_index_and_with_collection_check_boxes + post = Post.new + def post.tag_ids; [1]; end + collection = [[1, "Tag 1"]] + + form_for(post, index: '1') do |f| + concat f.collection_check_boxes(:tag_ids, collection, :first, :last) + end + + expected = whole_form("/posts", "new_post", "new_post") do + "" + + "" + + "" + end + + assert_dom_equal expected, output_buffer + end + def test_form_for_with_file_field_generate_multipart Post.send :attr_accessor, :file -- cgit v1.2.3 From 7a085dac2a2820856cbe6c2ca8c69779ac766a97 Mon Sep 17 00:00:00 2001 From: Gaelian Ditchburn Date: Sun, 3 Jun 2012 19:07:54 +1000 Subject: Switched to use `display:none` in extra_tags_for_form method. The use of `display:inline` with the content_tag call in the extra_tags_for_form method potentially causes display issues with some browsers, namely Internet Explorer. IE's behaviour of not collapsing the line height on divs with ostensibly no content means that the automatically added div containing the hidden authenticity_token, utf8 and _method form input tags may interfere with other visible form elements in certain circumstances. The use of `display:none` rather than `display:inline` fixes this problem. Fixes #6403 --- actionview/test/template/form_helper_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/test/template/form_helper_test.rb') diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 90f7a412fb..fe82349265 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -3023,7 +3023,7 @@ class FormHelperTest < ActionView::TestCase protected def hidden_fields(method = nil) - txt = %{
} + txt = %{
} txt << %{} if method && !%w(get post).include?(method.to_s) txt << %{} -- cgit v1.2.3