Do not show the geozone selector where there are no geozones defined
This commit is contained in:
@@ -49,10 +49,12 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if Geozone.any? %>
|
||||
<div>
|
||||
<%= f.select :geozone_id, geozone_select_options,
|
||||
include_blank: t("geozones.none") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if feature?(:map) %>
|
||||
<div>
|
||||
|
||||
@@ -36,9 +36,11 @@
|
||||
<%= render "documents/nested_documents", f: f %>
|
||||
</div>
|
||||
|
||||
<% if Geozone.any? %>
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :tag_list, t("legislation.proposals.form.tags_label") %>
|
||||
|
||||
@@ -268,4 +268,21 @@ describe "Legislation Proposals" do
|
||||
|
||||
expect(page).not_to have_link("All city")
|
||||
end
|
||||
|
||||
scenario "form shows the geozone selector when there are geozones defined" do
|
||||
create(:geozone)
|
||||
login_as user
|
||||
|
||||
visit new_legislation_process_proposal_path(process)
|
||||
|
||||
expect(page).to have_field("Scope of operation")
|
||||
end
|
||||
|
||||
scenario "form do not show geozone selector when there are no geozones defined" do
|
||||
login_as user
|
||||
|
||||
visit new_legislation_process_proposal_path(process)
|
||||
|
||||
expect(page).not_to have_field("Scope of operation")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -566,6 +566,25 @@ describe "Proposals" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "form shows the geozone selector when there are geozones defined" do
|
||||
create(:geozone)
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
expect(page).to have_field("Scope of operation")
|
||||
end
|
||||
|
||||
scenario "form do not show geozone selector when there are no geozones defined" do
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
|
||||
expect(page).not_to have_field("Scope of operation")
|
||||
end
|
||||
|
||||
scenario "Specific geozone" do
|
||||
create(:geozone, name: "California")
|
||||
create(:geozone, name: "New York")
|
||||
|
||||
Reference in New Issue
Block a user