Move result percentages out of the voting buttons

Having buttons (previously links) with the text "I agree 75%" is
confusing; people might believe they're saying they only partially agree
with the content. Besides, the results percentages is a different piece
of information which shouldn't be related to whether one person
agrees/disagrees with the content.

This problem might be solved for people using screen readers since we
added the aria-label attribute. However, for sighted keyboard users, the
percentage was being outlined on focus as part of the button, which
might be confusing.
This commit is contained in:
Javi Martín
2022-01-13 19:50:27 +01:00
parent 8c1b4d9ea7
commit eecaf5876e
4 changed files with 51 additions and 18 deletions

View File

@@ -25,5 +25,19 @@ describe Debates::VotesComponent do
expect(page).to have_button "I don't agree with What about the 2030 agenda?"
expect(page).not_to have_content "You must sign in or sign up to continue."
end
it "does not include result percentages" do
create(:vote, votable: debate)
sign_in(create(:user))
render_inline component
expect(page).to have_button count: 2
expect(page).to have_button "I agree"
expect(page).to have_button "I disagree"
expect(page).not_to have_button text: "%"
expect(page).not_to have_button text: "100"
expect(page).not_to have_button text: "0"
end
end
end