Tidy up the input_only method and tests
This commit is contained in:
parent
3d100e8b99
commit
cd59d47e9f
|
@ -90,7 +90,7 @@ module SimpleForm
|
|||
end
|
||||
end
|
||||
alias :attribute :input
|
||||
|
||||
|
||||
# Helper for outputting only the input tag, no wrapper, errors, label etc
|
||||
#
|
||||
# == Examples
|
||||
|
@ -101,10 +101,7 @@ module SimpleForm
|
|||
#
|
||||
def input_only(attribute_name, options={})
|
||||
options.merge!({:components => [:input], :wrapper => false})
|
||||
column = find_attribute_column(attribute_name)
|
||||
input_type = default_input_type(attribute_name, column, options)
|
||||
klass = self.class.mappings[input_type] || self.class.const_get("#{input_type.to_s.camelize}Input")
|
||||
klass.new(self, attribute_name, column, input_type, options).render
|
||||
input(attribute_name, options)
|
||||
end
|
||||
|
||||
# Helper for dealing with association selects/radios, generating the
|
||||
|
|
|
@ -383,9 +383,9 @@ class FormBuilderTest < ActionView::TestCase
|
|||
f.input_only :name
|
||||
end
|
||||
assert_select 'form > input.required.string'
|
||||
assert_select 'div.string', false
|
||||
assert_select 'label', false
|
||||
assert_select '.hint', false
|
||||
assert_no_select 'div.string'
|
||||
assert_no_select 'label'
|
||||
assert_no_select '.hint'
|
||||
end
|
||||
|
||||
# WITHOUT OBJECT
|
||||
|
|
Loading…
Reference in New Issue