Add failing test to label with single wrapper.
The :label_html options is being propagate to the label wrapper
This commit is contained in:
parent
3d9a2ec19c
commit
9237674f73
|
@ -210,6 +210,14 @@ class FormBuilderTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'builder should not propagate label options to wrapper with custom wrapper' do
|
||||
swap_wrapper :default, self.custom_wrapper_with_wrapped_label do
|
||||
with_form_for @user, :name, :label_html => { :class => 'my_label' }
|
||||
assert_no_select 'form div.label.my_label'
|
||||
assert_select 'form label.my_label.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/
|
||||
|
|
|
@ -55,6 +55,15 @@ module MiscHelpers
|
|||
end
|
||||
end
|
||||
|
||||
def custom_wrapper_with_wrapped_label
|
||||
SimpleForm.build :tag => :div, :class => "custom_wrapper" do |b|
|
||||
b.wrapper :tag => :div, :class => 'elem' do |component|
|
||||
component.use :label, :wrap_with => { :tag => :div, :class => 'label' }
|
||||
component.use :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
|
||||
|
|
Loading…
Reference in New Issue