Fix tests. sendPresence is now sent out at a different place

This commit is contained in:
JC Brand 2013-10-15 21:05:07 +02:00
parent f1a1d36cc4
commit 0deb8be9e7

View File

@ -126,7 +126,6 @@
it("can be added to the roster", $.proxy(function () { it("can be added to the roster", $.proxy(function () {
spyOn(this.rosterview, 'render').andCallThrough(); spyOn(this.rosterview, 'render').andCallThrough();
spyOn(this.xmppstatus, 'sendPresence');
this.roster.create({ this.roster.create({
jid: pend_names[0].replace(/ /g,'.').toLowerCase() + '@localhost', jid: pend_names[0].replace(/ /g,'.').toLowerCase() + '@localhost',
subscription: 'none', subscription: 'none',
@ -135,7 +134,6 @@
is_last: true is_last: true
}); });
expect(this.rosterview.$el.is(':visible')).toEqual(true); expect(this.rosterview.$el.is(':visible')).toEqual(true);
expect(this.xmppstatus.sendPresence).toHaveBeenCalled();
expect(this.rosterview.render).toHaveBeenCalled(); expect(this.rosterview.render).toHaveBeenCalled();
}, converse)); }, converse));
@ -169,7 +167,6 @@
it("can be added to the roster and they will be sorted alphabetically", $.proxy(function () { it("can be added to the roster and they will be sorted alphabetically", $.proxy(function () {
var i, t, is_last; var i, t, is_last;
spyOn(this.rosterview, 'render').andCallThrough(); spyOn(this.rosterview, 'render').andCallThrough();
spyOn(this.xmppstatus, 'sendPresence');
for (i=0; i<pend_names.length; i++) { for (i=0; i<pend_names.length; i++) {
is_last = i===(pend_names.length-1); is_last = i===(pend_names.length-1);
this.roster.create({ this.roster.create({
@ -179,11 +176,6 @@
fullname: pend_names[i], fullname: pend_names[i],
is_last: is_last is_last: is_last
}); });
if (is_last) {
expect(this.xmppstatus.sendPresence).toHaveBeenCalled();
} else {
expect(this.xmppstatus.sendPresence).not.toHaveBeenCalled();
}
expect(this.rosterview.render).toHaveBeenCalled(); expect(this.rosterview.render).toHaveBeenCalled();
// Check that they are sorted alphabetically // Check that they are sorted alphabetically
t = this.rosterview.$el.find('dt#pending-xmpp-contacts').siblings('dd.pending-xmpp-contact').text(); t = this.rosterview.$el.find('dt#pending-xmpp-contacts').siblings('dd.pending-xmpp-contact').text();