Add ability to run tests for transpiled code

This commit is contained in:
JC Brand 2018-01-29 13:46:10 +01:00
parent e5006b0004
commit f724f49087
8 changed files with 152 additions and 10 deletions

View File

@ -1002,7 +1002,7 @@
/* rgba supported */
border: 1px solid #999;
/*IE 6/7/8*/
border: none transparent;
border: none rgba(0, 0, 0, 0);
/*IE9 + everything else*/
background-color: #E6E6E6;
text-decoration: none;
@ -2282,7 +2282,7 @@
float: right; }
#conversejs #controlbox .controlbox-panes {
height: 100%;
overflow-y: scroll; }
overflow-y: auto; }
#conversejs #controlbox .controlbox-pane {
padding: 1em;
background-color: white;

View File

@ -1002,7 +1002,7 @@
/* rgba supported */
border: 1px solid #999;
/*IE 6/7/8*/
border: none transparent;
border: none rgba(0, 0, 0, 0);
/*IE9 + everything else*/
background-color: #E6E6E6;
text-decoration: none;
@ -2368,7 +2368,7 @@ body {
float: right; }
#conversejs #controlbox .controlbox-panes {
height: 100%;
overflow-y: scroll; }
overflow-y: auto; }
#conversejs #controlbox .controlbox-pane {
padding: 1.2em;
background-color: white;

View File

@ -16,8 +16,8 @@
<noscript><p><img src="//stats.opkode.com/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<script src="src/website.js"></script>
<![if gte IE 11]>
<link type="text/css" rel="stylesheet" media="screen" href="https://cdn.conversejs.org/3.3.1/css/converse.min.css" />
<script src="https://cdn.conversejs.org/3.3.1/dist/converse.min.js"></script>
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="dist/converse.js"></script>
<![endif]>
</head>

View File

@ -454,7 +454,7 @@
.controlbox-panes {
height: 100%;
overflow-y: scroll;
overflow-y: auto;
}
.controlbox-pane {

View File

@ -597,6 +597,9 @@
renderTab () {
const controlbox = _converse.chatboxes.get('controlbox');
if (_.isNil(controlbox)) {
return;
}
const chats = fp.filter(_.partial(u.isOfType, CHATBOX_TYPE), _converse.chatboxes.models);
this.tab_el.innerHTML = tpl_contacts_tab({
'label_contacts': LABEL_CONTACTS,

View File

@ -175,7 +175,10 @@
} else {
height = "";
}
this.el.querySelector('.box-flyout').style.height = height;
const flyout_el = this.el.querySelector('.box-flyout');
if (!_.isNull(flyout_el)) {
flyout_el.style.height = height;
}
},
setChatBoxWidth (width) {
@ -186,10 +189,12 @@
width = "";
}
this.el.style.width = width;
this.el.querySelector('.box-flyout').style.width = width;
const flyout_el = this.el.querySelector('.box-flyout');
if (!_.isNull(flyout_el)) {
flyout_el.style.width = width;
}
},
adjustToViewport () {
/* Event handler called when viewport gets resized. We remove
* custom width/height from chat boxes.

100
tests/runner-transpiled.js Normal file
View File

@ -0,0 +1,100 @@
/*global config */
// Extra test dependencies
config.paths.jquery = "node_modules/jquery/dist/jquery";
config.paths.mock = "tests/mock";
config.paths['wait-until-promise'] = "node_modules/wait-until-promise/index";
config.paths['test-utils'] = "tests/utils";
config.paths.sinon = "node_modules/sinon/pkg/sinon";
config.paths.transcripts = "converse-logs/converse-logs";
config.paths["jasmine-core"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine";
config.paths.jasmine = "node_modules/jasmine-core/lib/jasmine-core/boot";
config.paths["jasmine-console"] = "node_modules/jasmine-core/lib/console/console";
config.paths["console-reporter"] = "tests/console-reporter";
config.paths["jasmine-html"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine-html";
config.paths.converse = "builds/converse";
config.paths.utils = "builds/utils";
config.paths["converse-bookmarks"] = "builds/converse-bookmarks";
config.paths["converse-chatboxes"] = "builds/converse-chatboxes";
config.paths["converse-chatview"] = "builds/converse-chatview";
config.paths["converse-controlbox"] = "builds/converse-controlbox";
config.paths["converse-core"] = "builds/converse-core";
config.paths["converse-disco"] = "builds/converse-disco";
config.paths["converse-dragresize"] = "builds/converse-dragresize";
config.paths["converse-headline"] = "builds/converse-headline";
config.paths["converse-fullscreen"] = "builds/converse-fullscreen";
config.paths["converse-mam"] = "builds/converse-mam";
config.paths["converse-minimize"] = "builds/converse-minimize";
config.paths["converse-muc"] = "builds/converse-muc";
config.paths["converse-muc-embedded"] = "builds/converse-muc-embedded";
config.paths["converse-notification"] = "builds/converse-notification";
config.paths["converse-otr"] = "builds/converse-otr";
config.paths["converse-ping"] = "builds/converse-ping";
config.paths["converse-profile"] = "builds/converse-profile";
config.paths["converse-register"] = "builds/converse-register";
config.paths["converse-roomslist"] = "builds/converse-roomslist";
config.paths["converse-rosterview"] = "builds/converse-rosterview";
config.paths["converse-singleton"] = "builds/converse-singleton";
config.paths["converse-vcard"] = "builds/converse-vcard";
config.shim.jasmine = {
exports: 'window.jasmineRequire'
};
config.shim['jasmine-html'] = {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
};
config.shim['jasmine-console'] = {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
};
config.shim.jasmine = {
deps: ['jasmine-core', 'jasmine-html', 'jasmine-console'],
exports: 'window.jasmine'
};
require.config(config);
var specs = [
"jasmine",
//"spec/transcripts",
"spec/profiling",
"spec/utils",
"spec/converse",
"spec/bookmarks",
"spec/roomslist",
"spec/headline",
"spec/disco",
"spec/protocol",
"spec/presence",
"spec/eventemitter",
"spec/ping",
"spec/xmppstatus",
"spec/mam",
"spec/otr",
"spec/controlbox",
"spec/roster",
"spec/chatbox",
"spec/chatroom",
"spec/minchats",
"spec/notification",
"spec/register"
];
require(['console-reporter', 'mock', 'sinon', 'wait-until-promise', 'pluggable'],
function(ConsoleReporter, mock, sinon, waitUntilPromise, pluggable) {
window.sinon = sinon;
waitUntilPromise.setPromiseImplementation(window.Promise);
window.waitUntilPromise = waitUntilPromise.default;
window.localStorage.clear();
window.sessionStorage.clear();
// Load the specs
require(specs, function (jasmine) {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(new ConsoleReporter());
window.onload();
});
});

34
transpiled_tests.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Converse.js Tests</title>
<meta name="description" content="Converse.js: A chat client for your website" />
<link rel="shortcut icon" type="image/png" href="node_modules/jasmine-core/images/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" media="screen" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/jasmine.css">
<link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="src/config.js"></script>
<script data-main="tests/runner-transpiled" src="node_modules/requirejs/require.js"></script>
<style>
.tests-brand-heading {
margin-top: 1em;
font-size: 200%;
}
</style>
</head>
<body>
<div id="header_wrap" class="outer">
<header class="inner">
<h1 class="brand-heading tests-brand-heading">
<i class="icon-conversejs"></i> Converse.js</h1>
<h2 id="project_tagline">Tests</h2>
</header>
</div>
</body>
</html>