The personal finance app for everyone (by everyone)
Ruby
fix: fix tests
Alessio Cappa96dfad1cfb02
diff --git a/app/views/reports/_category_row.html.erb b/app/views/reports/_category_row.html.erbindex 7092180380..449cac8bb6 100644--- a/app/views/reports/_category_row.html.erb+++ b/app/views/reports/_category_row.html.erb@@ -3,7 +3,7 @@is_sub = level == :subcategory%>-<div class="grid grid-cols-4 items-center text-secondary text-sm py-3 px-4 lg:px-6 <%= is_sub ? "pl-7 lg:pl-9" : "" %>">+<div data-category="category-<%= item[:category_id] %>" class="grid grid-cols-4 items-center text-secondary text-sm py-3 px-4 lg:px-6 <%= is_sub ? "pl-7 lg:pl-9" : "" %>"><div class="col-span-2 flex items-center gap-2"><% if is_sub %><div class="text-subdued">diff --git a/app/views/reports/_trends_insights.html.erb b/app/views/reports/_trends_insights.html.erbindex 5f5f865c7a..5e14172854 100644--- a/app/views/reports/_trends_insights.html.erb+++ b/app/views/reports/_trends_insights.html.erb@@ -8,7 +8,7 @@<% if trends_data.any? %><div class="bg-container-inset rounded-xl p-1 overflow-x-auto"><div class="w-max sm:w-full">- <div class="grid grid-cols-5 items-center uppercase text-xs font-medium text-secondary px-4 py-2">+ <div role="columnheader" class="grid grid-cols-5 items-center uppercase text-xs font-medium text-secondary px-4 py-2"><div class="font-medium text-secondary"><%= t("reports.trends.month") %></div><div class="text-right font-medium text-secondary"><%= t("reports.trends.income") %></div><div class="text-right font-medium text-secondary"><%= t("reports.trends.expenses") %></div>diff --git a/test/controllers/reports_controller_test.rb b/test/controllers/reports_controller_test.rbindex a4524382d7..afc81abd3f 100644--- a/test/controllers/reports_controller_test.rb+++ b/test/controllers/reports_controller_test.rb@@ -82,7 +82,9 @@ class ReportsControllerTest < ActionDispatch::IntegrationTestget reports_path(period_type: :monthly)assert_response :okassert_select "h2", text: I18n.t("reports.trends.title")- assert_select "th", text: I18n.t("reports.trends.month")+ assert_select '[role="columnheader"]' do+ assert_select "div", text: I18n.t("reports.trends.month")+ endendtest "index handles invalid date parameters gracefully" do@@ -236,6 +238,12 @@ class ReportsControllerTest < ActionDispatch::IntegrationTestget reports_path(period_type: :monthly)assert_response :ok- assert_select "table.w-full"++ # Parent category+ assert_select "div[data-category='category-#{parent_category.id}']", text: /^Entertainment/++ # Subcategories+ assert_select "div[data-category='category-#{subcategory_movies.id}']", text: /^Movies/+ assert_select "div[data-category='category-#{subcategory_games.id}']", text: /^Games/endend