Highlight erroneous fields by adding a class to them

The default rails scheme for highlighting errors is to wrap the
field in a div, but that changes the structure of the page and can
change the meaning of CSS rules applied to the fields.

As an alternative we now apply a class to the fields, and use that
in the CSS to apply a highlight.
This commit is contained in:
Tom Hughes 2014-01-15 21:09:54 +00:00
parent 0764bb40b2
commit 933b091330
4 changed files with 23 additions and 16 deletions

View file

@ -29,7 +29,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest
assert_response :success
assert_template 'user/new'
assert_equal response.headers['Content-Language'][0..1], localer.to_s[0..1] unless localer == :root
assert_select "form > fieldset > div.form-row > div.field_with_errors > input#user_email"
assert_select "form > fieldset > div.form-row > input.field_with_errors#user_email"
assert_no_missing_translations
end
end
@ -47,7 +47,7 @@ class UserCreationTest < ActionDispatch::IntegrationTest
end
assert_response :success
assert_template 'user/new'
assert_select "form > fieldset > div.form-row > div.field_with_errors > input#user_display_name"
assert_select "form > fieldset > div.form-row > input.field_with_errors#user_display_name"
assert_no_missing_translations
end
end