Commit fe2a925c authored by JC Brand's avatar JC Brand

Fix failing test.

parent 8a63813f
...@@ -5,17 +5,19 @@ ...@@ -5,17 +5,19 @@
return describe("The XMPPStatus model", function() { return describe("The XMPPStatus model", function() {
it("won't send <show>online when setting a custom status message", mock.initConverse(function (_converse) { it("won't send <show>online</show> when setting a custom status message", mock.initConverse(function (_converse) {
_converse.xmppstatus.save({'status': 'online'}); _converse.xmppstatus.save({'status': 'online'});
spyOn(_converse.xmppstatus, 'setStatusMessage').andCallThrough(); spyOn(_converse.xmppstatus, 'setStatusMessage').andCallThrough();
spyOn(_converse.connection, 'send'); spyOn(_converse.connection, 'send');
_converse.xmppstatus.setStatusMessage("I'm also happy!"); _converse.xmppstatus.setStatusMessage("I'm also happy!");
runs (function () { expect(_converse.connection.send).toHaveBeenCalled();
expect(_converse.connection.send).toHaveBeenCalled(); var $stanza = $(_converse.connection.send.argsForCall[0][0].tree());
var $stanza = $(_converse.connection.send.argsForCall[0][0].tree()); expect($stanza.children().length).toBe(2);
expect($stanza.children().length).toBe(1); expect($stanza.children('status').length).toBe(1);
expect($stanza.children('show').length).toBe(0); expect($stanza.children('status').text()).toBe("I'm also happy!");
}); expect($stanza.children('show').length).toBe(0);
expect($stanza.children('priority').length).toBe(1);
expect($stanza.children('priority').text()).toBe('0');
})); }));
}); });
})); }));
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