Commit 4015eb2f authored by JC Brand's avatar JC Brand

Name anonymous function to fix failing test

parent b5c56c83
...@@ -5064,7 +5064,8 @@ ...@@ -5064,7 +5064,8 @@
expect(notifications.length).toBe(1); expect(notifications.length).toBe(1);
expect(notifications[0].textContent.trim()).toEqual('nomorenicks is typing'); expect(notifications[0].textContent.trim()).toEqual('nomorenicks is typing');
timeout_functions[1](); timeout_functions.filter(f => f.name === 'bound safeDestroy').pop()();
events = view.el.querySelectorAll('.chat-event'); events = view.el.querySelectorAll('.chat-event');
expect(events.length).toBe(3); expect(events.length).toBe(3);
expect(events[0].textContent.trim()).toEqual('some1 has entered the groupchat'); expect(events[0].textContent.trim()).toEqual('some1 has entered the groupchat');
......
...@@ -107,13 +107,15 @@ converse.plugins.add('converse-chatboxes', { ...@@ -107,13 +107,15 @@ converse.plugins.add('converse-chatboxes', {
this.on('change:put', this.uploadFile, this); this.on('change:put', this.uploadFile, this);
} }
if (this.isEphemeral()) { if (this.isEphemeral()) {
window.setTimeout(() => { window.setTimeout(this.safeDestroy.bind(this), 10000);
try { }
this.destroy() },
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR); safeDestroy () {
} try {
}, 10000); this.destroy()
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR);
} }
}, },
......
...@@ -256,13 +256,7 @@ converse.plugins.add('converse-muc', { ...@@ -256,13 +256,7 @@ converse.plugins.add('converse-muc', {
this.on('change:put', this.uploadFile, this); this.on('change:put', this.uploadFile, this);
} }
if (this.isEphemeral()) { if (this.isEphemeral()) {
window.setTimeout(() => { window.setTimeout(this.safeDestroy.bind(this), 10000);
try {
this.destroy()
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR);
}
}, 10000);
} else { } else {
this.setOccupant(); this.setOccupant();
this.setVCard(); this.setVCard();
......
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