Specify group in the "No headings" message

Since the message might appear several times on the same page, it's
useful to give a bit more context. Besides, usability tests show that
when there's a group with no headings, there's no clear indication on
the page that the group is actually a group and not a heading.

We're also adding some emphasis to the group name in the "Showing
headings" message, to be consistent with the emphasis we've
added the the group name in the "No headings" message.
This commit is contained in:
Javi Martín
2021-09-10 01:44:09 +02:00
parent d702fbbfc7
commit 4d0638d5df
9 changed files with 32 additions and 14 deletions

View File

@@ -0,0 +1,12 @@
require "rails_helper"
describe Admin::BudgetHeadings::HeadingsComponent do
it "includes group name in the message when there are no headings" do
group = create(:budget_group, name: "Whole planet")
render_inline Admin::BudgetHeadings::HeadingsComponent.new(group.headings)
expect(page.text.strip).to eq "There are no headings in the Whole planet group."
expect(page).to have_css "strong", exact_text: "Whole planet"
end
end