diff --git a/admin/app/components/solidus_admin/sidebar/account_nav/component.html.erb b/admin/app/components/solidus_admin/sidebar/account_nav/component.html.erb index 0082c3ee4a4..fd4a4d3f359 100644 --- a/admin/app/components/solidus_admin/sidebar/account_nav/component.html.erb +++ b/admin/app/components/solidus_admin/sidebar/account_nav/component.html.erb @@ -58,7 +58,7 @@ <% end %>
  • - <%= link_to @logout_path, method: @logout_method, class: 'flex gap-2 items-center px-2' do %> + <%= button_to @logout_path, method: @logout_method, class: 'flex gap-2 items-center px-2' do %> <%= icon_tag("logout-box-line", class: "w-5 h-5 fill-current shrink") %> <%= t('.logout') %> <% end %> diff --git a/admin/spec/components/solidus_admin/sidebar/account_nav/component_spec.rb b/admin/spec/components/solidus_admin/sidebar/account_nav/component_spec.rb index 0b76d1fdc11..5a1cb4e5fe4 100644 --- a/admin/spec/components/solidus_admin/sidebar/account_nav/component_spec.rb +++ b/admin/spec/components/solidus_admin/sidebar/account_nav/component_spec.rb @@ -22,8 +22,10 @@ # Links are hidden within a
    element expect(page).to have_link("Account", href: "/admin/account", visible: :any) - expect(page).to have_link("Logout", href: "/admin/logout", visible: :any) - expect(page.find_link("Logout", visible: :any)["data-method"]).to eq("delete") + within('form[action="/admin/logout"]') do + expect(page).to have_button("Logout", visible: :any) + expect(page).to have_css('input[type="hidden"][name="_method"][value="delete"]') + end end end end