From bc912b53da7c6aa4af848edada5e4c663eaabbab Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Thu, 3 Apr 2025 19:41:32 +0200 Subject: [PATCH 01/16] Replace link with button in OmniAuth form component - and modified spec --- .../devise/omniauth_form_component.html.erb | 7 ++-- .../devise/omniauth_form_component_spec.rb | 16 ++++---- spec/system/users_auth_spec.rb | 38 +++++++++---------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/app/components/devise/omniauth_form_component.html.erb b/app/components/devise/omniauth_form_component.html.erb index 45e3097b6..e102e0c4f 100644 --- a/app/components/devise/omniauth_form_component.html.erb +++ b/app/components/devise/omniauth_form_component.html.erb @@ -8,10 +8,9 @@
<% oauth_logins.each do |login| %> <% end %>
diff --git a/spec/components/devise/omniauth_form_component_spec.rb b/spec/components/devise/omniauth_form_component_spec.rb index 9c9a6f814..b50009776 100644 --- a/spec/components/devise/omniauth_form_component_spec.rb +++ b/spec/components/devise/omniauth_form_component_spec.rb @@ -22,8 +22,8 @@ describe Devise::OmniauthFormComponent do render_inline component - expect(page).to have_link "Twitter" - expect(page).to have_link count: 1 + expect(page).to have_button "Twitter" + expect(page).to have_button count: 1 end it "renders the facebook link when the feature is enabled" do @@ -31,8 +31,8 @@ describe Devise::OmniauthFormComponent do render_inline component - expect(page).to have_link "Facebook" - expect(page).to have_link count: 1 + expect(page).to have_button "Facebook" + expect(page).to have_button count: 1 end it "renders the google link when the feature is enabled" do @@ -40,8 +40,8 @@ describe Devise::OmniauthFormComponent do render_inline component - expect(page).to have_link "Google" - expect(page).to have_link count: 1 + expect(page).to have_button "Google" + expect(page).to have_button count: 1 end it "renders the wordpress link when the feature is enabled" do @@ -49,8 +49,8 @@ describe Devise::OmniauthFormComponent do render_inline component - expect(page).to have_link "Wordpress" - expect(page).to have_link count: 1 + expect(page).to have_button "Wordpress" + expect(page).to have_button count: 1 end end end diff --git a/spec/system/users_auth_spec.rb b/spec/system/users_auth_spec.rb index 70ae3ea79..bdea11eb3 100644 --- a/spec/system/users_auth_spec.rb +++ b/spec/system/users_auth_spec.rb @@ -130,7 +130,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect_to_be_signed_in @@ -149,7 +149,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(new_user_session_path) expect(page).to have_content "To continue, please click on the confirmation " \ @@ -160,7 +160,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" expect_to_be_signed_in within("#notice") { click_button "Close" } @@ -177,7 +177,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) fill_in "Email", with: "manueladelascarmenas@example.com" @@ -191,7 +191,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" expect_to_be_signed_in within("#notice") { click_button "Close" } @@ -208,7 +208,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) click_link "Cancel login" @@ -228,7 +228,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" expect_to_be_signed_in @@ -247,7 +247,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) @@ -275,7 +275,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) expect(page).to have_field "Username", with: "manuela" @@ -296,7 +296,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" within("#notice") { click_button "Close" } click_link "My account" @@ -312,7 +312,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) @@ -332,7 +332,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" expect_to_be_signed_in within("#notice") { click_button "Close" } @@ -350,7 +350,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Twitter" + click_button "Sign up with Twitter" expect(page).to have_current_path(finish_signup_path) @@ -366,7 +366,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Twitter" + click_button "Sign in with Twitter" expect_to_be_signed_in within("#notice") { click_button "Close" } @@ -398,7 +398,7 @@ describe "Users" do create(:user, username: "manuela", email: "manuelacarmena@example.com") visit new_user_session_path - click_link "Sign in with Google" + click_button "Sign in with Google" expect_to_be_signed_in end @@ -423,7 +423,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Wordpress" + click_button "Sign up with Wordpress" expect(page).to have_current_path(new_user_session_path) expect(page).to have_content "To continue, please click on the confirmation " \ @@ -434,7 +434,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Wordpress" + click_button "Sign in with Wordpress" expect_to_be_signed_in within("#notice") { click_button "Close" } @@ -452,7 +452,7 @@ describe "Users" do visit "/" click_link "Register" - click_link "Sign up with Wordpress" + click_button "Sign up with Wordpress" expect(page).to have_current_path(finish_signup_path) @@ -475,7 +475,7 @@ describe "Users" do visit "/" click_link "Sign in" - click_link "Sign in with Wordpress" + click_button "Sign in with Wordpress" expect_to_be_signed_in From c6f0a3761b834c8bce623dbf9603d3e9abe78c2b Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Thu, 3 Apr 2025 22:18:34 +0200 Subject: [PATCH 02/16] Replace link with button in login items component - modified related specs - modified scss to keep new button same style as previous link --- app/assets/stylesheets/layout/account_menu.scss | 8 +++++++- app/components/layout/login_items_component.html.erb | 4 ++-- spec/components/layout/admin_header_component_spec.rb | 2 +- spec/system/moderation/users_spec.rb | 2 +- spec/system/polls/polls_spec.rb | 2 +- spec/system/sessions_spec.rb | 4 ++-- spec/system/users_auth_spec.rb | 4 ++-- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/layout/account_menu.scss b/app/assets/stylesheets/layout/account_menu.scss index 2d4f23d81..1539bc425 100644 --- a/app/assets/stylesheets/layout/account_menu.scss +++ b/app/assets/stylesheets/layout/account_menu.scss @@ -32,8 +32,10 @@ width: auto; } - a { + a, + button { color: inherit; + cursor: pointer; line-height: inherit; padding-left: 0; @@ -41,6 +43,10 @@ font-size: $small-font-size; padding: rem-calc(8) rem-calc(16); } + + &:hover { + text-decoration: underline; + } } .button { diff --git a/app/components/layout/login_items_component.html.erb b/app/components/layout/login_items_component.html.erb index 73220dffb..5758aaba2 100644 --- a/app/components/layout/login_items_component.html.erb +++ b/app/components/layout/login_items_component.html.erb @@ -18,8 +18,8 @@ t("layouts.header.my_account_link") %>
  • - <%= link_to t("devise_views.menu.login_items.logout"), - destroy_user_session_path, rel: "nofollow", method: :delete %> + <%= button_to t("devise_views.menu.login_items.logout"), + destroy_user_session_path, rel: "nofollow", method: :delete %>
  • <% else %>
  • diff --git a/spec/components/layout/admin_header_component_spec.rb b/spec/components/layout/admin_header_component_spec.rb index 61170b25e..9cf0c8a21 100644 --- a/spec/components/layout/admin_header_component_spec.rb +++ b/spec/components/layout/admin_header_component_spec.rb @@ -18,7 +18,7 @@ describe Layout::AdminHeaderComponent do expect(page).to have_link "You don't have new notifications" expect(page).to have_link "My content" expect(page).to have_link "My account" - expect(page).to have_link "Sign out" + expect(page).to have_button "Sign out" expect(page).to have_css "[data-toggle]" end diff --git a/spec/system/moderation/users_spec.rb b/spec/system/moderation/users_spec.rb index b9bd1ffa3..d1ba16bc6 100644 --- a/spec/system/moderation/users_spec.rb +++ b/spec/system/moderation/users_spec.rb @@ -39,7 +39,7 @@ describe "Moderate users" do expect(page).to have_css "h1", exact_text: debate3.title expect(page).not_to have_content(comment3.body) - click_link "Sign out" + click_button "Sign out" expect(page).to have_content "You have been signed out successfully" diff --git a/spec/system/polls/polls_spec.rb b/spec/system/polls/polls_spec.rb index 719572cb1..0030460c8 100644 --- a/spec/system/polls/polls_spec.rb +++ b/spec/system/polls/polls_spec.rb @@ -294,7 +294,7 @@ describe "Polls" do expect(page).to have_content "Vote introduced!" within("#notice") { click_button "Close" } - click_link "Sign out" + click_button "Sign out" expect(page).to have_content "You must sign in or register to continue." diff --git a/spec/system/sessions_spec.rb b/spec/system/sessions_spec.rb index 8f3a1803b..6a9eb8d8d 100644 --- a/spec/system/sessions_spec.rb +++ b/spec/system/sessions_spec.rb @@ -16,7 +16,7 @@ describe "Sessions" do within("#notice") { click_button "Close" } - click_link "Sign out" + click_button "Sign out" expect(page).to have_content("You have been signed out successfully") expect(page).to have_current_path(debate_path(debate)) @@ -63,7 +63,7 @@ describe "Sessions" do expect(page).to have_content(/errors prevented the verification of your residence/) - click_link "Sign out" + click_button "Sign out" expect(page).to have_content "You must sign in or register to continue." expect(page).to have_current_path new_user_session_path diff --git a/spec/system/users_auth_spec.rb b/spec/system/users_auth_spec.rb index bdea11eb3..970760354 100644 --- a/spec/system/users_auth_spec.rb +++ b/spec/system/users_auth_spec.rb @@ -85,7 +85,7 @@ describe "Users" do expect(page).to have_link "My content", href: user_path(u1) within("#notice") { click_button "Close" } - click_link "Sign out" + click_button "Sign out" expect(page).to have_content "You have been signed out successfully." @@ -495,7 +495,7 @@ describe "Users" do login_as(user) visit "/" - click_link "Sign out" + click_button "Sign out" expect(page).to have_content "You have been signed out successfully." end From 30979b2e96d9cc2f11512f11e26ff6c38fd7233c Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Fri, 4 Apr 2025 11:53:20 +0200 Subject: [PATCH 03/16] Replace link with button in author_actions - modified corresponding spec --- app/views/budgets/investments/_author_actions.html.erb | 6 +++--- spec/system/budgets/investments_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/budgets/investments/_author_actions.html.erb b/app/views/budgets/investments/_author_actions.html.erb index cd65a6ca8..6b65fef94 100644 --- a/app/views/budgets/investments/_author_actions.html.erb +++ b/app/views/budgets/investments/_author_actions.html.erb @@ -7,9 +7,9 @@ edit_budget_investment_path(investment.budget, investment), method: :get, class: "button hollow expanded" %> <% else %> - <%= link_to image_path(investment.image), - method: :delete, - class: "button hollow alert expanded" do %> + <%= button_to image_path(investment.image), + method: :delete, + class: "button hollow alert expanded" do %> <%= t("images.remove_image") %> <% end %> diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index 8cd5eaf96..ad1c07901 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -1715,7 +1715,7 @@ describe "Budget Investments" do within("aside") do expect(page).not_to have_content "Author" expect(page).not_to have_link "Edit" - expect(page).not_to have_link "Remove image" + expect(page).not_to have_button "Remove image" end end @@ -1728,7 +1728,7 @@ describe "Budget Investments" do within("aside") do expect(page).to have_content "AUTHOR" expect(page).to have_link "Edit" - expect(page).not_to have_link "Remove image" + expect(page).not_to have_button "Remove image" end end @@ -1742,7 +1742,7 @@ describe "Budget Investments" do within("aside") do expect(page).to have_content "AUTHOR" expect(page).not_to have_link "Edit" - expect(page).to have_link "Remove image" + expect(page).to have_button "Remove image" end end end From c7827136cdbe62894671f3f9be38d22ddbc59c92 Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Thu, 10 Apr 2025 15:54:46 +0200 Subject: [PATCH 04/16] Replace link with button in mailing options --- app/views/dashboard/mailing/_mailing_options.html.erb | 7 +++---- spec/system/dashboard/mailing_spec.rb | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/views/dashboard/mailing/_mailing_options.html.erb b/app/views/dashboard/mailing/_mailing_options.html.erb index fce44db6d..d3c00df4e 100644 --- a/app/views/dashboard/mailing/_mailing_options.html.erb +++ b/app/views/dashboard/mailing/_mailing_options.html.erb @@ -5,8 +5,7 @@ class: "button expanded" %> <% end %> - <%= link_to t("dashboard.mailing.mailing_options.send", address: current_user.email), - proposal_dashboard_mailing_index_path(proposal), - method: :post, - class: "button expanded" %> + <%= button_to t("dashboard.mailing.mailing_options.send", address: current_user.email), + proposal_dashboard_mailing_index_path(proposal), + class: "button expanded" %> diff --git a/spec/system/dashboard/mailing_spec.rb b/spec/system/dashboard/mailing_spec.rb index f890b8d60..a6125ecc7 100644 --- a/spec/system/dashboard/mailing_spec.rb +++ b/spec/system/dashboard/mailing_spec.rb @@ -13,11 +13,11 @@ describe "Mailing" do end scenario "Has a link to send the mail" do - expect(page).to have_link("Send to #{proposal.author.email}") + expect(page).to have_button("Send to #{proposal.author.email}") end scenario "User receives feedback after the email is sent" do - click_link "Send to #{proposal.author.email}" + click_button "Send to #{proposal.author.email}" expect(page).to have_content("The email has been sent") end @@ -31,6 +31,6 @@ describe "Mailing" do click_link "Preview" expect(page).not_to have_link("Preview") - expect(page).to have_link("Send to #{proposal.author.email}") + expect(page).to have_button("Send to #{proposal.author.email}") end end From 31ceb312567f9f56c41cfe798a3939b6e6c9bfa7 Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Fri, 11 Apr 2025 08:34:13 +0200 Subject: [PATCH 05/16] Replace link with button in Dashboard show --- app/views/dashboard/show.html.erb | 9 +++++---- spec/system/dashboard/dashboard_spec.rb | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/dashboard/show.html.erb b/app/views/dashboard/show.html.erb index f698f1ca1..d76cd9f7b 100644 --- a/app/views/dashboard/show.html.erb +++ b/app/views/dashboard/show.html.erb @@ -13,8 +13,9 @@ <% end %> <% if can?(:publish, proposal) %> - <%= link_to t("dashboard.index.publish"), - publish_proposal_dashboard_path(proposal), - class: "button success", - method: :patch %> + <%= button_to t("dashboard.index.publish"), + publish_proposal_dashboard_path(proposal), + class: "button success", + form_class: "button_to inline", + method: :patch %> <% end %> diff --git a/spec/system/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb index b318c1dc7..379478cec 100644 --- a/spec/system/dashboard/dashboard_spec.rb +++ b/spec/system/dashboard/dashboard_spec.rb @@ -10,17 +10,17 @@ describe "Proposal's dashboard" do expect(page).to have_link("Edit my proposal") expect(page).to have_link("Edit proposal") expect(page).to have_link("Withdraw proposal") - expect(page).to have_link("Publish proposal") + expect(page).to have_button("Publish proposal") expect(page).to have_link("Polls") expect(page).to have_link("E-mail") expect(page).to have_link("Poster") end - scenario "Publish link dissapears after proposal's publication" do + scenario "Publish button dissapears after proposal's publication" do visit proposal_dashboard_path(proposal) - click_link "Publish proposal" + click_button "Publish proposal" - expect(page).not_to have_link("Publish proposal") + expect(page).not_to have_button("Publish proposal") end scenario "Dashboard progress shows current goal" do From ddfd1bedb32ba7364087e96348a016af24e6afff Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Fri, 11 Apr 2025 20:04:33 +0200 Subject: [PATCH 06/16] Replace link with button in devise shared links Cf. conversation https://github.com/consuldemocracy/consuldemocracy/pull/5955#discussion_r2158715957 Need to get this i18n_spec.rb to run to delete the key shared.links.signin_with_provider. --- app/views/devise/shared/_links.html.erb | 6 ------ config/locales/en/devise_views.yml | 1 - config/locales/es/devise_views.yml | 1 - 3 files changed, 8 deletions(-) diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index d4f343b14..13f51a9b1 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -11,10 +11,4 @@ <%= link_to t("devise_views.shared.links.new_unlock"), new_unlock_path(resource_name) %>
    <% end -%> - <%- if devise_mapping.omniauthable? && devise_mapping.name == "user" %> - <%- resource_class.omniauth_providers.each do |provider| %> - <%= link_to t("devise_views.shared.links.signin_with_provider", provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), method: :post %>
    - <% end -%> - <% end -%> - diff --git a/config/locales/en/devise_views.yml b/config/locales/en/devise_views.yml index 85e95184f..82a67bb18 100644 --- a/config/locales/en/devise_views.yml +++ b/config/locales/en/devise_views.yml @@ -69,7 +69,6 @@ en: new_confirmation: Haven't received instructions to activate your account? new_password: Forgotten your password? new_unlock: Haven't received unlocking instructions? - signin_with_provider: Sign in with %{provider} signup: Don't have an account? %{signup_link} signup_link: Sign up unlocks: diff --git a/config/locales/es/devise_views.yml b/config/locales/es/devise_views.yml index 5e3d5a40e..a18c8f6c5 100644 --- a/config/locales/es/devise_views.yml +++ b/config/locales/es/devise_views.yml @@ -69,7 +69,6 @@ es: new_confirmation: '¿No has recibido instrucciones para confirmar tu cuenta?' new_password: '¿Olvidaste tu contraseña?' new_unlock: '¿No has recibido instrucciones para desbloquear?' - signin_with_provider: Entrar con %{provider} signup: '¿No tienes una cuenta? %{signup_link}' signup_link: Regístrate unlocks: From e370a5265091d0a7a5bc1c8efdb47b4fe3ea7daf Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Mon, 14 Apr 2025 10:40:25 +0200 Subject: [PATCH 07/16] Replace link with buttons in follow button --- app/views/follows/_follow_button.html.erb | 22 ++++++++++----------- spec/shared/system/followable.rb | 24 +++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/views/follows/_follow_button.html.erb b/app/views/follows/_follow_button.html.erb index 3b1305867..4713975e9 100644 --- a/app/views/follows/_follow_button.html.erb +++ b/app/views/follows/_follow_button.html.erb @@ -1,19 +1,19 @@
    <% if follow.followable.followed_by?(current_user) %> - <%= link_to t("shared.following"), - follow_path(follow), - method: :delete, remote: true, - title: unfollow_text(follow.followable), - class: "button expanded" %> + <%= button_to t("shared.following"), + follow_path(follow), + method: :delete, remote: true, + title: unfollow_text(follow.followable), + class: "button expanded" %> <% else %> - <%= link_to follow_text(follow.followable), - follows_path(followable_id: follow.followable.id, - followable_type: follow.followable.class.name), - method: :post, remote: true, - title: follow_text(follow.followable), - class: "button hollow expanded" %> + <%= button_to follow_text(follow.followable), + follows_path(followable_id: follow.followable.id, + followable_type: follow.followable.class.name), + remote: true, + title: follow_text(follow.followable), + class: "button hollow expanded" %> <% end %>
    diff --git a/spec/shared/system/followable.rb b/spec/shared/system/followable.rb index 0d754d8e0..477626354 100644 --- a/spec/shared/system/followable.rb +++ b/spec/shared/system/followable.rb @@ -17,7 +17,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - expect(page).not_to have_link("Follow") + expect(page).not_to have_button("Follow") end end @@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - expect(page).to have_link("Follow #{followable.model_name.human.downcase}") + expect(page).to have_button("Follow #{followable.model_name.human.downcase}") end end @@ -37,7 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa login_as(user) visit send(followable_path, arguments) - expect(page).to have_link("Follow #{followable.model_name.human.downcase}") + expect(page).to have_button("Follow #{followable.model_name.human.downcase}") end scenario "Should display unfollow after user clicks on follow button" do @@ -46,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - click_link("Follow #{followable.model_name.human.downcase}") + click_button("Follow #{followable.model_name.human.downcase}") - expect(page).not_to have_link("Follow") - expect(page).to have_link("Following") + expect(page).not_to have_button("Follow") + expect(page).to have_button("Following") end end @@ -59,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - click_link("Follow #{followable.model_name.human.downcase}") + click_button("Follow #{followable.model_name.human.downcase}") end expect(page).to have_content "We will notify you of changes as they occur" @@ -71,7 +71,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) - expect(page).to have_link("Following") + expect(page).to have_button("Following") end scenario "Updates follow button & show destroy notice after unfollow button is clicked" do @@ -80,10 +80,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - click_link("Unfollow #{followable.model_name.human.downcase}") + click_button("Unfollow #{followable.model_name.human.downcase}") - expect(page).not_to have_link("Unfollow") - expect(page).to have_link("Follow #{followable.model_name.human.downcase}") + expect(page).not_to have_button("Unfollow") + expect(page).to have_button("Follow #{followable.model_name.human.downcase}") end end @@ -93,7 +93,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa visit send(followable_path, arguments) within "##{dom_id(followable)}" do - click_link("Unfollow #{followable.model_name.human.downcase}") + click_button("Unfollow #{followable.model_name.human.downcase}") end expect(page).to have_content "You will no longer receive notifications" From 267dd931d89c000a348b2089ea0c504aed98d73b Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Mon, 14 Apr 2025 11:36:52 +0200 Subject: [PATCH 08/16] Replace link with button in change user link --- app/views/management/_account_info.html.erb | 8 ++++---- spec/system/management/managed_users_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/management/_account_info.html.erb b/app/views/management/_account_info.html.erb index ab37d813b..da2f9d818 100644 --- a/app/views/management/_account_info.html.erb +++ b/app/views/management/_account_info.html.erb @@ -1,9 +1,9 @@ <% if managed_user.document_number.present? %>
  • diff --git a/spec/system/notifications_spec.rb b/spec/system/notifications_spec.rb index f139f1d43..a8168850c 100644 --- a/spec/system/notifications_spec.rb +++ b/spec/system/notifications_spec.rb @@ -59,7 +59,7 @@ describe "Notifications" do click_notifications_icon within("#notification_#{notification1.id}") do - click_link "Mark as read" + click_button "Mark as read" end expect(page).to have_css(".notification", count: 1) @@ -89,7 +89,7 @@ describe "Notifications" do expect(page).to have_css(".notification", count: 1) within("#notification_#{notification1.id}") do - click_link "Mark as unread" + click_button "Mark as unread" end expect(page).to have_css(".notification", count: 0) From ddd34d5cd00ef7768dee8433c5a8685486e9d8ff Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Wed, 16 Apr 2025 09:54:38 +0200 Subject: [PATCH 10/16] Replace link with button in index notifications --- app/views/notifications/index.html.erb | 8 ++++---- spec/system/notifications_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index 95ef36e03..33e3b21cd 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -5,10 +5,10 @@ <%= t("notifications.index.title") %> - <%= link_to t("notifications.index.mark_all_as_read"), - mark_all_as_read_notifications_path, - method: :put, - class: "button hollow float-right-medium" %> + <%= button_to t("notifications.index.mark_all_as_read"), + mark_all_as_read_notifications_path, + method: :put, + class: "button hollow float-right-medium" %> diff --git a/spec/system/verification/letter_spec.rb b/spec/system/verification/letter_spec.rb index 5905677fc..6d4a7a3af 100644 --- a/spec/system/verification/letter_spec.rb +++ b/spec/system/verification/letter_spec.rb @@ -8,7 +8,7 @@ describe "Verify Letter" do login_as(user) visit new_letter_path - click_link "Send me a letter with the code" + click_button "Send me a letter with the code" expect(page).to have_content "Thank you for requesting your maximum security code " \ "(only required for the final votes). In a few days " \ diff --git a/spec/system/verification/level_three_verification_spec.rb b/spec/system/verification/level_three_verification_spec.rb index c692e1f3b..3df265ace 100644 --- a/spec/system/verification/level_three_verification_spec.rb +++ b/spec/system/verification/level_three_verification_spec.rb @@ -76,7 +76,7 @@ describe "Level three verification" do verify_residence confirm_phone(code: "1234") - click_link "Send me a letter with the code" + click_button "Send me a letter with the code" expect(page).to have_content "Thank you for requesting your maximum security code " \ "(only required for the final votes). In a few days " \