mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
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:
@ -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!(
|
||||
|
Reference in New Issue
Block a user