From fc0a1d9dbd79267754b28478cb81ac1e239f975d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Fri, 23 Jan 2015 12:06:10 -0300 Subject: [PATCH] Added test case for #305 and updated CHANGES.rst --- docs/CHANGES.rst | 1 + spec/xmppstatus.js | 29 +++++++++++++++++++++++++++++ tests/main.js | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 spec/xmppstatus.js diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index 630b11d30..cd264d389 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -14,6 +14,7 @@ Changelog * #304 Added Polish translations. [ser] * New Makefile.win to build in Windows environments. [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) ------------------ diff --git a/spec/xmppstatus.js b/spec/xmppstatus.js new file mode 100644 index 000000000..560489af9 --- /dev/null +++ b/spec/xmppstatus.js @@ -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 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)); +})); diff --git a/tests/main.js b/tests/main.js index 4a47fcb29..daca682cc 100644 --- a/tests/main.js +++ b/tests/main.js @@ -67,7 +67,8 @@ require([ "spec/chatroom", "spec/minchats", "spec/profiling", - "spec/register" + "spec/register", + "spec/xmppstatus" ], function () { // Make sure this callback is only called once. delete converse.callback;