Skip to content
Browse files

add test for this case

  • Loading branch information...
1 parent b96fedb commit 4aef53d5d2f4b7e0b755be460c1e3545304c123a @allomov allomov committed
Showing with 12 additions and 0 deletions.
  1. +5 −0 test/form_builder/general_test.rb
  2. +7 −0 test/support/misc_helpers.rb
View
5 test/form_builder/general_test.rb
@@ -237,6 +237,11 @@ def with_custom_form_for(object, *args, &block)
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!/
View
7 test/support/misc_helpers.rb
@@ -84,6 +84,13 @@ def custom_wrapper_with_label_html_option
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

0 comments on commit 4aef53d

Please sign in to comment.
Something went wrong with that request. Please try again.