Files
nairobi/spec/components/users/budget_investment_table_actions_component_spec.rb
Javi Martín 2fb8eaf6c7 Add aria-labels to user investment actions
This way it'll be easier for people using screen readers to know which
link/button they're about to click.

Note that, at least for now, we aren't reusing the code en
`Admin::ActionComponent`. We might do so in the future if we implement
similar code in more parts of the public area.
2024-11-08 12:29:37 +01:00

32 lines
981 B
Ruby

require "rails_helper"
describe Users::BudgetInvestmentTableActionsComponent do
let(:user) { create(:user, :level_two) }
let(:budget) { create(:budget, :accepting) }
let(:investment) { create(:budget_investment, budget: budget, author: user, title: "User investment") }
describe "#edit_link" do
it "generates an aria-label attribute" do
sign_in(user)
render_inline Users::BudgetInvestmentTableActionsComponent.new(investment)
expect(page).to have_link count: 1
expect(page).to have_link "Edit"
expect(page).to have_css "a[aria-label='Edit User investment']"
end
end
describe "#destroy_button" do
it "generates an aria-label attribute" do
sign_in(user)
render_inline Users::BudgetInvestmentTableActionsComponent.new(investment)
expect(page).to have_button count: 1
expect(page).to have_button "Delete"
expect(page).to have_css "button[aria-label='Delete User investment']"
end
end
end