Add "new inputs can override the default input_html_classes" test case
This commit is contained in:
parent
1411dc3349
commit
4b1cd65588
|
@ -109,6 +109,14 @@ class DiscoveryTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'new inputs can override the default input_html_classes' do
|
||||
discovery do
|
||||
with_form_for @user, :avatar, as: :file
|
||||
assert_select 'form input[type=file]#user_avatar.file.file-upload', false
|
||||
assert_select 'form input[type=file]#user_avatar.file-upload'
|
||||
end
|
||||
end
|
||||
|
||||
test 'inputs method without wrapper_options are deprecated' do
|
||||
discovery do
|
||||
assert_deprecated do
|
||||
|
|
|
@ -37,6 +37,13 @@ class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
|
|||
end
|
||||
end
|
||||
|
||||
class FileInput < SimpleForm::Inputs::FileInput
|
||||
def input_html_classes
|
||||
super.delete_if { |html_class| html_class == 'file' }
|
||||
super.push('file-upload')
|
||||
end
|
||||
end
|
||||
|
||||
module CustomInputs
|
||||
class CustomizedInput < SimpleForm::Inputs::StringInput
|
||||
def input_html_classes
|
||||
|
|
Loading…
Reference in New Issue