add test for this case
This commit is contained in:
parent
b96fedba88
commit
4aef53d5d2
|
@ -237,6 +237,11 @@ class FormBuilderTest < ActionView::TestCase
|
|||
assert_no_select 'form label'
|
||||
end
|
||||
|
||||
test 'builder should be able to disable the label for an input and return a html safe string' do
|
||||
with_form_for @validating_user, :age, :label => false, :wrapper => custom_wrapper_with_wrapped_label_input
|
||||
assert_select 'form input[type=text]'
|
||||
end
|
||||
|
||||
test 'builder should use custom label' do
|
||||
with_form_for @user, :name, :label => 'Yay!'
|
||||
assert_select 'form label', /Yay!/
|
||||
|
|
|
@ -84,6 +84,13 @@ module MiscHelpers
|
|||
end
|
||||
end
|
||||
|
||||
def custom_wrapper_with_wrapped_label_input
|
||||
SimpleForm.build :tag => :section, :class => "custom_wrapper", :pattern => false do |b|
|
||||
b.use :label_input, :wrap_with => { :tag => :div, :class => :field }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def custom_form_for(object, *args, &block)
|
||||
simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue