mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 09:23:43 +08:00
FIX: adds chat-draw-expanded class to body (#28490)
To achieve this, the code is now using bodyClass instead of relying on the addChatDrawerStateCallback`.
This commit is contained in:
parent
5fa0496f81
commit
842d2749a1
|
@ -1,3 +1,11 @@
|
|||
{{#if this.chatStateManager.isDrawerActive}}
|
||||
{{bodyClass "chat-drawer-active"}}
|
||||
{{/if}}
|
||||
|
||||
{{#if this.chatStateManager.isDrawerExpanded}}
|
||||
{{bodyClass "chat-drawer-expanded"}}
|
||||
{{/if}}
|
||||
|
||||
{{#if this.chatStateManager.isDrawerActive}}
|
||||
<div
|
||||
data-chat-channel-id={{this.chat.activeChannel.id}}
|
||||
|
|
|
@ -157,14 +157,6 @@ export default {
|
|||
id: "chat",
|
||||
});
|
||||
|
||||
api.addChatDrawerStateCallback(({ isDrawerActive }) => {
|
||||
if (isDrawerActive) {
|
||||
document.body.classList.add("chat-drawer-active");
|
||||
} else {
|
||||
document.body.classList.remove("chat-drawer-active");
|
||||
}
|
||||
});
|
||||
|
||||
api.addAboutPageActivity("chat_messages", (periods) => {
|
||||
const count = periods["7_days"];
|
||||
if (count) {
|
||||
|
|
|
@ -112,11 +112,14 @@ RSpec.describe "Drawer", type: :system do
|
|||
it "collapses the drawer" do
|
||||
visit("/")
|
||||
chat_page.open_from_header
|
||||
|
||||
expect(page).to have_selector(".chat-drawer.is-expanded")
|
||||
expect(page).to have_selector("body.chat-drawer-expanded")
|
||||
|
||||
page.find(".c-navbar").click
|
||||
|
||||
expect(page).to have_selector(".chat-drawer:not(.is-expanded)")
|
||||
expect(page).to have_selector("body:not(.chat-drawer-expanded)")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user