diff --git a/spec/chatbox.js b/spec/chatbox.js index fb9a80504..a9cb02467 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -25,8 +25,6 @@ runs(function () { utils.openContactsPanel(); }); - waits(250); - runs(function () {}); }); it("is created when you click on a roster item", $.proxy(function () { @@ -57,13 +55,14 @@ }, converse)); it("can be trimmed to conserve space", $.proxy(function () { - var i, $el, click, jid, key, view, chatboxview; + var i, $el, click, jid, key, view, chatbox, chatboxview; // openControlBox was called earlier, so the controlbox is // visible, but no other chat boxes have been created. - var trimmed_chatboxes = converse.chatboxviews.trimmed_chatboxes_view; + var trimmed_chatboxes = converse.minimized_chats; expect(this.chatboxes.length).toEqual(1); spyOn(this.chatboxviews, 'trimChats'); - spyOn(trimmed_chatboxes, 'onChanged').andCallThrough(); + spyOn(trimmed_chatboxes, 'addChat').andCallThrough(); + spyOn(trimmed_chatboxes, 'removeChat').andCallThrough(); expect($("#conversejs .chatbox").length).toBe(1); // Controlbox is open // Test that they can be trimmed @@ -72,33 +71,34 @@ $el = $(online_contacts[i]); jid = $el.text().replace(' ','.').toLowerCase() + '@localhost'; view = this.rosterview.get(jid); - view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called $el.click(); expect(this.chatboxviews.trimChats).toHaveBeenCalled(); chatboxview = this.chatboxviews.get(jid); spyOn(chatboxview, 'hide').andCallThrough(); chatboxview.model.set({'minimized': true}); - expect(trimmed_chatboxes.onChanged).toHaveBeenCalled(); + expect(trimmed_chatboxes.addChat).toHaveBeenCalled(); expect(chatboxview.hide).toHaveBeenCalled(); trimmedview = trimmed_chatboxes.get(jid); expect(trimmedview.$el.is(":visible")).toBeTruthy(); } + // Test that they can be maximized again - var chatboxviews = this.chatboxviews.getAll(); - var keys = _.keys(chatboxviews); - for (i=0; i