Ensure wrap_with without a tag works.

This commit is contained in:
José Valim 2012-02-18 15:47:02 +01:00
parent 6a763baafd
commit b9a568d149
4 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ module SimpleForm
@namespace = namespace
@components = components
@defaults = defaults
@defaults[:tag] = :div unless @defaults.key?(:tag)
@defaults[:class] = Array.wrap(@defaults[:class])
end

View File

@ -109,7 +109,7 @@ class HintTest < ActionView::TestCase
test 'hint with custom wrappers works' do
swap_wrapper do
with_hint_for @user, :name, :hint => "can't be blank"
assert_select 'span.omg_hint', "can't be blank"
assert_select 'div.omg_hint', "can't be blank"
end
end
end

View File

@ -84,7 +84,7 @@ class WrapperTest < ActionView::TestCase
assert_select "section.custom_wrapper div.another_wrapper input.string"
assert_no_select "section.custom_wrapper div.another_wrapper span.omg_error"
assert_select "section.custom_wrapper div.error_wrapper span.omg_error"
assert_select "section.custom_wrapper > span.omg_hint", "cool"
assert_select "section.custom_wrapper > div.omg_hint", "cool"
end
end

View File

@ -42,7 +42,7 @@ module MiscHelpers
b.wrapper :error_wrapper, :tag => :div, :class => "error_wrapper" do |be|
be.use :error, :wrap_with => { :tag => :span, :class => "omg_error" }
end
b.use :hint, :wrap_with => { :tag => :span, :class => "omg_hint" }
b.use :hint, :wrap_with => { :class => "omg_hint" }
end
end