Use a date field to select the date of birth
The default `date_select` used in fields presents an accessibility issue, because in generates three select controls but only one label. That means that there are two controls without a label. So we're using a date field instead. This type is field is supported by about 99% of the browsers, and we've already got JavaScript code converting this field to a jQuery UI datepicker in case the browser doesn't support date fields. Note that, since we no longer need to parse the three date fields into one, we can simplify the code in both the models and the tests. Another slight improvement is that, previously, we couldn't restrict the month and day controls in order to set the minimum date, so the maximum selectable date was always the 31st of December of the year set by the minimum age setting. As seen in the component test, now that we use only one field, we can set a specific date as the maximum one.
This commit is contained in:
@@ -63,7 +63,7 @@ describe "DocumentVerifications" do
|
||||
login_as_manager
|
||||
visit management_document_verifications_path
|
||||
fill_in "document_verification_document_number", with: "12345678Z"
|
||||
select_date "31-December-1980", from: "document_verification_date_of_birth"
|
||||
fill_in "Date of birth", with: Date.new(1980, 12, 31)
|
||||
fill_in "document_verification_postal_code", with: "inexisting"
|
||||
click_button "Check document"
|
||||
|
||||
@@ -77,7 +77,7 @@ describe "DocumentVerifications" do
|
||||
login_as_manager
|
||||
visit management_document_verifications_path
|
||||
fill_in "document_verification_document_number", with: "12345678Z"
|
||||
select_date "31-December-1980", from: "document_verification_date_of_birth"
|
||||
fill_in "Date of birth", with: Date.new(1980, 12, 31)
|
||||
fill_in "document_verification_postal_code", with: "28013"
|
||||
click_button "Check document"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ describe "Users" do
|
||||
|
||||
fill_in "user_username", with: "pepe"
|
||||
fill_in "user_email", with: "pepe@gmail.com"
|
||||
select_date "31-December-1980", from: "user_date_of_birth"
|
||||
fill_in "Date of birth", with: Date.new(1980, 12, 31)
|
||||
|
||||
click_button "Create user"
|
||||
|
||||
@@ -54,7 +54,7 @@ describe "Users" do
|
||||
|
||||
fill_in "user_username", with: "Kelly Sue"
|
||||
fill_in "user_email", with: ""
|
||||
select_date "31-December-1980", from: "user_date_of_birth"
|
||||
fill_in "Date of birth", with: Date.new(1980, 12, 31)
|
||||
|
||||
click_button "Create user"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user