FIX: correctly handles mobile and default (#23152)

This commit ensures we have correct icon and title on mobile for the chat header icon.

It also fixes a bug where the site setting was not correctly used when the user has not yet set the user option.

Both cases are now correctly tested.
This commit is contained in:
Joffrey JAFFEUX
2023-08-18 22:32:43 +02:00
committed by GitHub
parent 477a5dd371
commit b03c26ebf5
5 changed files with 57 additions and 4 deletions

View File

@ -17,6 +17,36 @@ RSpec.describe "Separate sidebar mode", type: :system do
sign_in(current_user)
end
describe "when separate sidebar mode is not set" do
before do
SiteSetting.chat_separate_sidebar_mode = "always"
chat_page.prefers_full_page
end
it "uses the site setting" do
visit("/")
expect(sidebar_component).to have_switch_button("chat")
expect(header_component).to have_open_chat_button
expect(sidebar_component).to have_no_section("chat-channels")
expect(sidebar_component).to have_section("Categories")
chat_page.open_from_header
expect(sidebar_component).to have_switch_button("main")
expect(header_component).to have_open_forum_button
expect(sidebar_component).to have_section("chat-channels")
expect(sidebar_component).to have_no_section("Categories")
find("#site-logo").click
expect(sidebar_component).to have_switch_button("chat")
expect(header_component).to have_open_chat_button
expect(sidebar_component).to have_no_section("chat-channels")
expect(sidebar_component).to have_section("Categories")
end
end
describe "when separate sidebar mode is never" do
before do
current_user.user_option.update!(