Make `MessageView::onUnload` synchronous

Our tests rely on that.
pull/1/head
Daniel Gasienica 7 years ago
parent add5d4ab0b
commit ef2be2cf5f

@ -231,7 +231,7 @@
setTimeout(this.remove.bind(this), 1000); setTimeout(this.remove.bind(this), 1000);
}, },
/* jshint ignore:start */ /* jshint ignore:start */
onUnload: async function() { onUnload: function() {
if (this.avatarView) { if (this.avatarView) {
this.avatarView.remove(); this.avatarView.remove();
} }
@ -248,8 +248,12 @@
this.timeStampView.remove(); this.timeStampView.remove();
} }
const views = await this.loadedAttachmentViews; // NOTE: We have to do this in the background (`then` instead of `await`)
views.forEach(view => view.unload()); // as our tests rely on `onUnload` synchronously removing the view from
// the DOM.
// eslint-disable-next-line more/no-then
this.loadAttachmentViews()
.then(views => views.forEach(view => view.unload()));
// No need to handle this one, since it listens to 'unload' itself: // No need to handle this one, since it listens to 'unload' itself:
// this.timerView // this.timerView

Loading…
Cancel
Save