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

22 lines
1.1 KiB
JavaScript
Raw Normal View History

(function (root, factory) {
2018-01-04 12:41:03 +01:00
define(["jquery", "jasmine", "mock", "converse-core", "test-utils"], factory);
} (this, function ($, jasmine, mock, converse, test_utils) {
return describe("The XMPPStatus model", function() {
2017-02-23 11:25:29 +01:00
it("won't send <show>online</show> when setting a custom status message", mock.initConverse(function (_converse) {
_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();
2017-04-05 11:01:31 +02:00
var $stanza = $(_converse.connection.send.calls.argsFor(0)[0].tree());
2017-02-23 11:25:29 +01:00
expect($stanza.children().length).toBe(2);
expect($stanza.children('status').length).toBe(1);
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');
}));
});
}));