Do not emit `prompt` as an HTML attribute when using `input_field`.
This commit is contained in:
parent
8a4b9eb948
commit
e62018afa8
|
@ -140,7 +140,7 @@ module SimpleForm
|
|||
components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS)
|
||||
|
||||
options = options.dup
|
||||
options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, *components)
|
||||
options[:input_html] = options.except(:as, :boolean_style, :collection, :label_method, :value_method, :prompt, *components)
|
||||
options = @defaults.deep_dup.deep_merge(options) if @defaults
|
||||
|
||||
input = find_input(attribute_name, options)
|
||||
|
|
|
@ -121,6 +121,12 @@ class InputFieldTest < ActionView::TestCase
|
|||
assert_no_select 'input.boolean[boolean_style]'
|
||||
end
|
||||
|
||||
test 'build input_field does not treat "prompt" as a HTML attribute' do
|
||||
with_input_field_for @user, :attempts, collection: [1,2,3,4,5], prompt: :translate
|
||||
|
||||
assert_no_select 'select[prompt]'
|
||||
end
|
||||
|
||||
test 'build input_field without pattern component use the pattern string' do
|
||||
swap_wrapper :default, custom_wrapper_with_html5_components do
|
||||
with_input_field_for @user, :name, pattern: '\w+'
|
||||
|
|
Loading…
Reference in New Issue