Use a button to mark debates as featured
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:
@@ -4,4 +4,12 @@
|
||||
&::before {
|
||||
@include vertical-separator;
|
||||
}
|
||||
|
||||
form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
button {
|
||||
@include link;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<div class="mark-featured-action">
|
||||
<% if debate.featured? %>
|
||||
<%= link_to t("admin.actions.unmark_featured").capitalize,
|
||||
unmark_featured_debate_path(debate),
|
||||
method: :put,
|
||||
data: { confirm: t("admin.actions.confirm_action",
|
||||
action: t("admin.actions.unmark_featured"),
|
||||
name: debate.title) } %>
|
||||
<%= button_to t("admin.actions.unmark_featured").capitalize,
|
||||
unmark_featured_debate_path(debate),
|
||||
method: :put,
|
||||
data: { confirm: t("admin.actions.confirm_action",
|
||||
action: t("admin.actions.unmark_featured"),
|
||||
name: debate.title) } %>
|
||||
<% else %>
|
||||
<%= link_to t("admin.actions.mark_featured").capitalize,
|
||||
mark_featured_debate_path(debate),
|
||||
method: :put,
|
||||
data: { confirm: t("admin.actions.confirm_action",
|
||||
action: t("admin.actions.mark_featured"),
|
||||
name: debate.title) } %>
|
||||
<%= button_to t("admin.actions.mark_featured").capitalize,
|
||||
mark_featured_debate_path(debate),
|
||||
method: :put,
|
||||
data: { confirm: t("admin.actions.confirm_action",
|
||||
action: t("admin.actions.mark_featured"),
|
||||
name: debate.title) } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -748,7 +748,7 @@ describe "Debates" do
|
||||
end
|
||||
|
||||
click_link debate.title
|
||||
accept_confirm("Are you sure? Featured") { click_link "Featured" }
|
||||
accept_confirm("Are you sure? Featured") { click_button "Featured" }
|
||||
|
||||
within("#debates") do
|
||||
expect(page).to have_content "FEATURED"
|
||||
@@ -760,7 +760,7 @@ describe "Debates" do
|
||||
click_link debate.title
|
||||
end
|
||||
|
||||
accept_confirm("Are you sure? Unmark featured") { click_link "Unmark featured" }
|
||||
accept_confirm("Are you sure? Unmark featured") { click_button "Unmark featured" }
|
||||
|
||||
within("#debates") do
|
||||
expect(page).not_to have_content "FEATURED"
|
||||
|
||||
Reference in New Issue
Block a user