Not display :year_of_birth when :date_of_birth is present

This commit is contained in:
taitus
2019-04-25 16:29:02 +02:00
committed by Javi Martín
parent 3e383d7c1f
commit 230d1a4e9d
2 changed files with 21 additions and 3 deletions

View File

@@ -12,21 +12,24 @@
placeholder: t("officing.residence.new.document_number"),
autocomplete: "off" %>
</div>
<% if Setting.force_presence_date_of_birth? %>
<div class="date-of-birth small-12 medium-6 clear">
<%= f.date_select :date_of_birth,
prompt: true,
start_year: 1900, end_year: minimum_required_age.years.ago.year %>
</div>
<% else %>
<div class="date-of-birth small-12 medium-6">
<%= f.text_field :year_of_birth, type: "number", autocomplete: "off" %>
</div>
<% end %>
<% if Setting.force_presence_postal_code? %>
<div class="small-12 medium-6">
<%= f.text_field :postal_code, aria: {describedby: "postal-code-help-text"} %>
</div>
<% end %>
<div class="date-of-birth small-12 medium-6">
<%= f.text_field :year_of_birth, type: "number", autocomplete: "off" %>
</div>
<div class="small-12 medium-6">
<input type="submit" value="<%= t("officing.residence.new.submit") %>" class="button expanded">

View File

@@ -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