xmpp.chapril.org-conversejs/test_minified.html
JC Brand 2d4a14ac2d Don't expose the Strophe connection object globally.
Instead, expose only the initialize and onConnected functions.
Updated the tests to work with this.
2013-08-05 09:25:29 +02:00

124 lines
4.9 KiB
HTML

<!doctype html public "-//w3c//dtd html 4.01 transitional//en"
"http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<title>converse.js tests for minified files</title>
<meta name="description" content="converse.js: open source browser-based instant messaging" />
<link rel="shortcut icon" type="image/png" href="components/jasmine/images/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="components/jasmine/src/html/jasmine.css">
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<link rel="stylesheet" type="text/css" media="screen" href="converse.min.css">
<script src="converse.min.js"></script>
<script src="components/jasmine/lib/jasmine-core/jasmine.js"></script>
<script src="components/jasmine/lib/jasmine-core/jasmine-html.js"></script>
<script src="node_modules/jasmine-reporters/src/jasmine.console_reporter.js"></script>
<script src="node_modules/jasmine-reporters/src/jasmine.junit_reporter.js"></script>
</head>
<body>
<div id="header_wrap" class="outer">
<header class="inner">
<h1 id="project_title"><a href="http://conversejs.org">converse.js</a></h1>
<h2 id="project_tagline">tests</h2>
</header>
</div>
<div id="chatpanel">
<div id="collective-xmpp-chat-data"></div>
<div id="toggle-controlbox">
<a href="#" class="chat toggle-online-users">
<span class="conn-feedback">click here to chat</span> <strong style="display: none" id="online-count">(0)</strong>
</a>
</div>
</div>
<script>
var mock_connection = {
'muc': {
'listRooms': function () {},
'join': function () {},
'leave': function () {},
'removeRoom': function () {},
'rooms': {}
},
'jid': 'dummy@localhost',
'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 () {}
},
'vcard': {
'get': function (callback, jid) {
var firstname, lastname;
if (!jid) {
jid = 'dummy@localhost';
firstname = 'Max';
lastname = 'Mustermann';
} else {
var name = jid.split('@')[0].replace('.', ' ').split(' ');
firstname = name[0].charAt(0).toUpperCase()+name[0].slice(1);
lastname = name[1].charAt(0).toUpperCase()+name[1].slice(1);
}
var fullname = firstname+' '+lastname;
var vcard = $iq().c('vCard').c('FN').t(fullname);
callback(vcard.tree());
}
},
'disco': {
'info': function () {},
'items': function () {}
}
};
require([
"jquery",
"converse",
], function($, converse) {
// Set up converse.js
window.localStorage.clear();
converse.initialize({
prebind: false,
xhr_user_search: false,
auto_subscribe: false,
animate: false
});
converse.onConnected(
mock_connection,
function (converse) {
window.converse = converse;
require([
"spec/MainSpec",
"spec/ChatRoomSpec"
], function () {
// Jasmine stuff
var jasmineEnv = jasmine.getEnv();
if (/PhantomJS/.test(navigator.userAgent)) {
jasmineEnv.addReporter(new jasmine.TrivialReporter());
jasmineEnv.addReporter(new jasmine.JUnitXmlReporter('./test-reports/'));
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
jasmineEnv.updateInterval = 0;
} else {
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.addReporter(new jasmine.ConsoleReporter());
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
jasmineEnv.updateInterval = 200;
}
jasmineEnv.execute();
});
}
);
}
);
</script>
</body>
</html>