Not display :year_of_birth when :date_of_birth is present
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user