Commit a422f078 authored by JC Brand's avatar JC Brand

Bugfix. `beforeTearDown` event handler not fired in tests

parent 75bd24c1
...@@ -110,9 +110,11 @@ ...@@ -110,9 +110,11 @@
emojione.ascii = true; emojione.ascii = true;
function onWindowStateChanged (data) { function onWindowStateChanged (data) {
_converse.chatboxviews.each(function (chatboxview) { if (_converse.chatboxviews) {
chatboxview.onWindowStateChanged(data.state); _converse.chatboxviews.each(chatboxview => {
}); chatboxview.onWindowStateChanged(data.state);
});
}
} }
_converse.api.listen.on('windowStateChanged', onWindowStateChanged); _converse.api.listen.on('windowStateChanged', onWindowStateChanged);
......
...@@ -343,9 +343,9 @@ ...@@ -343,9 +343,9 @@
delete _converse.controlboxtoggle; delete _converse.controlboxtoggle;
delete _converse.chatboxviews; delete _converse.chatboxviews;
_converse.connection.reset(); _converse.connection.reset();
_converse.off();
_converse.stopListening(); _converse.stopListening();
_converse.tearDown(); _converse.tearDown();
_converse.off();
} }
if ('onpagehide' in window) { if ('onpagehide' in window) {
......
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
}); });
_converse.api.listen.on('afterTearDown', () => { _converse.api.listen.on('afterTearDown', () => {
if (!_converse.chatboxviews) {
return;
}
const container = _converse.chatboxviews.el.querySelector("#converse-modals"); const container = _converse.chatboxviews.el.querySelector("#converse-modals");
if (container) { if (container) {
container.innerHTML = ''; 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