2015-01-23 16:06:10 +01:00
|
|
|
(function (root, factory) {
|
2019-02-12 14:21:45 +01:00
|
|
|
define(["jasmine", "mock", "test-utils"], factory);
|
|
|
|
} (this, function (jasmine, mock, test_utils) {
|
2016-11-03 11:01:09 +01:00
|
|
|
|
2019-02-12 14:21:45 +01:00
|
|
|
return describe("The XMPPStatus model", function () {
|
2016-11-03 11:01:09 +01:00
|
|
|
|
2019-02-12 14:21:45 +01:00
|
|
|
it("won't send <show>online</show> when setting a custom status message", mock.initConverse((done, _converse) => {
|
2016-12-20 10:30:20 +01:00
|
|
|
_converse.xmppstatus.save({'status': 'online'});
|
|
|
|
spyOn(_converse.connection, 'send');
|
2018-03-17 18:13:51 +01:00
|
|
|
_converse.api.user.status.message.set("I'm also happy!");
|
2017-02-23 11:25:29 +01:00
|
|
|
expect(_converse.connection.send).toHaveBeenCalled();
|
2019-02-12 14:21:45 +01:00
|
|
|
const stanza = _converse.connection.send.calls.argsFor(0)[0].tree();
|
|
|
|
expect(stanza.childNodes.length).toBe(3);
|
|
|
|
expect(stanza.querySelectorAll('status').length).toBe(1);
|
|
|
|
expect(stanza.querySelector('status').textContent).toBe("I'm also happy!");
|
|
|
|
expect(stanza.querySelectorAll('show').length).toBe(0);
|
|
|
|
expect(stanza.querySelectorAll('priority').length).toBe(1);
|
|
|
|
expect(stanza.querySelector('priority').textContent).toBe('0');
|
|
|
|
done();
|
2016-11-03 11:01:09 +01:00
|
|
|
}));
|
|
|
|
});
|
2015-01-23 16:06:10 +01:00
|
|
|
}));
|