diff --git a/lib/generators/simple_form/templates/simple_form.rb b/lib/generators/simple_form/templates/simple_form.rb index ab7f954f..075f6772 100644 --- a/lib/generators/simple_form/templates/simple_form.rb +++ b/lib/generators/simple_form/templates/simple_form.rb @@ -24,7 +24,7 @@ SimpleForm.setup do |config| # config.wrapper_class = :input # CSS class to add to the wrapper if the field has errors. - # config.wrapper_error_class = :fieldWithErrors + # config.wrapper_error_class = :field_with_errors # How the label text should be generated altogether with the required text. # config.label_text = lambda { |label, required| "#{required} #{label}" } diff --git a/lib/simple_form.rb b/lib/simple_form.rb index d62e7cf7..0d53f0ae 100644 --- a/lib/simple_form.rb +++ b/lib/simple_form.rb @@ -48,7 +48,7 @@ module SimpleForm # You can define the class to add to the wrapper when the field has errors. Default is fieldWithErrors. mattr_accessor :wrapper_error_class - @@wrapper_error_class = :fieldWithErrors + @@wrapper_error_class = :field_with_errors # How the label text should be generated altogether with the required text. mattr_accessor :label_text diff --git a/test/components/wrapper_test.rb b/test/components/wrapper_test.rb index f0ddcfd4..afa542f6 100644 --- a/test/components/wrapper_test.rb +++ b/test/components/wrapper_test.rb @@ -16,17 +16,17 @@ class WrapperTest < ActionView::TestCase test 'wrapper should not have error class for attribute without errors' do with_error_for @user, :active - assert_no_select 'div.fieldWithErrors' + assert_no_select 'div.field_with_errors' end test 'wrapper should not have error class when object is not present' do with_error_for :project, :name - assert_no_select 'div.fieldWithErrors' + assert_no_select 'div.field_with_errors' end test 'wrapper should add error class for attribute with errors' do with_error_for @user, :name - assert_select 'div.fieldWithErrors' + assert_select 'div.field_with_errors' end test 'wrapper should add chosen error class for attribute with errors' do diff --git a/test/form_builder_test.rb b/test/form_builder_test.rb index 936f66b0..1649dff3 100644 --- a/test/form_builder_test.rb +++ b/test/form_builder_test.rb @@ -305,7 +305,7 @@ class FormBuilderTest < ActionView::TestCase test 'builder wrapping tag adds errors class for attribute with errors' do with_form_for @user, :name - assert_select 'form div.input.required.string.fieldWithErrors' + assert_select 'form div.input.required.string.field_with_errors' end # WITHOUT OBJECT