Commit a422f078 authored by JC Brand's avatar JC Brand

Bugfix. `beforeTearDown` event handler not fired in tests

parent 75bd24c1
......@@ -110,9 +110,11 @@
emojione.ascii = true;
function onWindowStateChanged (data) {
_converse.chatboxviews.each(function (chatboxview) {
chatboxview.onWindowStateChanged(data.state);
});
if (_converse.chatboxviews) {
_converse.chatboxviews.each(chatboxview => {
chatboxview.onWindowStateChanged(data.state);
});
}
}
_converse.api.listen.on('windowStateChanged', onWindowStateChanged);
......
......@@ -343,9 +343,9 @@
delete _converse.controlboxtoggle;
delete _converse.chatboxviews;
_converse.connection.reset();
_converse.off();
_converse.stopListening();
_converse.tearDown();
_converse.off();
}
if ('onpagehide' in window) {
......
......@@ -66,6 +66,9 @@
});
_converse.api.listen.on('afterTearDown', () => {
if (!_converse.chatboxviews) {
return;
}
const container = _converse.chatboxviews.el.querySelector("#converse-modals");
if (container) {
container.innerHTML = '';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment