Delicious testing

This commit is contained in:
Caleb James DeLisle
2017-05-31 19:40:17 +02:00
parent 7b94106bac
commit 24f37ea414
3 changed files with 64 additions and 15 deletions

View File

@@ -1,8 +1,9 @@
define([
'jquery',
'/common/cryptpad-common.js',
'/common/test.js',
'/bower_components/tweetnacl/nacl-fast.min.js'
], function ($, Cryptpad) {
], function ($, Cryptpad, Test) {
var Nacl = window.nacl;
var signMsg = function (msg, privKey) {
@@ -23,6 +24,11 @@ define([
Cryptpad.ready(function () {
console.log('IFRAME READY');
Test(function () {
// This is only here to maybe trigger an error.
window.drive = Cryptpad.getStore().getProxy().proxy['drive'];
Test.passed();
});
$(window).on("message", function (jqe) {
var evt = jqe.originalEvent;
var data = JSON.parse(evt.data);

30
www/common/test.js Normal file
View File

@@ -0,0 +1,30 @@
define([], function () {
var out = function () { };
if (window.location.hash.indexOf("?test=test") > -1) {
window.onerror = function (msg, url, lineNo, columnNo, e) {
document.body.innerHTML = '<div class="report fail">' +
JSON.stringify([
msg,
url,
lineNo,
columnNo,
e ? e.message : null,
e ? e.stack : null
]).replace(/</g, '') +
'</div>';
};
require.onError = function (e) {
document.body.innerHTML = '<div class="report fail">' +
JSON.stringify([
e ? e.message : null,
e ? e.stack : null
]).replace(/</g, '') +
'</div>';
};
out = function (f) { f(); }
}
out.passed = function () {
document.body.innerHTML = '<div class="report success">Test Passed</div>';
}
return out;
});