|
@@ -24,6 +24,27 @@ describe('Alert', function () {
|
|
|
jsc.property(
|
|
jsc.property(
|
|
|
'shows a status message (bootstrap)',
|
|
'shows a status message (bootstrap)',
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
|
|
+ function (message) {
|
|
|
|
|
+ message = message.join('');
|
|
|
|
|
+ const expected = '<div id="status" role="alert" ' +
|
|
|
|
|
+ 'class="statusmessage alert alert-info"><span ' +
|
|
|
|
|
+ 'class="glyphicon glyphicon-info-sign" ' +
|
|
|
|
|
+ 'aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
|
|
+ $('body').html(
|
|
|
|
|
+ '<div id="status" role="alert" class="statusmessage ' +
|
|
|
|
|
+ 'alert alert-info hidden"><span class="glyphicon ' +
|
|
|
|
|
+ 'glyphicon-info-sign" aria-hidden="true"></span> </div>'
|
|
|
|
|
+ );
|
|
|
|
|
+ $.PrivateBin.Alert.init();
|
|
|
|
|
+ $.PrivateBin.Alert.showStatus(message);
|
|
|
|
|
+ const result = $('body').html();
|
|
|
|
|
+ return expected === result;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ jsc.property(
|
|
|
|
|
+ 'shows a status message (bootstrap, custom icon)',
|
|
|
|
|
+ jsc.array(common.jscAlnumString()),
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
function (icon, message) {
|
|
function (icon, message) {
|
|
|
icon = icon.join('');
|
|
icon = icon.join('');
|
|
@@ -31,7 +52,7 @@ describe('Alert', function () {
|
|
|
const expected = '<div id="status" role="alert" ' +
|
|
const expected = '<div id="status" role="alert" ' +
|
|
|
'class="statusmessage alert alert-info"><span ' +
|
|
'class="statusmessage alert alert-info"><span ' +
|
|
|
'class="glyphicon glyphicon-' + icon +
|
|
'class="glyphicon glyphicon-' + icon +
|
|
|
- '" aria-hidden="true"></span> ' + message + '</div>';
|
|
|
|
|
|
|
+ '" aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<div id="status" role="alert" class="statusmessage ' +
|
|
'<div id="status" role="alert" class="statusmessage ' +
|
|
|
'alert alert-info hidden"><span class="glyphicon ' +
|
|
'alert alert-info hidden"><span class="glyphicon ' +
|
|
@@ -45,13 +66,13 @@ describe('Alert', function () {
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- describe('showError', function () {
|
|
|
|
|
|
|
+ describe('showWarning', function () {
|
|
|
before(function () {
|
|
before(function () {
|
|
|
cleanup();
|
|
cleanup();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
jsc.property(
|
|
jsc.property(
|
|
|
- 'shows an error message (basic)',
|
|
|
|
|
|
|
+ 'shows a warning message (basic)',
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
function (icon, message) {
|
|
function (icon, message) {
|
|
@@ -62,14 +83,36 @@ describe('Alert', function () {
|
|
|
'<div id="errormessage"></div>'
|
|
'<div id="errormessage"></div>'
|
|
|
);
|
|
);
|
|
|
$.PrivateBin.Alert.init();
|
|
$.PrivateBin.Alert.init();
|
|
|
- $.PrivateBin.Alert.showError(message, icon);
|
|
|
|
|
|
|
+ $.PrivateBin.Alert.showWarning(message, icon);
|
|
|
const result = $('body').html();
|
|
const result = $('body').html();
|
|
|
return expected === result;
|
|
return expected === result;
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
jsc.property(
|
|
jsc.property(
|
|
|
- 'shows an error message (bootstrap)',
|
|
|
|
|
|
|
+ 'shows a warning message (bootstrap)',
|
|
|
|
|
+ jsc.array(common.jscAlnumString()),
|
|
|
|
|
+ jsc.array(common.jscAlnumString()),
|
|
|
|
|
+ function (message) {
|
|
|
|
|
+ message = message.join('');
|
|
|
|
|
+ const expected = '<div id="errormessage" role="alert" ' +
|
|
|
|
|
+ 'class="statusmessage alert alert-danger"><span ' +
|
|
|
|
|
+ 'class="glyphicon glyphicon-warning-sign" ' +
|
|
|
|
|
+ 'aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
|
|
+ $('body').html(
|
|
|
|
|
+ '<div id="errormessage" role="alert" class="statusmessage ' +
|
|
|
|
|
+ 'alert alert-danger hidden"><span class="glyphicon ' +
|
|
|
|
|
+ 'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
|
|
|
+ );
|
|
|
|
|
+ $.PrivateBin.Alert.init();
|
|
|
|
|
+ $.PrivateBin.Alert.showWarning(message);
|
|
|
|
|
+ const result = $('body').html();
|
|
|
|
|
+ return expected === result;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ jsc.property(
|
|
|
|
|
+ 'shows a warning message (bootstrap, custom icon)',
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
function (icon, message) {
|
|
function (icon, message) {
|
|
@@ -78,27 +121,27 @@ describe('Alert', function () {
|
|
|
const expected = '<div id="errormessage" role="alert" ' +
|
|
const expected = '<div id="errormessage" role="alert" ' +
|
|
|
'class="statusmessage alert alert-danger"><span ' +
|
|
'class="statusmessage alert alert-danger"><span ' +
|
|
|
'class="glyphicon glyphicon-' + icon +
|
|
'class="glyphicon glyphicon-' + icon +
|
|
|
- '" aria-hidden="true"></span> ' + message + '</div>';
|
|
|
|
|
|
|
+ '" aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<div id="errormessage" role="alert" class="statusmessage ' +
|
|
'<div id="errormessage" role="alert" class="statusmessage ' +
|
|
|
'alert alert-danger hidden"><span class="glyphicon ' +
|
|
'alert alert-danger hidden"><span class="glyphicon ' +
|
|
|
'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
|
);
|
|
);
|
|
|
$.PrivateBin.Alert.init();
|
|
$.PrivateBin.Alert.init();
|
|
|
- $.PrivateBin.Alert.showError(message, icon);
|
|
|
|
|
|
|
+ $.PrivateBin.Alert.showWarning(message, icon);
|
|
|
const result = $('body').html();
|
|
const result = $('body').html();
|
|
|
return expected === result;
|
|
return expected === result;
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- describe('showWarning', function () {
|
|
|
|
|
|
|
+ describe('showError', function () {
|
|
|
before(function () {
|
|
before(function () {
|
|
|
cleanup();
|
|
cleanup();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
jsc.property(
|
|
jsc.property(
|
|
|
- 'shows a warning message (basic)',
|
|
|
|
|
|
|
+ 'shows an error message (basic)',
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
function (icon, message) {
|
|
function (icon, message) {
|
|
@@ -109,14 +152,36 @@ describe('Alert', function () {
|
|
|
'<div id="errormessage"></div>'
|
|
'<div id="errormessage"></div>'
|
|
|
);
|
|
);
|
|
|
$.PrivateBin.Alert.init();
|
|
$.PrivateBin.Alert.init();
|
|
|
- $.PrivateBin.Alert.showWarning(message, icon);
|
|
|
|
|
|
|
+ $.PrivateBin.Alert.showError(message, icon);
|
|
|
const result = $('body').html();
|
|
const result = $('body').html();
|
|
|
return expected === result;
|
|
return expected === result;
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
jsc.property(
|
|
jsc.property(
|
|
|
- 'shows a warning message (bootstrap)',
|
|
|
|
|
|
|
+ 'shows an error message (bootstrap)',
|
|
|
|
|
+ jsc.array(common.jscAlnumString()),
|
|
|
|
|
+ jsc.array(common.jscAlnumString()),
|
|
|
|
|
+ function (icon, message) {
|
|
|
|
|
+ message = message.join('');
|
|
|
|
|
+ const expected = '<div id="errormessage" role="alert" ' +
|
|
|
|
|
+ 'class="statusmessage alert alert-danger"><span ' +
|
|
|
|
|
+ 'class="glyphicon glyphicon-alert" ' +
|
|
|
|
|
+ 'aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
|
|
+ $('body').html(
|
|
|
|
|
+ '<div id="errormessage" role="alert" class="statusmessage ' +
|
|
|
|
|
+ 'alert alert-danger hidden"><span class="glyphicon ' +
|
|
|
|
|
+ 'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
|
|
|
+ );
|
|
|
|
|
+ $.PrivateBin.Alert.init();
|
|
|
|
|
+ $.PrivateBin.Alert.showError(message);
|
|
|
|
|
+ const result = $('body').html();
|
|
|
|
|
+ return expected === result;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ jsc.property(
|
|
|
|
|
+ 'shows an error message (bootstrap, custom icon)',
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
jsc.array(common.jscAlnumString()),
|
|
jsc.array(common.jscAlnumString()),
|
|
|
function (icon, message) {
|
|
function (icon, message) {
|
|
@@ -125,14 +190,14 @@ describe('Alert', function () {
|
|
|
const expected = '<div id="errormessage" role="alert" ' +
|
|
const expected = '<div id="errormessage" role="alert" ' +
|
|
|
'class="statusmessage alert alert-danger"><span ' +
|
|
'class="statusmessage alert alert-danger"><span ' +
|
|
|
'class="glyphicon glyphicon-' + icon +
|
|
'class="glyphicon glyphicon-' + icon +
|
|
|
- '" aria-hidden="true"></span> ' + message + '</div>';
|
|
|
|
|
|
|
+ '" aria-hidden="true"></span> <span>' + message + '</span></div>';
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<div id="errormessage" role="alert" class="statusmessage ' +
|
|
'<div id="errormessage" role="alert" class="statusmessage ' +
|
|
|
'alert alert-danger hidden"><span class="glyphicon ' +
|
|
'alert alert-danger hidden"><span class="glyphicon ' +
|
|
|
'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
'glyphicon-alert" aria-hidden="true"></span> </div>'
|
|
|
);
|
|
);
|
|
|
$.PrivateBin.Alert.init();
|
|
$.PrivateBin.Alert.init();
|
|
|
- $.PrivateBin.Alert.showWarning(message, icon);
|
|
|
|
|
|
|
+ $.PrivateBin.Alert.showError(message, icon);
|
|
|
const result = $('body').html();
|
|
const result = $('body').html();
|
|
|
return expected === result;
|
|
return expected === result;
|
|
|
}
|
|
}
|
|
@@ -174,7 +239,7 @@ describe('Alert', function () {
|
|
|
const expected = '<div id="remainingtime" role="alert" ' +
|
|
const expected = '<div id="remainingtime" role="alert" ' +
|
|
|
'class="alert alert-info"><span ' +
|
|
'class="alert alert-info"><span ' +
|
|
|
'class="glyphicon glyphicon-fire" aria-hidden="true">' +
|
|
'class="glyphicon glyphicon-fire" aria-hidden="true">' +
|
|
|
- '</span> ' + string + message + number + '</div>';
|
|
|
|
|
|
|
+ '</span> <span>' + string + message + number + '</span></div>';
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<div id="remainingtime" role="alert" class="hidden ' +
|
|
'<div id="remainingtime" role="alert" class="hidden ' +
|
|
|
'alert alert-info"><span class="glyphicon ' +
|
|
'alert alert-info"><span class="glyphicon ' +
|
|
@@ -229,7 +294,7 @@ describe('Alert', function () {
|
|
|
const expected = '<ul class="nav navbar-nav"><li ' +
|
|
const expected = '<ul class="nav navbar-nav"><li ' +
|
|
|
'id="loadingindicator" class="navbar-text"><span ' +
|
|
'id="loadingindicator" class="navbar-text"><span ' +
|
|
|
'class="glyphicon glyphicon-' + icon +
|
|
'class="glyphicon glyphicon-' + icon +
|
|
|
- '" aria-hidden="true"></span> ' + message + '</li></ul>';
|
|
|
|
|
|
|
+ '" aria-hidden="true"></span> <span>' + message + '</span></li></ul>';
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<ul class="nav navbar-nav"><li id="loadingindicator" ' +
|
|
'<ul class="nav navbar-nav"><li id="loadingindicator" ' +
|
|
|
'class="navbar-text hidden"><span class="glyphicon ' +
|
|
'class="navbar-text hidden"><span class="glyphicon ' +
|