Use a button to toggle proposal selection
As mentioned in commit 5311daadf, using buttons for non-GET requests has
several advantages over using links.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
<%= link_to text, path, options %>
|
<%= button_to text, path, options %>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ describe "Admin collaborative legislation", :admin do
|
|||||||
proposal = create(:legislation_proposal, cached_votes_score: 10)
|
proposal = create(:legislation_proposal, cached_votes_score: 10)
|
||||||
|
|
||||||
visit admin_legislation_process_proposals_path(proposal.legislation_process_id)
|
visit admin_legislation_process_proposals_path(proposal.legislation_process_id)
|
||||||
click_link "Select"
|
click_button "Select"
|
||||||
|
|
||||||
within "#legislation_proposal_#{proposal.id}" do
|
within "#legislation_proposal_#{proposal.id}" do
|
||||||
expect(page).to have_content("Selected")
|
expect(page).to have_content("Selected")
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ describe "Admin proposals", :admin do
|
|||||||
|
|
||||||
visit admin_proposals_path
|
visit admin_proposals_path
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { click_link "Select" }
|
within("#proposal_#{proposal.id}") { click_button "Select" }
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { expect(page).to have_link "Selected" }
|
within("#proposal_#{proposal.id}") { expect(page).to have_button "Selected" }
|
||||||
|
|
||||||
refresh
|
refresh
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { expect(page).to have_link "Selected" }
|
within("#proposal_#{proposal.id}") { expect(page).to have_button "Selected" }
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Unselect a proposal" do
|
scenario "Unselect a proposal" do
|
||||||
@@ -40,13 +40,13 @@ describe "Admin proposals", :admin do
|
|||||||
|
|
||||||
visit admin_proposals_path
|
visit admin_proposals_path
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { click_link "Selected" }
|
within("#proposal_#{proposal.id}") { click_button "Selected" }
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { expect(page).to have_link "Select" }
|
within("#proposal_#{proposal.id}") { expect(page).to have_button "Select" }
|
||||||
|
|
||||||
refresh
|
refresh
|
||||||
|
|
||||||
within("#proposal_#{proposal.id}") { expect(page).to have_link "Select" }
|
within("#proposal_#{proposal.id}") { expect(page).to have_button "Select" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user