Skip to content

Commit

Permalink
Added form error styling and associated tests. Closes out codeforamer…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexi215 committed Aug 7, 2014
1 parent 914cb78 commit c3c835b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@
}
}

// Adds a red border around invalid input fields after form submission.
.field_with_errors
{
input
{
border-color: red;
border-width: 2px;
margin-left: 10px;
}
}

.add_fields, .add_array_fields
{
margin: 10px 0px 15px 10px;
Expand Down
1 change: 1 addition & 0 deletions spec/features/admin/locations/create_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
expect(page).to have_content "Description can't be blank for Location"
expect(page).to have_content "Name can't be blank for Location"
expect(page).to have_content 'A location must have at least one address type'
expect(page).to have_css('.field_with_errors')
end

scenario 'with valid mailing address', :js do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
scenario 'without any required fields' do
click_button 'Create organization'
expect(page).to have_content "Name can't be blank for Organization"
expect(page).to have_css('.field_with_errors')
end

scenario 'when adding a website', :js do
Expand Down

0 comments on commit c3c835b

Please sign in to comment.