Files
nairobi/spec/components/account/permissions_list_component_spec.rb
Javi Martín 2bac80215f Add permissions hint for visually impaired people
We were displaying an icon showing that certain actions can't be
performed. However, people who can't see the icons were hearing that
they _can_ perform certain actions while the opposite is true.

We've considered other options to solve this problem. One was to split
the list in two: actions that can be performed and actions that can't be
performed. It was tricky because in some cases we're listing that
actions that can be performed now and in other cases we're displaying
the actions that people will be able to perform once they verify their
account.

Another option was to include the word "Cannot" as a prefix instead of
"Additional verification needed". We haven't done so because, while in
English we say "cannot do this thing", in other languages they say
"this thing cannot do".

So we've gone with a solution where people hearing what's on the screen
know what's going on and we don't have to make big changes in the code.
2022-11-29 18:48:24 +01:00

18 lines
730 B
Ruby

require "rails_helper"
describe Account::PermissionsListComponent do
it "adds different classes for actions that can and cannot be performed" do
render_inline Account::PermissionsListComponent.new(User.new)
expect(page).to have_css "li.permission-allowed", text: "Participate in debates"
expect(page).to have_css "li.permission-denied", text: "Support proposals"
end
it "adds a hint when an action cannot be performed" do
render_inline Account::PermissionsListComponent.new(User.new)
expect(page).to have_css "li", exact_text: "Additional verification needed Support proposals", normalize_ws: true
expect(page).to have_css "li", exact_text: "Participate in debates", normalize_ws: true
end
end