Wrap collection items in a span tag not div.

span tag is inline by default
This commit is contained in:
Rafael Mendonça França 2011-04-06 00:33:41 -03:00
parent 128ccfeb79
commit aa3055ee0b
2 changed files with 9 additions and 9 deletions

View File

@ -61,7 +61,7 @@ module SimpleForm
# You can wrap each item in a collection of radio/check boxes with a tag, defaulting to none.
mattr_accessor :item_wrapper_tag
@@item_wrapper_tag = :div
@@item_wrapper_tag = :span
# You can wrap all inputs in a pre-defined tag. Default is a div.
mattr_accessor :wrapper_tag

View File

@ -118,17 +118,17 @@ class BuilderTest < ActionView::TestCase
assert_select 'form li input[type=radio][value=false]#user_active_false'
end
test 'collection radio wrap items in a div tag by default' do
test 'collection radio wrap items in a span tag by default' do
with_collection_radio @user, :active, [true, false], :to_s, :to_s
assert_select 'form div input[type=radio][value=true]#user_active_true + label'
assert_select 'form div input[type=radio][value=false]#user_active_false + label'
assert_select 'form span input[type=radio][value=true]#user_active_true + label'
assert_select 'form span input[type=radio][value=false]#user_active_false + label'
end
test 'collection radio does not wrap input inside the label' do
with_collection_radio @user, :active, [true, false], :to_s, :to_s
assert_no_select 'form label input[type=radio][value=true]#user_active_true'
assert_no_select 'form label input'
end
# COLLECTION CHECK BOX
@ -268,17 +268,17 @@ class BuilderTest < ActionView::TestCase
assert_select 'form li input[type=checkbox][value=false]#user_active_false'
end
test 'collection check box wrap items in a div by default' do
test 'collection check box wrap items in a span tag by default' do
with_collection_check_boxes @user, :active, [true, false], :to_s, :to_s
assert_select 'form div input[type=checkbox][value=true]#user_active_true + label'
assert_select 'form div input[type=checkbox][value=false]#user_active_false + label'
assert_select 'form span input[type=checkbox][value=true]#user_active_true + label'
assert_select 'form span input[type=checkbox][value=false]#user_active_false + label'
end
test 'collection check box does not wrap input inside the label' do
with_collection_check_boxes @user, :active, [true, false], :to_s, :to_s
assert_no_select 'form label input[type=checkbox][value=true]#user_active_truel'
assert_no_select 'form label input'
end
# SIMPLE FIELDS