Commit c9913bf6 authored by JC Brand's avatar JC Brand

Fix failing tests

parent e6e0fc90
...@@ -1643,9 +1643,11 @@ ...@@ -1643,9 +1643,11 @@
mock.initConverseWithPromises( mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
function (done, _converse) { function (done, _converse) {
test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy'); test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
var view = _converse.chatboxviews.get('lounge@localhost'), var view = _converse.chatboxviews.get('lounge@localhost'),
trimmed_chatboxes = _converse.minimized_chats; trimmed_chatboxes = _converse.minimized_chats;
spyOn(view, 'minimize').and.callThrough(); spyOn(view, 'minimize').and.callThrough();
spyOn(view, 'maximize').and.callThrough(); spyOn(view, 'maximize').and.callThrough();
spyOn(_converse, 'emit'); spyOn(_converse, 'emit');
...@@ -1659,18 +1661,11 @@ ...@@ -1659,18 +1661,11 @@
expect(view.minimize).toHaveBeenCalled(); expect(view.minimize).toHaveBeenCalled();
var trimmedview = trimmed_chatboxes.get(view.model.get('id')); var trimmedview = trimmed_chatboxes.get(view.model.get('id'));
trimmedview.$("a.restore-chat").click(); trimmedview.$("a.restore-chat").click();
expect(view.maximize).toHaveBeenCalled();
test_utils.waitUntil(function () { expect(_converse.emit).toHaveBeenCalledWith('chatBoxMaximized', jasmine.any(Object));
return view.$el.is(':visible'); expect(view.model.get('minimized')).toBeFalsy();
}, 300) expect(_converse.emit.calls.count(), 3);
.then(function () { done();
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();
});
})); }));
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", it("can be closed again by clicking a DOM element with class 'close-chatbox-button'",
......
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
// Looks like _converse.initialized was called again without logging // Looks like _converse.initialized was called again without logging
// out or disconnecting in the previous session. // out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up. // This happens in tests. We therefore first clean up.
delete _converse.controlboxtoggle;
_converse.connection.reset(); _converse.connection.reset();
_converse.off(); _converse.off();
_converse.stopListening(); _converse.stopListening();
......
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