The personal finance app for everyone (by everyone)
Ruby
Lead the bill drawer with its figure and use one eyebrow style (#4098)
Guillem Arias Fausteceb2065c19f9
diff --git a/app/views/bills/_month_pulse.html.erb b/app/views/bills/_month_pulse.html.erbindex 0224003d42..3ead012f53 100644--- a/app/views/bills/_month_pulse.html.erb+++ b/app/views/bills/_month_pulse.html.erb@@ -17,7 +17,7 @@<div class="bg-container rounded-xl shadow-border-xs p-4 space-y-4"><div class="flex items-baseline justify-between gap-3">- <p class="text-xs font-medium uppercase tracking-wide text-secondary"><%= l(Date.current, format: "%B") %></p>+ <p class="text-xs font-medium uppercase text-secondary"><%= l(Date.current, format: "%B") %></p><p class="text-xs text-secondary"><%= t(".bill_count", count: @month_bill_count) %></p></div>@@ -76,7 +76,7 @@<% if @next_up.any? %><div class="pt-3 border-t border-subdued space-y-2"><div class="flex items-center justify-between gap-3">- <p class="text-xs font-medium uppercase tracking-wide text-secondary"><%= t(".next_up") %></p>+ <p class="text-xs font-medium uppercase text-secondary"><%= t(".next_up") %></p><%= render DS::Link.new(text: t(".view_calendar"),variant: :default,diff --git a/app/views/bills/_paycheck_income.html.erb b/app/views/bills/_paycheck_income.html.erbindex 4d44e990fe..f9e2d5894b 100644--- a/app/views/bills/_paycheck_income.html.erb+++ b/app/views/bills/_paycheck_income.html.erb@@ -6,7 +6,7 @@<% disclosure.with_summary_content do %><div class="flex items-baseline justify-between gap-3"><div class="min-w-0">- <p class="text-xs font-medium uppercase tracking-wide text-secondary">+ <p class="text-xs font-medium uppercase text-secondary"><%= t("bills.paycheck.income_section_title") %></p><% if @next_income %>diff --git a/app/views/bills/_summary.html.erb b/app/views/bills/_summary.html.erbindex 1a3e305185..0037ae7448 100644--- a/app/views/bills/_summary.html.erb+++ b/app/views/bills/_summary.html.erb@@ -8,19 +8,21 @@<div class="space-y-4"><%= render "bills/cancelled_notice", series: series %>- <%# Current state. %>+ <%# Current state, at the size the payment drawer and a transaction's+ drawer give their headline figure. At text-lg it matched the bill's name+ above it, so the drawer had no figure to lead with. %><% if current_occurrence %><% expected = current_occurrence.resolved_expected_amount_money %><% paid = current_occurrence.confirmed_allocated_money %><div class="space-y-0.5">- <p class="text-lg font-medium text-primary privacy-sensitive">+ <p class="text-2xl font-medium text-primary privacy-sensitive"><% if current_occurrence.paid? %><%= t("bills.summary.paid_headline", amount: format_money(paid)) %><% else %><%= t("bills.summary.remaining", amount: format_money(current_occurrence.remaining_amount_money)) %><% end %></p>- <p class="text-xs <%= current_occurrence.overdue? ? "text-destructive" : "text-secondary" %>">+ <p class="text-sm <%= current_occurrence.overdue? ? "text-destructive" : "text-secondary" %>"><span class="privacy-sensitive"><%= t("bills.partial_progress", paid: format_money(paid), expected: format_money(expected)) %></span>· <%= occurrence_due_label(current_occurrence) %></p>@@ -36,10 +38,10 @@</div><% else %><div class="space-y-0.5">- <p class="text-lg font-medium text-primary privacy-sensitive">+ <p class="text-2xl font-medium text-primary privacy-sensitive"><%= "~" if series.has_amount_variance? %><%= format_money(Money.new(series.amount.abs, series.currency)) %></p>- <p class="text-xs text-secondary">+ <p class="text-sm text-secondary"><%= series.next_expected_date.present? ? t("bills.detail.around", date: bills_upcoming_date(series.next_expected_date)) : t("bills.detail.next_payment") %></p></div>diff --git a/test/controllers/bills_controller_test.rb b/test/controllers/bills_controller_test.rbindex 5bb10b3923..1ee8cd7aa0 100644--- a/test/controllers/bills_controller_test.rb+++ b/test/controllers/bills_controller_test.rb@@ -1058,6 +1058,33 @@ class BillsControllerTest < ActionDispatch::IntegrationTestassert_match I18n.t("bills.summary.remaining", amount: "$15.99"), response.bodyend+ # The drawer leads with its figure at the size the payment drawer and a+ # transaction's drawer use. At text-lg it matched the bill's own name.+ test "the bill drawer's figure leads at the payment drawer's size" do+ bill = create_bill(name: "Streaming Plus", amount: 15.99)++ get_bill_drawer(bill)+ assert_select "dialog p.text-2xl", text: I18n.t("bills.summary.remaining", amount: "$15.99")++ occurrence = bill.recurring_occurrences.open_status.order(:due_on).first+ get recurring_occurrence_url(occurrence), headers: { "Turbo-Frame" => "drawer" }+ assert_select "dialog p.text-2xl", text: I18n.t("recurring_occurrences.show.remaining", amount: "$15.99")+ end++ # One eyebrow style per page: the pulse's tracked labels sat over sections+ # whose headings use the same xs uppercase without the tracking.+ test "the overview and the income plan label things with one eyebrow style" do+ create_bill(name: "Rent", amount: 1200)+ declare_income(name: "Paycheck", amount: -1840, payday: Date.current + 3)++ [ bills_url, bills_url(view: "paycheck") ].each do |url|+ get url+ assert_response :success+ assert_select "main .uppercase", minimum: 1+ assert_select "main [class~='tracking-wide']", count: 0, message: "#{url} still tracks an eyebrow"+ end+ end+# The id is resolved through the series, so one from another bill cannot be# borrowed to render someone else's cycle.test "an occurrence id from another bill is ignored" do