mirror of
https://github.com/discourse/discourse.git
synced 2026-08-19 01:14:56 -05:00
DEV: adds a addChatDrawerStateCallback API (#20640)
Usage:
```javascript
api.addChatDrawerStateCallback(({ isDrawerActive, isDrawerExpanded }) => {
// do something
});
```
Note this commit also uses this new API to add a css class (chat-drawer-active) on the body when the drawer is active.
This commit is contained in:
@@ -54,6 +54,20 @@ RSpec.describe "Drawer", type: :system, js: true do
|
||||
end
|
||||
end
|
||||
|
||||
context "when toggling open/close" do
|
||||
it "toggles a css class on body" do
|
||||
visit("/")
|
||||
|
||||
chat_page.open_from_header
|
||||
|
||||
expect(page.find("body.chat-drawer-active")).to be_visible
|
||||
|
||||
drawer.close
|
||||
|
||||
expect(page.find("body:not(.chat-drawer-active)")).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
context "when going from drawer to full page" do
|
||||
fab!(:channel_1) { Fabricate(:chat_channel) }
|
||||
fab!(:channel_2) { Fabricate(:chat_channel) }
|
||||
|
||||
Reference in New Issue
Block a user