Commit d4fa4310 authored by JC Brand's avatar JC Brand

Don't use 'testing' attr override.

Can be used to get the unwrapper 'inner' converse object.

Instead, check that the bosh service value of the connection corresponds to the
mock object used for jasmine tests.
The value tested for is not usable in production, so we're sure we're only
running tests.
parent 44fe406a
......@@ -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));
};
......
......@@ -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 () {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment