Commit c0095d4d authored by JC Brand's avatar JC Brand

New test

Test that chatboxes are removed from localStorage when closed
parent 66dde5e9
...@@ -305,16 +305,23 @@ ...@@ -305,16 +305,23 @@
var chatbox, view, $el; var chatbox, view, $el;
for (i=0; i<this.chatboxes.length; i++) { for (i=0; i<this.chatboxes.length; i++) {
chatbox = this.chatboxes.models[i]; chatbox = this.chatboxes.models[i];
if (chatbox.get('id') == 'controlbox') { view = this.chatboxesview.views[chatbox.get('id')];
continue;
}
view = this.chatboxesview.views[chatbox.get('jid')];
spyOn(view, 'closeChat').andCallThrough(); spyOn(view, 'closeChat').andCallThrough();
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
view.$el.find('.close-chatbox-button').click(); view.$el.find('.close-chatbox-button').click();
expect(view.closeChat).toHaveBeenCalled(); expect(view.closeChat).toHaveBeenCalled();
} }
}, xmppchat)); }, xmppchat));
it("will be removed from localStorage when closed", $.proxy(function () {
var old_chatboxes = this.chatboxes;
expect(this.chatboxes.length).toEqual(6);
this.chatboxes = new this.ChatBoxes();
expect(this.chatboxes.length).toEqual(0);
this.chatboxes.onConnected();
expect(this.chatboxes.length).toEqual(0);
}, xmppchat));
}, xmppchat)); }, xmppchat));
}, xmppchat)); }, xmppchat));
......
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