Test with label_input too

This commit is contained in:
Rafael Mendonça França 2014-03-11 11:31:48 -03:00
parent 51bdd20246
commit 93161d7eb3
2 changed files with 17 additions and 0 deletions

View File

@ -231,4 +231,15 @@ class WrapperTest < ActionView::TestCase
assert_select "div.custom_wrapper label.string.inline-class"
end
test 'label_input accepts attributes in the DSL' do
swap_wrapper :default, self.custom_wrapper_with_label_input_class do
with_concat_form_for @user do |f|
concat f.input :name
end
end
assert_select "div.custom_wrapper label.string.inline-class"
assert_select "div.custom_wrapper input.string.inline-class"
end
end

View File

@ -82,6 +82,12 @@ module MiscHelpers
end
end
def custom_wrapper_with_label_input_class
SimpleForm.build tag: :div, class: "custom_wrapper" do |b|
b.use :label_input, class: 'inline-class'
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|