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:
Joffrey JAFFEUX
2023-03-10 18:49:59 +01:00
committed by GitHub
parent 6bb89ffea8
commit 727100d1e2
5 changed files with 103 additions and 1 deletions
+14
View File
@@ -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) }