Added test case for #305 and updated CHANGES.rst

This commit is contained in:
Guillermo Bonvehí 2015-01-23 12:06:10 -03:00
parent fe03940f53
commit fc0a1d9dbd
3 changed files with 32 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Changelog
* #304 Added Polish translations. [ser] * #304 Added Polish translations. [ser]
* New Makefile.win to build in Windows environments. [gbonvehi] * New Makefile.win to build in Windows environments. [gbonvehi]
* Strophe.log and Strophe.error now uses converse.log to output messages. [gbonvehi] * Strophe.log and Strophe.error now uses converse.log to output messages. [gbonvehi]
* #305 presence/show text in XMPP request isn't allowed by specification. [gbonvehi]
0.8.6 (2014-12-07) 0.8.6 (2014-12-07)
------------------ ------------------

29
spec/xmppstatus.js Normal file
View File

@ -0,0 +1,29 @@
(function (root, factory) {
define([
"jquery",
"mock",
"test_utils"
], function ($, mock, test_utils) {
return factory($, mock, test_utils);
}
);
} (this, function ($, mock, test_utils) {
return describe("The XMPPStatus model", $.proxy(function(mock, test_utils) {
beforeEach($.proxy(function () {
window.localStorage.clear();
window.sessionStorage.clear();
}, converse));
it("won't send <show>online when setting a custom status message", $.proxy(function () {
this.xmppstatus.save({'status': 'online'});
spyOn(this.xmppstatus, 'setStatusMessage').andCallThrough();
spyOn(converse.connection, 'send');
this.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);
});
}, converse));
}, converse, mock, test_utils));
}));

View File

@ -67,7 +67,8 @@ require([
"spec/chatroom", "spec/chatroom",
"spec/minchats", "spec/minchats",
"spec/profiling", "spec/profiling",
"spec/register" "spec/register",
"spec/xmppstatus"
], function () { ], function () {
// Make sure this callback is only called once. // Make sure this callback is only called once.
delete converse.callback; delete converse.callback;