Skip to content

Commit

Permalink
Rename fieldWithErrors css class to field_with_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosantoniodasilva committed Jul 7, 2010
1 parent beeabda commit 25cc5b1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/generators/simple_form/templates/simple_form.rb
Expand Up @@ -24,7 +24,7 @@
# 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}" }
Expand Down
2 changes: 1 addition & 1 deletion lib/simple_form.rb
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/components/wrapper_test.rb
Expand Up @@ -16,17 +16,17 @@ def with_form_for(object, *args, &block)

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
Expand Down
2 changes: 1 addition & 1 deletion test/form_builder_test.rb
Expand Up @@ -305,7 +305,7 @@ def with_association_for(object, *args)

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
Expand Down

0 comments on commit 25cc5b1

Please sign in to comment.