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.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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
|
||||
Reference in New Issue
Block a user