Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
b01d00f74a
@ -36,7 +36,10 @@ var nt = nThen(function (waitFor) {
|
|||||||
}).nThen;
|
}).nThen;
|
||||||
|
|
||||||
[
|
[
|
||||||
|
// login test must happen after register test
|
||||||
['/register/', {}],
|
['/register/', {}],
|
||||||
|
['/login/', {}],
|
||||||
|
|
||||||
['/assert/', {}],
|
['/assert/', {}],
|
||||||
['/auth/', {}],
|
['/auth/', {}],
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,10 @@ define([
|
|||||||
'/common/common-realtime.js',
|
'/common/common-realtime.js',
|
||||||
'/common/common-feedback.js',
|
'/common/common-feedback.js',
|
||||||
'/common/outer/local-store.js',
|
'/common/outer/local-store.js',
|
||||||
|
'/common/test.js',
|
||||||
|
|
||||||
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||||
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore) {
|
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) {
|
||||||
$(function () {
|
$(function () {
|
||||||
var $main = $('#mainBlock');
|
var $main = $('#mainBlock');
|
||||||
var Messages = Cryptpad.Messages;
|
var Messages = Cryptpad.Messages;
|
||||||
@ -53,6 +54,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
var hashing = false;
|
var hashing = false;
|
||||||
|
var test;
|
||||||
$('button.login').click(function () {
|
$('button.login').click(function () {
|
||||||
if (hashing) { return void console.log("hashing is already in progress"); }
|
if (hashing) { return void console.log("hashing is already in progress"); }
|
||||||
|
|
||||||
@ -89,6 +91,11 @@ define([
|
|||||||
Realtime.whenRealtimeSyncs(result.realtime, function() {
|
Realtime.whenRealtimeSyncs(result.realtime, function() {
|
||||||
LocalStore.login(result.userHash, result.userName, function () {
|
LocalStore.login(result.userHash, result.userName, function () {
|
||||||
hashing = false;
|
hashing = false;
|
||||||
|
if (test) {
|
||||||
|
localStorage.clear();
|
||||||
|
test.pass();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (sessionStorage.redirectTo) {
|
if (sessionStorage.redirectTo) {
|
||||||
var h = sessionStorage.redirectTo;
|
var h = sessionStorage.redirectTo;
|
||||||
var parser = document.createElement('a');
|
var parser = document.createElement('a');
|
||||||
@ -145,5 +152,12 @@ define([
|
|||||||
}
|
}
|
||||||
window.location.href = '/register/';
|
window.location.href = '/register/';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Test(function (t) {
|
||||||
|
$uname.val('testuser');
|
||||||
|
$passwd.val('testtest');
|
||||||
|
test = t;
|
||||||
|
$('button.login').click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,7 +13,6 @@ define([
|
|||||||
'/common/diffMarked.js',
|
'/common/diffMarked.js',
|
||||||
'/common/sframe-common-codemirror.js',
|
'/common/sframe-common-codemirror.js',
|
||||||
'/common/common-thumbnail.js',
|
'/common/common-thumbnail.js',
|
||||||
'/bower_components/chainpad/chainpad.dist.js',
|
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
'cm/lib/codemirror',
|
'cm/lib/codemirror',
|
||||||
@ -43,7 +42,6 @@ define([
|
|||||||
DiffMd,
|
DiffMd,
|
||||||
SframeCM,
|
SframeCM,
|
||||||
Thumb,
|
Thumb,
|
||||||
ChainPad,
|
|
||||||
UI,
|
UI,
|
||||||
Messages,
|
Messages,
|
||||||
CMeditor,
|
CMeditor,
|
||||||
@ -1110,6 +1108,8 @@ define([
|
|||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
$('#cp-app-poll-create-user').click();
|
$('#cp-app-poll-create-user').click();
|
||||||
setTimeout(waitFor());
|
setTimeout(waitFor());
|
||||||
|
}).nThen(function (waitFor) {
|
||||||
|
APP.rt.realtime.onSettle(waitFor());
|
||||||
}).nThen(function (/*waitFor*/) {
|
}).nThen(function (/*waitFor*/) {
|
||||||
passIfOk(t);
|
passIfOk(t);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -54,11 +54,8 @@ define([
|
|||||||
var $register = $('button#register');
|
var $register = $('button#register');
|
||||||
|
|
||||||
var registering = false;
|
var registering = false;
|
||||||
|
var test;
|
||||||
var logMeIn = function (result) {
|
var logMeIn = function (result) {
|
||||||
if (Test.testing) {
|
|
||||||
Test.passed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LocalStore.setUserHash(result.userHash);
|
LocalStore.setUserHash(result.userHash);
|
||||||
|
|
||||||
var proxy = result.proxy;
|
var proxy = result.proxy;
|
||||||
@ -72,6 +69,11 @@ define([
|
|||||||
Realtime.whenRealtimeSyncs(result.realtime, function () {
|
Realtime.whenRealtimeSyncs(result.realtime, function () {
|
||||||
LocalStore.login(result.userHash, result.userName, function () {
|
LocalStore.login(result.userHash, result.userName, function () {
|
||||||
registering = false;
|
registering = false;
|
||||||
|
if (test) {
|
||||||
|
localStorage.clear();
|
||||||
|
test.pass();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (sessionStorage.redirectTo) {
|
if (sessionStorage.redirectTo) {
|
||||||
var h = sessionStorage.redirectTo;
|
var h = sessionStorage.redirectTo;
|
||||||
var parser = document.createElement('a');
|
var parser = document.createElement('a');
|
||||||
@ -236,8 +238,9 @@ define([
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Test(function () {
|
Test(function (t) {
|
||||||
$uname.val('test' + Math.random());
|
test = t;
|
||||||
|
$uname.val('testuser');
|
||||||
$passwd.val('testtest');
|
$passwd.val('testtest');
|
||||||
$confirm.val('testtest');
|
$confirm.val('testtest');
|
||||||
$checkImport[0].checked = true;
|
$checkImport[0].checked = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user