-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format date errors according to the style guide
The GOVUK design system describes specific error styling for date fields that the current helpers don't support. Due to the way we build the errors and Rails conventions, there is no support for highlighting errors with specific parts of a date input. Adding support for this requires a few changes in the form builder. I considered adding these changes upstream in the form builder gem but opted instead to monkey-patch them initially so that we can explore them in a real environment first. Once we have seen these changes work, I will propose the changes to the form library and remove the monkey-patch if they are accepted. Mostly, the changes are around how we determine if an error message is present for one of the date part input fields.
- Loading branch information
1 parent
5e71019
commit ecd6dc6
Showing
5 changed files
with
154 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
spec/system/check_records/user_searches_with_an_invalid_date_of_birth_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Teacher search", host: :check_records, type: :system do | ||
include ActivateFeaturesSteps | ||
include CheckRecords::AuthenticationSteps | ||
|
||
scenario "User searches with an invalid date of birth", | ||
test: %i[with_stubbed_auth with_fake_quals_api] do | ||
given_the_service_is_open | ||
when_i_sign_in_via_dsi | ||
and_search_with_a_missing_dob | ||
then_i_see_an_error_message | ||
end | ||
|
||
private | ||
|
||
def and_search_with_a_missing_dob | ||
fill_in "Last name", with: "Walsh" | ||
fill_in "Day", with: "5" | ||
fill_in "Month", with: "April" | ||
click_button "Find record" | ||
end | ||
|
||
def then_i_see_an_error_message | ||
expect(page).to have_text("Enter a year with 4 digits") | ||
page.click_link("Enter a year with 4 digits") | ||
expect(page).to have_css("#search-year-field-error") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters