diff --git a/js/privatebin.js b/js/privatebin.js
index 74db28c..f818b98 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -1004,12 +1004,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
$statusMessage,
$remainingTime;
- var currentIcon = [
- 'glyphicon-time', // loading icon
- 'glyphicon-info-sign', // status icon
- '', // resevered for warning, not used yet
- 'glyphicon-alert' // error icon
- ];
+ var currentIcon;
var alertType = [
'loading', // not in bootstrap, but using a good value here
@@ -1253,6 +1248,13 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
$loadingIndicator = $('#loadingindicator');
$statusMessage = $('#status');
$remainingTime = $('#remainingtime');
+
+ currentIcon = [
+ 'glyphicon-time', // loading icon
+ 'glyphicon-info-sign', // status icon
+ '', // reserved for warning, not used yet
+ 'glyphicon-alert' // error icon
+ ];
}
return me;
diff --git a/js/test.js b/js/test.js
index 6a67972..63b6ba4 100644
--- a/js/test.js
+++ b/js/test.js
@@ -943,3 +943,93 @@ describe('UiHelper', function () {
});
});
+describe('Alert', function () {
+ describe('showStatus', function () {
+ before(function () {
+ cleanup();
+ });
+
+ jsc.property(
+ 'shows a status message',
+ jsc.array(jsc.elements(alnumString)),
+ jsc.array(jsc.elements(alnumString)),
+ function (icon, message) {
+ icon = icon.join('');
+ message = message.join('');
+ var expected = '
' + message + '
';
+ $('body').html(
+ '
'
+ );
+ $.PrivateBin.Alert.init();
+ $.PrivateBin.Alert.showStatus(message, icon);
+ var result = $('body').html();
+ return expected === result;
+ }
+ );
+ });
+
+ describe('showError', function () {
+ before(function () {
+ cleanup();
+ });
+
+ jsc.property(
+ 'shows an error message',
+ jsc.array(jsc.elements(alnumString)),
+ jsc.array(jsc.elements(alnumString)),
+ function (icon, message) {
+ icon = icon.join('');
+ message = message.join('');
+ var expected = ' ' + message + '
';
+ $('body').html(
+ '
'
+ );
+ $.PrivateBin.Alert.init();
+ $.PrivateBin.Alert.showError(message, icon);
+ var result = $('body').html();
+ return expected === result;
+ }
+ );
+ });
+
+ describe('showRemaining', function () {
+ before(function () {
+ cleanup();
+ });
+
+ jsc.property(
+ 'shows remaining time',
+ jsc.array(jsc.elements(alnumString)),
+ jsc.array(jsc.elements(alnumString)),
+ 'integer',
+ function (message, string, number) {
+ message = message.join('');
+ string = string.join('');
+ var expected = '' +
+ ' ' + string + message + number + '
';
+ $('body').html(
+ '
'
+ );
+ $.PrivateBin.Alert.init();
+ $.PrivateBin.Alert.showRemaining(['%s' + message + '%d', string, number]);
+ var result = $('body').html();
+ return expected === result;
+ }
+ );
+ });
+});
+
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index 609ccb7..036452e 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -69,7 +69,7 @@ if ($MARKDOWN):
-
+
diff --git a/tpl/page.php b/tpl/page.php
index 8b8fcad..1cae6b3 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -47,7 +47,7 @@ if ($MARKDOWN):
-
+