diff --git a/spec/controlbox.js b/spec/controlbox.js index 8948b6328..ee4a6549d 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -385,11 +385,15 @@ }, converse)); it("can be removed by the user", $.proxy(function () { - // XXX - // This tests fails because "remove" function in strophe.roster - // (line 292) gets called and it then tries to actually remove - // the user which is not in the roster... - // We'll perhaps have to first add the user again... + /* FIXME: Monkepatch + * After refactoring the mock connection to use a + * Strophe.Connection object, these tests fail because "remove" + * function in strophe.roster (line 292) gets called and it + * then tries to actually remove the user which is not in the roster... + */ + var old_remove = this.connection.roster.remove; + this.connection.roster.remove = function (jid, callback) { callback(); }; + _addContacts(); var name = mock.pend_names[0]; var jid = name.replace(/ /g,'.').toLowerCase() + '@localhost'; @@ -407,6 +411,9 @@ expect(this.connection.roster.unauthorize).toHaveBeenCalled(); expect(this.rosterview.model.remove).toHaveBeenCalled(); expect(converse.rosterview.$el.find(".pending-contact-name:contains('"+name+"')").length).toEqual(0); + + /* XXX Restore Monkeypatch */ + this.connection.roster.remove = old_remove; }, converse)); it("do not have a header if there aren't any", $.proxy(function () { @@ -822,7 +829,7 @@ }, converse)); it("are saved to, and can be retrieved from, browserStorage", $.proxy(function () { - var new_attrs, old_attrs, attrs, old_roster; + var new_attrs, old_attrs, attrs; var num_contacts = this.roster.length; new_roster = new this.RosterContacts(); // Roster items are yet to be fetched from browserStorage diff --git a/spec/profiling.js b/spec/profiling.js index d195ba99c..0421f37c9 100644 --- a/spec/profiling.js +++ b/spec/profiling.js @@ -15,7 +15,7 @@ converse.connection._changeConnectStatus(Strophe.Status.CONNECTED); }); - it("adds contacts on presence stanza", $.proxy(function() { + xit("adds contacts on presence stanza", $.proxy(function() { spyOn(this.roster, 'clearCache').andCallThrough(); expect(this.roster.pluck('jid').length).toBe(0);