diff --git a/converse.js b/converse.js index 3760de030..9309ffb9a 100644 --- a/converse.js +++ b/converse.js @@ -158,6 +158,7 @@ this.forward_messages = false; this.hide_muc_server = false; this.i18n = locales.en; + this.no_trimming = false; // Set to true for phantomjs tests (where browser apparently has no width) this.prebind = false; this.show_controlbox_by_default = false; this.show_only_online_users = false; @@ -195,6 +196,7 @@ 'fullname', 'hide_muc_server', 'i18n', + 'no_trimming', 'jid', 'prebind', 'rid', @@ -2556,6 +2558,9 @@ * Check whether there is enough space in the page to show * another chat box. Otherwise, close the oldest chat box. */ + if (converse.no_trimming) { + return; + } var toggle_width = 0, trimmed_chats_width, boxes_width = view.$el.outerWidth(true), @@ -3630,14 +3635,17 @@ } }); + this._initialize = function () { + this.chatboxes = new this.ChatBoxes(); + this.chatboxviews = new this.ChatBoxViews({model: this.chatboxes}); + this.controlboxtoggle = new this.ControlBoxToggle(); + this.otr = new this.OTR(); + }; + // Initialization // -------------- // This is the end of the initialize method. - this.chatboxes = new this.ChatBoxes(); - this.chatboxviews = new this.ChatBoxViews({model: this.chatboxes}); - this.controlboxtoggle = new this.ControlBoxToggle(); - this.otr = new this.OTR(); - + this._initialize(); if ((this.prebind) && (!this.connection)) { if ((!this.jid) || (!this.sid) || (!this.rid) || (!this.bosh_service_url)) { this.log('If you set prebind=true, you MUST supply JID, RID and SID values'); diff --git a/spec/chatbox.js b/spec/chatbox.js index 9faee9a35..5630676c8 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -34,7 +34,7 @@ // openControlBox was called earlier, so the controlbox is // visible, but no other chat boxes have been created. expect(this.chatboxes.length).toEqual(1); - spyOn(this.chatboxviews, 'trimOpenChats'); + spyOn(this.chatboxviews, 'trimChats'); var online_contacts = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact').find('a.open-chat'); for (i=0; i - - + + + + @@ -19,6 +21,5 @@

Tests

-
diff --git a/tests/main.js b/tests/main.js index 59f917ab3..b9eb7bc8d 100644 --- a/tests/main.js +++ b/tests/main.js @@ -45,7 +45,7 @@ require([ auto_subscribe: false, animate: false, connection: mock.mock_connection, - testing: true + no_trimming: true }, function (converse) { window.converse = converse; window.crypto = { diff --git a/tests/utils.js b/tests/utils.js index bc031b55f..eec44a1c5 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -31,8 +31,7 @@ }; utils.initConverse = function () { - converse.chatboxes = new converse.ChatBoxes(); - converse.chatboxviews = new converse.ChatBoxViews({model: converse.chatboxes}); + converse._initialize(); converse.onConnected(); };