add test for label_text method
This commit is contained in:
parent
a8df7c3e15
commit
716b998008
|
@ -68,4 +68,14 @@ class LabelTest < ActionView::TestCase
|
|||
assert_select 'label.integer[for=user_age]', "Age:"
|
||||
end
|
||||
end
|
||||
|
||||
test 'configuration allow set label text for wrappers' do
|
||||
swap_wrapper :default, self.custom_wrapper_with_label_text do
|
||||
with_concat_form_for(@user) do |f|
|
||||
concat f.input :age
|
||||
end
|
||||
assert_select "label.integer[for=user_age]", "**Age**"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -84,6 +84,12 @@ module MiscHelpers
|
|||
end
|
||||
end
|
||||
|
||||
def custom_wrapper_with_label_text
|
||||
SimpleForm.build :label_text => lambda { |label, required| "**#{label}**" } do |b|
|
||||
b.use :label_input
|
||||
end
|
||||
end
|
||||
|
||||
def custom_form_for(object, *args, &block)
|
||||
simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue