Use a switch to toggle proposal selection

The button to select/deselect a proposal wasn't very intuitive; for
example, it wasn't obvious that pressing a button saying "selected"
would deselect the proposal.

So we're using a switch control, like we do to enable/disable features
since commit fabe97e50.
This commit is contained in:
Javi Martín
2021-08-20 02:58:10 +02:00
parent b127bd2f51
commit fec44c146c
7 changed files with 53 additions and 30 deletions

View File

@@ -0,0 +1,21 @@
require "rails_helper"
describe Admin::Proposals::ToggleSelectionComponent, :admin do
describe "aria-pressed attribute" do
it "is true for selected proposals" do
proposal = create(:proposal, :selected)
render_inline Admin::Proposals::ToggleSelectionComponent.new(proposal)
expect(page).to have_css "button[aria-pressed='true']"
end
it "is false for not selected proposals" do
proposal = create(:proposal)
render_inline Admin::Proposals::ToggleSelectionComponent.new(proposal)
expect(page).to have_css "button[aria-pressed='false']"
end
end
end