From c9913bf6ac9c5b9e71a1bbcfdddb32e9a299aaab Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 29 Aug 2017 12:29:16 +0200 Subject: [PATCH] Fix failing tests --- spec/chatroom.js | 19 +++++++------------ src/converse-core.js | 1 + 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spec/chatroom.js b/spec/chatroom.js index 371cfc1c33..ca65b690fa 100644 --- a/spec/chatroom.js +++ b/spec/chatroom.js @@ -1643,9 +1643,11 @@ mock.initConverseWithPromises( null, ['rosterGroupsFetched'], {}, function (done, _converse) { + test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy'); var view = _converse.chatboxviews.get('lounge@localhost'), trimmed_chatboxes = _converse.minimized_chats; + spyOn(view, 'minimize').and.callThrough(); spyOn(view, 'maximize').and.callThrough(); spyOn(_converse, 'emit'); @@ -1659,18 +1661,11 @@ expect(view.minimize).toHaveBeenCalled(); var trimmedview = trimmed_chatboxes.get(view.model.get('id')); trimmedview.$("a.restore-chat").click(); - - test_utils.waitUntil(function () { - return view.$el.is(':visible'); - }, 300) - .then(function () { - expect(view.maximize).toHaveBeenCalled(); - expect(_converse.emit).toHaveBeenCalledWith('chatBoxMaximized', jasmine.any(Object)); - expect(view.$el.is(':visible')).toBeTruthy(); - expect(view.model.get('minimized')).toBeFalsy(); - expect(_converse.emit.calls.count(), 3); - done(); - }); + expect(view.maximize).toHaveBeenCalled(); + expect(_converse.emit).toHaveBeenCalledWith('chatBoxMaximized', jasmine.any(Object)); + expect(view.model.get('minimized')).toBeFalsy(); + expect(_converse.emit.calls.count(), 3); + done(); })); it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", diff --git a/src/converse-core.js b/src/converse-core.js index 097c3a71af..d0ea5a96cd 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -188,6 +188,7 @@ // Looks like _converse.initialized was called again without logging // out or disconnecting in the previous session. // This happens in tests. We therefore first clean up. + delete _converse.controlboxtoggle; _converse.connection.reset(); _converse.off(); _converse.stopListening();