Browse files

add failing test for issue when input_html options apply to wrapper

  • Loading branch information...
1 parent 840d115 commit feb9530696361e74ff9300dd1b78a4bc1fbb85f8 @nashby committed Jun 23, 2012
Showing with 17 additions and 0 deletions.
  1. +8 −0 test/form_builder/general_test.rb
  2. +9 −0 test/support/misc_helpers.rb
View
8 test/form_builder/general_test.rb
@@ -202,6 +202,14 @@ def with_custom_form_for(object, *args, &block)
assert_select 'form input#my_input.my_input.string'
end
+ test 'builder should not propagate input options to wrapper with custom wrapper' do
+ swap_wrapper :default, self.custom_wrapper_with_wrapped_input do
+ with_form_for @user, :name, :input_html => { :class => 'my_input' }
+ assert_no_select 'form div.input.my_input'
+ assert_select 'form input.my_input.string'
+ end
+ end
+
test 'builder should generate a input with label' do
with_form_for @user, :name
assert_select 'form label.string[for=user_name]', /Name/
View
9 test/support/misc_helpers.rb
@@ -46,6 +46,15 @@ def custom_wrapper
end
end
+ def custom_wrapper_with_wrapped_input
+ SimpleForm.build :tag => :div, :class => "custom_wrapper" do |b|
+ b.wrapper :tag => :div, :class => 'elem' do |component|
+ component.use :label
+ component.use :input, :wrap_with => { :tag => :div, :class => 'input' }
+ end
+ end
+ end
+
def custom_wrapper_without_top_level
SimpleForm.build :tag => false, :class => 'custom_wrapper_without_top_level' do |b|
b.use :label_input

0 comments on commit feb9530

Please sign in to comment.