From 3be0f2d89b391c4f14159ea54d5d0241d7c2e386 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 18 Apr 2013 00:10:28 +0200 Subject: [PATCH] Tests update Add empty specs for status widget Fixed roster localStorage spec to not break the xmppstatus view --- spec/MainSpec.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/spec/MainSpec.js b/spec/MainSpec.js index a9aa7ed9f..157d01ee0 100644 --- a/spec/MainSpec.js +++ b/spec/MainSpec.js @@ -65,7 +65,7 @@ this.onConnected(mock_connection); this.animate = false; // don't use animations - describe("The Contacts Roster", $.proxy(function () { + describe("The Control Box", $.proxy(function () { it("is not shown by default", $.proxy(function () { expect(this.rosterview.$el.is(':visible')).toEqual(false); }, xmppchat)); @@ -76,6 +76,20 @@ expect(this.toggleControlBox).toHaveBeenCalled(); }, xmppchat)); + describe("The Status Widget", $.proxy(function () { + it("can be used to set the current user's chat status", $.proxy(function () { + // TODO + }, xmppchat)); + + it("can be used to set a custom status message", $.proxy(function () { + // TODO + }, xmppchat)); + }, xmppchat)); + + }, xmppchat)); + + describe("The Contacts Roster", $.proxy(function () { + describe("Pending Contacts", $.proxy(function () { it("do not have a heading if there aren't any", $.proxy(function () { expect(this.rosterview.$el.find('dt#pending-xmpp-contacts').css('display')).toEqual('none'); @@ -309,25 +323,21 @@ var new_attrs, old_attrs, attrs, old_roster; // One contact was declined, so we have 1 less contact then originally expect(this.roster.length).toEqual(num_contacts-1); - old_roster = this.roster; - this.roster = new this.RosterItems(); - expect(this.roster.length).toEqual(0); + new_roster = new this.RosterItems(); + // Roster items are yet to be fetched from localStorage + expect(new_roster.length).toEqual(0); - this.roster.localStorage = new Backbone.LocalStorage( + new_roster.localStorage = new Backbone.LocalStorage( hex_sha1('converse.rosteritems-dummy@localhost')); - this.chatboxes.onConnected(); - spyOn(this.roster, 'fetch').andCallThrough(); - this.rosterview = new this.RosterView({'model':this.roster}); - expect(this.roster.fetch).toHaveBeenCalled(); + new_roster.fetch(); expect(this.roster.length).toEqual(num_contacts-1); - // Check that the roster items retrieved from localStorage // have the same attributes values as the original ones. attrs = ['jid', 'fullname', 'subscription', 'ask']; for (i=0; i