Use buttons instead of links to hide content
We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.
Since we're using the admin action component, we can also simplify the
logic handling the confirmation message.
In order to avoid duplicate IDs when generating buttons to block the
same author more than once in a page, we're including the record dom_id
in the ID of the button to block an author.
This commit is contained in:
@@ -14,7 +14,7 @@ describe "Admin activity" do
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
accept_confirm("Are you sure? Hide \"#{proposal.title}\"") { click_link "Hide" }
|
||||
accept_confirm("Are you sure? Hide \"#{proposal.title}\"") { click_button "Hide" }
|
||||
end
|
||||
expect(page).to have_css("#proposal_#{proposal.id}.faded")
|
||||
|
||||
@@ -82,7 +82,7 @@ describe "Admin activity" do
|
||||
visit debate_path(debate)
|
||||
|
||||
within("#debate_#{debate.id}") do
|
||||
accept_confirm("Are you sure? Hide \"#{debate.title}\"") { click_link "Hide" }
|
||||
accept_confirm("Are you sure? Hide \"#{debate.title}\"") { click_button "Hide" }
|
||||
end
|
||||
expect(page).to have_css("#debate_#{debate.id}.faded")
|
||||
|
||||
@@ -150,7 +150,7 @@ describe "Admin activity" do
|
||||
visit debate_path(debate)
|
||||
|
||||
within("#comment_#{comment.id}") do
|
||||
accept_confirm("Are you sure? Hide \"#{comment.body}\"") { click_link "Hide" }
|
||||
accept_confirm("Are you sure? Hide \"#{comment.body}\"") { click_button "Hide" }
|
||||
expect(page).to have_css(".faded")
|
||||
end
|
||||
|
||||
@@ -217,7 +217,7 @@ describe "Admin activity" do
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
accept_confirm("Are you sure? Block author \"#{proposal.author.name}\"") { click_link "Block author" }
|
||||
accept_confirm("Are you sure? Block author \"#{proposal.author.name}\"") { click_button "Block author" }
|
||||
|
||||
expect(page).to have_current_path(proposals_path)
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ describe "Admin hidden comments", :admin do
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
accept_confirm("Are you sure? Block author \"#{proposal.author.name}\"") { click_link "Block author" }
|
||||
accept_confirm("Are you sure? Block author \"#{proposal.author.name}\"") { click_button "Block author" }
|
||||
end
|
||||
|
||||
expect(page).to have_current_path proposals_path
|
||||
|
||||
Reference in New Issue
Block a user