0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/chat/spec/system/sidebars_spec.rb
Martin Brennan fc98ce9a72
FEATURE: Hover menu for all chat channels in sidebar (#34727)
This commit introduces a menu on an [...] button on hover
of DMs and public chat channels.

When you click on the menu you will see the following
options:

* Change the notification level for the channel
* Mute or unmute the channel
* Go directly to the channel settings
* Leave the channel
* Star or unstar the channel

Over time we may add more items to this menu, these are
just the most common actions for now.

This commit also moves the hovering functionality for sidebar
links to JS, in case we need to modify when the link should
stop hovering, e.g. if it's still inside the menu maybe we
don't want to.

Also added `@suffixIcon` option to `DButton` for the >
in the dropdown

---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2026-01-05 10:59:00 +10:00

62 lines
1.6 KiB
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe "Navigation", type: :system do
fab!(:category)
fab!(:topic)
fab!(:post) { Fabricate(:post, topic: topic) }
fab!(:user, :admin)
fab!(:category_channel)
fab!(:category_channel_2, :category_channel)
let(:chat_page) { PageObjects::Pages::Chat.new }
let(:sidebar_page) { PageObjects::Pages::ChatSidebar.new }
before do
chat_system_bootstrap(user, [category_channel, category_channel_2])
sign_in(user)
SiteSetting.navigation_menu = "header dropdown"
end
it "uses chat (not core) sidebar" do
visit("/chat")
expect(page).to have_css(".channels-list")
expect(page).to have_no_css("#d-sidebar")
end
context "when sidebar is enabled as the navigation menu" do
before { SiteSetting.navigation_menu = "sidebar" }
it "uses core sidebar" do
visit("/chat")
expect(page).to have_css("#d-sidebar")
expect(page).to have_no_css(".channels-list")
end
context "when visiting on mobile", mobile: true do
it "has no sidebar" do
chat_page.visit_channel(category_channel_2)
expect(page).to have_no_css("#d-sidebar")
end
end
context "when public channels are disabled" do
before { SiteSetting.enable_public_channels = false }
it "has public channels section" do
visit("/")
expect(sidebar_page).to have_no_public_channels_section
end
end
end
context "when visiting on mobile", mobile: true do
it "has no sidebar" do
chat_page.visit_channel(category_channel_2)
expect(page).to have_no_css(".channels-list")
end
end
end