From dc86579d46647bb3cd6de08be4b27bd7bf984227 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Sep 2017 14:00:48 +0200 Subject: [PATCH 1/3] use an 8 character password for tests --- www/register/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/register/main.js b/www/register/main.js index e8fdb8d22..3e57006f5 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -252,8 +252,8 @@ define([ Test(function () { $uname.val('test' + Math.random()); - $passwd.val('test'); - $confirm.val('test'); + $passwd.val('testtest'); + $confirm.val('testtest'); $checkImport[0].checked = true; $checkAcceptTerms[0].checked = true; $register.click(); From 0db33d48fc214f34a78388a9e2ad31a05254a93a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Sep 2017 14:52:58 +0200 Subject: [PATCH 2/3] properly handle variable args in Cryptpad.alert --- www/common/common-interface.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 2e7b6e640..57f5bc4b7 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -215,9 +215,10 @@ define([ force = opt.force || false; } else if (typeof(opt) === 'boolean') { force = opt; + } + if (typeof(opt) !== 'object') { opt = {}; } - cb = cb || function () {}; var message; From a332168926835d5fd54dcea8bde3405126e69b5b Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Sep 2017 15:52:31 +0200 Subject: [PATCH 3/3] fix some bugs in prompts, alerts, confirms --- www/common/common-interface.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 57f5bc4b7..a22b4d394 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -279,22 +279,25 @@ define([ ]); var listener; - var close = Util.once(function () { - $(frame).fadeOut(150, function () { $(this).remove(); }); - stopListening(listener); + var close = Util.once(function (result, ev) { + var $frame = $(frame).fadeOut(150, function () { + stopListening(listener); + $frame.remove(); + cb(result, ev); + }); }); - var $ok = $(ok).click(function (ev) { cb(input.value, ev); }); - var $cancel = $(cancel).click(function (ev) { cb(null, ev); }); + var $ok = $(ok).click(function (ev) { close(input.value, ev); }); + var $cancel = $(cancel).click(function (ev) { close(null, ev); }); listener = listenForKeys(function () { // yes - close(); $ok.click(); + $ok.click(); }, function () { // no - close(); $cancel.click(); + $cancel.click(); }); document.body.appendChild(frame); setTimeout(function () { - input.select().focus(); + $(input).select().focus(); UI.notify(); }); }; @@ -322,13 +325,14 @@ define([ ]); var listener; - var close = Util.once(function () { + var close = Util.once(function (bool, ev) { $(frame).fadeOut(150, function () { $(this).remove(); }); stopListening(listener); + cb(bool, ev); }); - var $ok = $(ok).click(function (ev) { close(); cb(true, ev); }); - var $cancel = $(cancel).click(function (ev) { close(); cb(false, ev); }); + var $ok = $(ok).click(function (ev) { close(true, ev); }); + var $cancel = $(cancel).click(function (ev) { close(false, ev); }); if (opt.cancelClass) { $cancel.addClass(opt.cancelClass); } if (opt.okClass) { $ok.addClass(opt.okClass); }