Use a button to delete surveys

As mentioned in commit 5311daadf, there are several reasons to use
buttons in these situations. And, as mentioned in the previous commits,
using buttons instead of links for actions requiring confirmation will
help us test for accessibility issues.
This commit is contained in:
Javi Martín
2024-10-11 04:39:32 +02:00
parent 11ef917802
commit d85a87a517
3 changed files with 15 additions and 7 deletions

View File

@@ -442,6 +442,14 @@
.button {
font-weight: bold;
}
button {
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
}
.community-poll {

View File

@@ -27,10 +27,10 @@
<% end %>
<p class="help-text"><%= t("dashboard.polls.poll.show_results_help") %></p>
<%= link_to t("dashboard.polls.poll.delete"),
proposal_dashboard_poll_path(proposal, poll),
method: :delete,
"data-confirm": t("dashboard.polls.poll.alert_notice"),
class: "delete" %>
<%= button_to t("dashboard.polls.poll.delete"),
proposal_dashboard_poll_path(proposal, poll),
method: :delete,
"data-confirm": t("dashboard.polls.poll.alert_notice"),
class: "delete" %>
</div>
</div>

View File

@@ -199,7 +199,7 @@ describe "Polls" do
visit proposal_dashboard_polls_path(proposal)
within("#poll_#{poll.id}") do
accept_confirm { click_link "Delete survey" }
accept_confirm { click_button "Delete survey" }
end
expect(page).to have_content("Survey deleted successfully")
@@ -214,7 +214,7 @@ describe "Polls" do
visit proposal_dashboard_polls_path(proposal)
within("#poll_#{poll.id}") do
accept_confirm { click_link "Delete survey" }
accept_confirm { click_button "Delete survey" }
end
expect(page).to have_content("You cannot destroy a survey that has responses")