Fix failing tests

This commit is contained in:
JC Brand 2017-02-02 18:29:38 +00:00
parent 890d87c980
commit 63888dd454
10 changed files with 37 additions and 33 deletions

View File

@ -78,7 +78,7 @@
hide_muc_server: true, // Federation is disabled, so no use in
// showing the MUC server.
play_sounds: true,
show_controlbox_by_default: true,
show_controlbox_by_default: false,
strict_plugin_dependencies: false,
debug: true
});

View File

@ -756,12 +756,6 @@
}));
});
describe("when sent by the current user", function () {
it("will always cause the chat area to be scrolled down", mock.initConverse(function (_converse) {
// TODO
}));
});
it("is ignored if it's a malformed headline message", mock.initConverse(function (_converse) {
test_utils.createContacts(_converse, 'current');
test_utils.openControlBox();

View File

@ -1,7 +1,7 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */

View File

@ -1,7 +1,7 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global Backbone, define */

View File

@ -1,7 +1,7 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global Backbone, define */

View File

@ -1,7 +1,7 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define, Backbone */

View File

@ -1,7 +1,7 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global Backbone, define, window, document */

View File

@ -20,6 +20,7 @@
/* Handler method for all incoming messages of type "headline".
*/
var from_jid = message.getAttribute('from');
var _converse = this.__super__._converse;
if (utils.isHeadlineMessage(message)) {
_converse.chatboxes.create({
'id': from_jid,

View File

@ -1,3 +1,10 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global Backbone */
(function (root, factory) {
define("converse-muc-embedded", [
"converse-api",

View File

@ -11,7 +11,6 @@
*/
(function (root, factory) {
define("converse-muc", [
"converse-core",
"converse-api",
"tpl!chatarea",
"tpl!chatroom",
@ -48,20 +47,6 @@
tpl_room_panel
) {
"use strict";
_converse.templates.chatarea = tpl_chatarea;
_converse.templates.chatroom = tpl_chatroom;
_converse.templates.chatroom_form = tpl_chatroom_form;
_converse.templates.chatroom_nickname_form = tpl_chatroom_nickname_form;
_converse.templates.chatroom_password_form = tpl_chatroom_password_form;
_converse.templates.chatroom_sidebar = tpl_chatroom_sidebar;
_converse.templates.chatroom_head = tpl_chatroom_head;
_converse.templates.chatrooms_tab = tpl_chatrooms_tab;
_converse.templates.info = tpl_info;
_converse.templates.occupant = tpl_occupant;
_converse.templates.room_description = tpl_room_description;
_converse.templates.room_item = tpl_room_item;
_converse.templates.room_panel = tpl_room_panel;
var ROOMS_PANEL_ID = 'chatrooms';
// Strophe methods for building stanzas
@ -77,10 +62,6 @@
_ = converse.env._,
moment = converse.env.moment;
// For translations
var __ = utils.__.bind(_converse);
var ___ = utils.___;
// Add Strophe Namespaces
Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");
Strophe.addNamespace('MUC_OWNER', Strophe.NS.MUC + "#owner");
@ -111,6 +92,7 @@
* returned via the API.
*/
if (!chatbox) { return; }
var _converse = this.__super__._converse;
var view = _converse.chatboxviews.get(chatbox.get('id'));
var box = this.__super__.wrappedChatBox.apply(this, arguments);
box.is_chatroom = view.is_chatroom;
@ -119,6 +101,7 @@
Features: {
addClientFeatures: function () {
var _converse = this.__super__._converse;
this.__super__.addClientFeatures.apply(this, arguments);
if (_converse.allow_muc_invitations) {
_converse.connection.disco.addFeature('jabber:x:conference'); // Invites
@ -191,6 +174,7 @@
ChatBoxViews: {
onChatBoxAdded: function (item) {
var _converse = this.__super__._converse;
var view = this.get(item.get('id'));
if (!view && item.get('type') === 'chatroom') {
view = new _converse.ChatRoomView({'model': item});
@ -206,6 +190,24 @@
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
var _converse = this._converse,
__ = _converse.__,
___ = _converse.___;
_converse.templates.chatarea = tpl_chatarea;
_converse.templates.chatroom = tpl_chatroom;
_converse.templates.chatroom_form = tpl_chatroom_form;
_converse.templates.chatroom_nickname_form = tpl_chatroom_nickname_form;
_converse.templates.chatroom_password_form = tpl_chatroom_password_form;
_converse.templates.chatroom_sidebar = tpl_chatroom_sidebar;
_converse.templates.chatroom_head = tpl_chatroom_head;
_converse.templates.chatrooms_tab = tpl_chatrooms_tab;
_converse.templates.info = tpl_info;
_converse.templates.occupant = tpl_occupant;
_converse.templates.room_description = tpl_room_description;
_converse.templates.room_item = tpl_room_item;
_converse.templates.room_panel = tpl_room_panel;
// XXX: Inside plugins, all calls to the translation machinery
// (e.g. utils.__) should only be done in the initialize function.
// If called before, we won't know what language the user wants,
@ -2376,9 +2378,9 @@
*/
_.each(_converse.auto_join_rooms, function (room) {
if (_.isString(room)) {
converse.api.rooms.open(room);
_converse.api.rooms.open(room);
} else if (_.isObject(room)) {
converse.api.rooms.open(room.jid, room.nick);
_converse.api.rooms.open(room.jid, room.nick);
} else {
_converse.log('Invalid room criteria specified for "auto_join_rooms"', 'error');
}