diff --git a/converse.js b/converse.js index f443dc292..ce5a55f15 100644 --- a/converse.js +++ b/converse.js @@ -72,7 +72,6 @@ this.show_only_online_users = false; this.show_emoticons = true; this.show_toolbar = true; - this.testing = false; // Exposes sensitive data for testing. Never set to true in production systems! this.xhr_custom_status = false; this.xhr_custom_status_url = ''; this.xhr_user_search = false; @@ -100,7 +99,6 @@ 'show_only_online_users', 'show_toolbar', 'sid', - 'testing', 'xhr_custom_status', 'xhr_custom_status_url', 'xhr_user_search', @@ -398,10 +396,22 @@ this.windowState = e.type; },this)); this.giveFeedback(__('Online Contacts')); - if (this.testing) { - this.callback(this); - } else { - this.callback(); + + if (this.callback) { + if (this.connection.service === 'jasmine tests') { + // XXX: Call back with the internal converse object. This + // object should never be exposed to production systems. + // 'jasmine tests' is an invalid http bind service value, + // so we're sure that this is just for tests. + // + // TODO: We might need to consider websockets, which + // probably won't use the 'service' attr. Current + // strophe.js version used by converse.js doesn't support + // websockets. + this.callback(this); + } else { + this.callback(); + } } }, this)); }; diff --git a/tests/mock.js b/tests/mock.js index 617e3ac26..3748504c3 100644 --- a/tests/mock.js +++ b/tests/mock.js @@ -24,13 +24,19 @@ 'Dyon van de Wege', 'Thomas Kalb', 'Dirk Theissen', 'Felix Hofmann', 'Ka Lek', 'Anne Ebersbacher' ]; + mock.event = { + 'preventDefault': function () {} + }; + mock.mock_connection = { + 'mock': true, 'muc': { 'listRooms': function () {}, 'join': function () {}, 'leave': function () {}, 'rooms': {} }, + 'service': 'jasmine tests', 'jid': 'dummy@localhost', 'addHandler': function (handler, ns, name, type, id, from, options) { return function () {};