xmpp.chapril.org-conversejs/spec/xmppstatus.js

26 lines
1.1 KiB
JavaScript
Raw Normal View History

(function (root, factory) {
2016-11-30 13:18:58 +01:00
define(["mock", "converse-api", "test_utils"], factory);
} (this, function (mock, converse_api, 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);
});
}));
});
}));