From d9f27fb0042eb191324e701535cd5a96c9c7b2fc Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Jun 2019 09:39:21 +0200 Subject: [PATCH] avoid instability of tests due to Alert callback testing, which can prevent notifications from getting displayed --- js/privatebin.js | 4 ++-- js/test/Alert.js | 1 + tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 9bd336e..2d33062 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -4556,8 +4556,8 @@ jQuery.PrivateBin = (function($, RawDeflate) { function isBadBot() { // check whether a bot user agent part can be found in the current // user agent - for (let i = 0; i < badBotUA.length; ++i) { - if (navigator.userAgent.indexOf(badBotUA[i]) >= 0) { + for (const UAfragment of badBotUA) { + if (navigator.userAgent.indexOf(UAfragment) >= 0) { return true; } } diff --git a/js/test/Alert.js b/js/test/Alert.js index 617c488..8f79f7e 100644 --- a/js/test/Alert.js +++ b/js/test/Alert.js @@ -218,6 +218,7 @@ describe('Alert', function () { return jsc.random(0, 1) ? true : $element; }); functions[trigger](message); + $.PrivateBin.Alert.setCustomHandler(null); return handlerCalled; } ); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 4871e2c..b60a9ce 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ if ($MARKDOWN): endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 8a32421..32e662b 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ if ($MARKDOWN): endif; ?> - +