2015-01-23 16:06:10 +01:00
|
|
|
(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) {
|
2016-11-03 11:01:09 +01:00
|
|
|
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();
|
2015-01-23 16:06:10 +01:00
|
|
|
spyOn(converse.connection, 'send');
|
2016-11-03 11:01:09 +01:00
|
|
|
converse.xmppstatus.setStatusMessage("I'm also happy!");
|
2015-01-23 16:06:10 +01:00
|
|
|
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);
|
|
|
|
});
|
2016-11-03 11:01:09 +01:00
|
|
|
}));
|
|
|
|
});
|
2015-01-23 16:06:10 +01:00
|
|
|
}));
|