diff --git a/app/views/officing/residence/new.html.erb b/app/views/officing/residence/new.html.erb index c039e570a..9db1bd3a2 100644 --- a/app/views/officing/residence/new.html.erb +++ b/app/views/officing/residence/new.html.erb @@ -12,21 +12,24 @@ placeholder: t("officing.residence.new.document_number"), autocomplete: "off" %> + <% if Setting.force_presence_date_of_birth? %>
<%= f.date_select :date_of_birth, prompt: true, start_year: 1900, end_year: minimum_required_age.years.ago.year %>
+ <% else %> +
+ <%= f.text_field :year_of_birth, type: "number", autocomplete: "off" %> +
<% end %> + <% if Setting.force_presence_postal_code? %>
<%= f.text_field :postal_code, aria: {describedby: "postal-code-help-text"} %>
<% end %> -
- <%= f.text_field :year_of_birth, type: "number", autocomplete: "off" %> -
" class="button expanded"> diff --git a/spec/features/officing/residence_spec.rb b/spec/features/officing/residence_spec.rb index 604aa36b4..3bf6a2db6 100644 --- a/spec/features/officing/residence_spec.rb +++ b/spec/features/officing/residence_spec.rb @@ -149,6 +149,21 @@ describe "Residence", :with_frozen_time do expect(page).not_to have_css("#residence_postal_code") end + scenario "with all custom census not display year_of_birth" do + Setting["remote_census.request.date_of_birth"] = "some.value" + Setting["remote_census.request.postal_code"] = "some.value" + + within("#side_menu") do + click_link "Validate document" + end + + expect(page).to have_css("#residence_document_type") + expect(page).to have_css("#residence_document_number") + expect(page).to have_content("Date of birth") + expect(page).to have_css("#residence_postal_code") + expect(page).not_to have_css("#residence_year_of_birth") + end + end scenario "can verify voter with date_of_birth and postal_code fields" do