From 87a5dd8ee5a016c198cc3fd1090582edc40dcefe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 11 Oct 2024 05:06:22 +0200 Subject: [PATCH] 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. --- .../debates/mark_featured_action.scss | 8 +++++++ .../mark_featured_action_component.html.erb | 24 +++++++++---------- spec/system/debates_spec.rb | 4 ++-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/debates/mark_featured_action.scss b/app/assets/stylesheets/debates/mark_featured_action.scss index f43861a6b..3684c90b8 100644 --- a/app/assets/stylesheets/debates/mark_featured_action.scss +++ b/app/assets/stylesheets/debates/mark_featured_action.scss @@ -4,4 +4,12 @@ &::before { @include vertical-separator; } + + form { + display: inline; + } + + button { + @include link; + } } diff --git a/app/components/debates/mark_featured_action_component.html.erb b/app/components/debates/mark_featured_action_component.html.erb index 9e2023e42..5d7fe6565 100644 --- a/app/components/debates/mark_featured_action_component.html.erb +++ b/app/components/debates/mark_featured_action_component.html.erb @@ -1,17 +1,17 @@ diff --git a/spec/system/debates_spec.rb b/spec/system/debates_spec.rb index ff1b499d5..7496e10af 100644 --- a/spec/system/debates_spec.rb +++ b/spec/system/debates_spec.rb @@ -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"