Send current tab reference when filtering with search form

This commit is contained in:
Senén Rodero Rodríguez
2020-12-22 13:39:18 +01:00
parent c6407d82e3
commit 3ad14f4acb
2 changed files with 33 additions and 9 deletions

View File

@@ -7,6 +7,7 @@
<%= component.select_tag :target_code, target_options, <%= component.select_tag :target_code, target_options,
include_blank: target_blank_option, include_blank: target_blank_option,
"aria-label": target_label %> "aria-label": target_label %>
<%= component.hidden_field_tag :filter, current_filter %>
<% end %> <% end %>
<%= render "shared/filter_subnav", i18n_namespace: "sdg_management.relations.index" %> <%= render "shared/filter_subnav", i18n_namespace: "sdg_management.relations.index" %>

View File

@@ -138,6 +138,7 @@ describe "SDG Relations", :js do
expect(page).to have_content "Internet speech freedom" expect(page).to have_content "Internet speech freedom"
expect(page).not_to have_content "SDG interest" expect(page).not_to have_content "SDG interest"
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
end end
scenario "goal filter" do scenario "goal filter" do
@@ -150,7 +151,7 @@ describe "SDG Relations", :js do
expect(page).to have_content "School" expect(page).to have_content "School"
expect(page).not_to have_content "Hospital" expect(page).not_to have_content "Hospital"
end expect(page).to have_css "li.is-active h2", exact_text: "Pending"
end end
scenario "target filter" do scenario "target filter" do
@@ -163,6 +164,28 @@ describe "SDG Relations", :js do
expect(page).to have_content "School" expect(page).to have_content "School"
expect(page).not_to have_content "Preschool" expect(page).not_to have_content "Preschool"
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
end
scenario "search within current tab" do
visit sdg_management_proposals_path(filter: "pending_sdg_review")
click_button "Search"
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
visit sdg_management_proposals_path(filter: "sdg_reviewed")
click_button "Search"
expect(page).to have_css "li.is-active h2", exact_text: "Marked as reviewed"
visit sdg_management_proposals_path(filter: "all")
click_button "Search"
expect(page).to have_css "li.is-active h2", exact_text: "All"
end
end end
end end