mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
fix: fix tests
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -82,7 +82,9 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
|
||||
get reports_path(period_type: :monthly)
|
||||
assert_response :ok
|
||||
assert_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")
|
||||
end
|
||||
end
|
||||
|
||||
test "index handles invalid date parameters gracefully" do
|
||||
@@ -236,6 +238,12 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
get 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/
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user