Replace link with button in login items component

- modified related specs
- modified scss to keep new button same style as previous link
This commit is contained in:
cyrillefr
2025-04-03 22:18:34 +02:00
parent bc912b53da
commit c6f0a3761b
7 changed files with 16 additions and 10 deletions

View File

@@ -32,8 +32,10 @@
width: auto; width: auto;
} }
a { a,
button {
color: inherit; color: inherit;
cursor: pointer;
line-height: inherit; line-height: inherit;
padding-left: 0; padding-left: 0;
@@ -41,6 +43,10 @@
font-size: $small-font-size; font-size: $small-font-size;
padding: rem-calc(8) rem-calc(16); padding: rem-calc(8) rem-calc(16);
} }
&:hover {
text-decoration: underline;
}
} }
.button { .button {

View File

@@ -18,8 +18,8 @@
t("layouts.header.my_account_link") %> t("layouts.header.my_account_link") %>
</li> </li>
<li> <li>
<%= link_to t("devise_views.menu.login_items.logout"), <%= button_to t("devise_views.menu.login_items.logout"),
destroy_user_session_path, rel: "nofollow", method: :delete %> destroy_user_session_path, rel: "nofollow", method: :delete %>
</li> </li>
<% else %> <% else %>
<li> <li>

View File

@@ -18,7 +18,7 @@ describe Layout::AdminHeaderComponent do
expect(page).to have_link "You don't have new notifications" expect(page).to have_link "You don't have new notifications"
expect(page).to have_link "My content" expect(page).to have_link "My content"
expect(page).to have_link "My account" 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]" expect(page).to have_css "[data-toggle]"
end end

View File

@@ -39,7 +39,7 @@ describe "Moderate users" do
expect(page).to have_css "h1", exact_text: debate3.title expect(page).to have_css "h1", exact_text: debate3.title
expect(page).not_to have_content(comment3.body) 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" expect(page).to have_content "You have been signed out successfully"

View File

@@ -294,7 +294,7 @@ describe "Polls" do
expect(page).to have_content "Vote introduced!" expect(page).to have_content "Vote introduced!"
within("#notice") { click_button "Close" } 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." expect(page).to have_content "You must sign in or register to continue."

View File

@@ -16,7 +16,7 @@ describe "Sessions" do
within("#notice") { click_button "Close" } 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_content("You have been signed out successfully")
expect(page).to have_current_path(debate_path(debate)) 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/) 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_content "You must sign in or register to continue."
expect(page).to have_current_path new_user_session_path expect(page).to have_current_path new_user_session_path

View File

@@ -85,7 +85,7 @@ describe "Users" do
expect(page).to have_link "My content", href: user_path(u1) expect(page).to have_link "My content", href: user_path(u1)
within("#notice") { click_button "Close" } 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_content "You have been signed out successfully."
@@ -495,7 +495,7 @@ describe "Users" do
login_as(user) login_as(user)
visit "/" visit "/"
click_link "Sign out" click_button "Sign out"
expect(page).to have_content "You have been signed out successfully." expect(page).to have_content "You have been signed out successfully."
end end