Fix term in investments advanced search results

When using the advanced search in the debates and proposals sections, we
were not displaying the search term in the search results summary.
However, we were displaying it when using the advanced search in the
investments section.

Now we're doing the same thing everywhere.
This commit is contained in:
Javi Martín
2022-04-09 01:19:07 +02:00
parent 42104f2a58
commit 8aff5e95d6
2 changed files with 11 additions and 5 deletions

View File

@@ -28,9 +28,11 @@
<h2><%= t("shared.search_results") %></h2> <h2><%= t("shared.search_results") %></h2>
<p> <p>
<%= page_entries_info @investments %> <%= page_entries_info @investments %>
<% if params[:advanced_search].blank? %>
<%= sanitize(t("budgets.investments.index.search_results", <%= sanitize(t("budgets.investments.index.search_results",
count: @investments.size, count: @investments.size,
search_term: params[:search])) %> search_term: params[:search])) %>
<% end %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -175,6 +175,8 @@ describe "Budget Investments" do
click_button "Search" click_button "Search"
end end
expect(page).to have_content "containing the term 'Schwifty'"
within("#budget-investments") do within("#budget-investments") do
expect(page).to have_css(".budget-investment", count: 2) expect(page).to have_css(".budget-investment", count: 2)
@@ -199,9 +201,10 @@ describe "Budget Investments" do
select "Last 24 hours", from: "By date" select "Last 24 hours", from: "By date"
click_button "Filter" click_button "Filter"
expect(page).to have_content "There is 1 investment containing the term 'environment'" expect(page).to have_content "There is 1 investment"
expect(page).to have_css ".budget-investment", count: 1 expect(page).to have_css ".budget-investment", count: 1
expect(page).to have_content "Feasible environment" expect(page).to have_content "Feasible environment"
expect(page).not_to have_content "containing the term"
expect(page).not_to have_content "Feasible health" expect(page).not_to have_content "Feasible health"
expect(page).not_to have_content "Unfeasible environment" expect(page).not_to have_content "Unfeasible environment"
expect(page).not_to have_content "Unfeasible health" expect(page).not_to have_content "Unfeasible health"
@@ -209,9 +212,10 @@ describe "Budget Investments" do
click_link "Unfeasible" click_link "Unfeasible"
expect(page).not_to have_content "Feasible environment" expect(page).not_to have_content "Feasible environment"
expect(page).to have_content "There is 1 investment containing the term 'environment'" expect(page).to have_content "There is 1 investment"
expect(page).to have_css ".budget-investment", count: 1 expect(page).to have_css ".budget-investment", count: 1
expect(page).to have_content "Unfeasible environment" expect(page).to have_content "Unfeasible environment"
expect(page).not_to have_content "containing the term"
expect(page).not_to have_content "Feasible health" expect(page).not_to have_content "Feasible health"
expect(page).not_to have_content "Unfeasible health" expect(page).not_to have_content "Unfeasible health"
end end