From 66dde5e98644fa3e1d41ce45c5a31f26c79cd957 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 13 Apr 2013 01:24:55 +0200 Subject: [PATCH] Add another test Test that chatboxes can also be closed. --- spec/MainSpec.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/spec/MainSpec.js b/spec/MainSpec.js index 63576f45b..fefe1bdd9 100644 --- a/spec/MainSpec.js +++ b/spec/MainSpec.js @@ -132,7 +132,7 @@ expect(this.rosterview.$el.find('dt#xmpp-contacts').css('display')).toEqual('block'); }, xmppchat)); - describe("roster items", $.proxy(function () { + describe("Roster items", $.proxy(function () { it("are saved to, and can be retrieved from, localStorage", $.proxy(function () { var new_attrs, old_attrs, attrs, old_roster; @@ -274,9 +274,8 @@ jid = $el.text().replace(' ','.').toLowerCase() + '@localhost'; view = this.rosterview.rosteritemviews[jid]; spyOn(view, 'openChat').andCallThrough(); - // We need to rebind all events otherwise our spy won't work. - view.delegateEvents(); - var ev = $el.click(); + view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called + $el.click(); expect(view.openChat).toHaveBeenCalled(); expect(this.chatboxes.length).toEqual(i+2); } @@ -301,6 +300,21 @@ } this.rosterview.render(); }, xmppchat)); + + it("can be closed again", $.proxy(function () { + var chatbox, view, $el; + for (i=0; i