Fix failing tests after introducing AMD version of Strophe

This commit is contained in:
JC Brand 2015-02-01 16:15:34 +01:00
parent 5a253e32e1
commit f283f6bce5
11 changed files with 30 additions and 53 deletions

View File

@ -23,6 +23,7 @@
var $iq = dependencies.$iq; var $iq = dependencies.$iq;
var $msg = dependencies.$msg; var $msg = dependencies.$msg;
var $pres = dependencies.$pres; var $pres = dependencies.$pres;
var $build = dependencies.$build;
var DSA = dependencies.otr ? dependencies.otr.DSA : undefined; var DSA = dependencies.otr ? dependencies.otr.DSA : undefined;
var OTR = dependencies.otr ? dependencies.otr.OTR : undefined; var OTR = dependencies.otr ? dependencies.otr.OTR : undefined;
var Strophe = dependencies.Strophe; var Strophe = dependencies.Strophe;
@ -5280,7 +5281,12 @@
'env': { 'env': {
'jQuery': $, 'jQuery': $,
'Strophe': Strophe, // TODO: this must be wrapped 'Strophe': Strophe, // TODO: this must be wrapped
'_': _ '$build': $build,
'$iq': $iq,
'$pres': $pres,
'$msg': $msg,
'_': _,
'b64_sha1': b64_sha1
}, },
// Deprecated API methods // Deprecated API methods

View File

@ -8,6 +8,9 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var $msg = converse_api.env.$msg;
var Strophe = converse_api.env.Strophe;
return describe("Chatboxes", $.proxy(function(mock, test_utils) { return describe("Chatboxes", $.proxy(function(mock, test_utils) {
describe("A Chatbox", $.proxy(function () { describe("A Chatbox", $.proxy(function () {
beforeEach(function () { beforeEach(function () {

View File

@ -8,6 +8,9 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var $pres = converse_api.env.$pres;
var $msg = converse_api.env.$msg;
return describe("ChatRooms", $.proxy(function (mock, test_utils) { return describe("ChatRooms", $.proxy(function (mock, test_utils) {
describe("A Chat Room", $.proxy(function () { describe("A Chat Room", $.proxy(function () {
beforeEach(function () { beforeEach(function () {

View File

@ -8,6 +8,8 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var $pres = converse_api.env.$pres;
var $iq = converse_api.env.$iq;
var checkHeaderToggling = function ($header) { var checkHeaderToggling = function ($header) {
var $toggle = $header.find('a.group-toggle'); var $toggle = $header.find('a.group-toggle');

View File

@ -8,8 +8,9 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
return describe("Converse", $.proxy(function(mock, test_utils) { var b64_sha1 = converse_api.env.b64_sha1;
return describe("Converse", $.proxy(function(mock, test_utils) {
describe("The \"tokens\" API", $.proxy(function () { describe("The \"tokens\" API", $.proxy(function () {
beforeEach($.proxy(function () { beforeEach($.proxy(function () {
test_utils.closeAllChatBoxes(); test_utils.closeAllChatBoxes();

View File

@ -8,6 +8,8 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var $msg = converse_api.env.$msg;
return describe("The Minimized Chats Widget", $.proxy(function(mock, test_utils) { return describe("The Minimized Chats Widget", $.proxy(function(mock, test_utils) {
beforeEach(function () { beforeEach(function () {
runs(function () { runs(function () {

View File

@ -8,6 +8,8 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var b64_sha1 = converse_api.env.b64_sha1;
return describe("The OTR module", $.proxy(function(mock, test_utils) { return describe("The OTR module", $.proxy(function(mock, test_utils) {
beforeEach($.proxy(function () { beforeEach($.proxy(function () {

View File

@ -8,6 +8,8 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var Strophe = converse_api.env.Strophe;
describe("Profiling", function() { describe("Profiling", function() {
beforeEach(function() { beforeEach(function() {
converse.connection.roster.items = []; converse.connection.roster.items = [];

View File

@ -8,6 +8,8 @@
} }
); );
} (this, function ($, mock, test_utils) { } (this, function ($, mock, test_utils) {
var Strophe = converse_api.env.Strophe;
var $iq = converse_api.env.$iq;
describe("The Registration Panel", $.proxy(function (mock, test_utils) { describe("The Registration Panel", $.proxy(function (mock, test_utils) {
beforeEach(function () { beforeEach(function () {

View File

@ -1,10 +1,12 @@
(function (root, factory) { (function (root, factory) {
define("mock", define("mock",
['converse'], ['converse'],
function() { function(converse) {
return factory(); return factory(converse);
}); });
}(this, function (converse) { }(this, function (converse) {
var Strophe = converse.env.Strophe;
var $iq = converse.env.$iq;
var mock = {}; var mock = {};
// Names from http://www.fakenamegenerator.com/ // Names from http://www.fakenamegenerator.com/
mock.req_names = [ mock.req_names = [
@ -64,54 +66,5 @@
c.attach(c.jid); c.attach(c.jid);
return c; return c;
}(); }();
/*
{
'muc': {
'listRooms': function () {},
'join': function () {},
'leave': function () {},
'rooms': {},
'groupchat': function () {return String((new Date()).getTime()); }
},
'service': 'jasmine tests',
'addHandler': function (handler, ns, name, type, id, from, options) {
return function () {};
},
'send': function () {},
'roster': {
'add': function () {},
'authorize': function () {},
'unauthorize': function () {},
'get': function () {},
'subscribe': function () {},
'registerCallback': function () {},
'remove': function (jid, callback) { callback(); }
},
'vcard': {
'get': function (callback, jid) {
var fullname;
if (!jid) {
jid = 'dummy@localhost';
fullname = 'Max Mustermann' ;
} else {
var name = jid.split('@')[0].replace(/\./g, ' ').split(' ');
var last = name.length-1;
name[0] = name[0].charAt(0).toUpperCase()+name[0].slice(1);
name[last] = name[last].charAt(0).toUpperCase()+name[last].slice(1);
fullname = name.join(' ');
}
var vcard = $iq().c('vCard').c('FN').t(fullname);
callback(vcard.tree());
}
},
'disco': {
'addFeature': function () {},
'addIdentity': function () {},
'info': function () {},
'items': function () {}
}
};
*/
return mock; return mock;
})); }));

View File

@ -7,6 +7,7 @@
return factory($, mock); return factory($, mock);
}); });
}(this, function ($, mock) { }(this, function ($, mock) {
var Strophe = converse_api.env.Strophe;
var utils = {}; var utils = {};
utils.createRequest = function (iq) { utils.createRequest = function (iq) {