xmpp.chapril.org-conversejs/spec/xmppstatus.js
2016-11-03 13:59:05 +00:00

26 lines
1.0 KiB
JavaScript

(function (root, factory) {
define(["mock", "test_utils"], factory);
} (this, function (mock, test_utils) {
var $ = converse_api.env.jQuery;
return describe("The XMPPStatus model", function() {
afterEach(function () {
converse_api.user.logout();
test_utils.clearBrowserStorage();
});
it("won't send <show>online when setting a custom status message", mock.initConverse(function (converse) {
converse.xmppstatus.save({'status': 'online'});
spyOn(converse.xmppstatus, 'setStatusMessage').andCallThrough();
spyOn(converse.connection, 'send');
converse.xmppstatus.setStatusMessage("I'm also happy!");
runs (function () {
expect(converse.connection.send).toHaveBeenCalled();
var $stanza = $(converse.connection.send.argsForCall[0][0].tree());
expect($stanza.children().length).toBe(1);
expect($stanza.children('show').length).toBe(0);
});
}));
});
}));