adding test for loading indicator

This commit is contained in:
El RIDO 2017-10-30 06:53:15 +01:00
parent 9c6aec86c4
commit 751731414e
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92

View file

@ -1031,5 +1031,40 @@ describe('Alert', function () {
}
);
});
describe('showLoading', function () {
before(function () {
cleanup();
});
jsc.property(
'shows a loding message',
jsc.array(jsc.elements(alnumString)),
jsc.array(jsc.elements(alnumString)),
'integer',
function (icon, message, number) {
icon = icon.join('');
message = message.join('');
var default_message = 'Loading…';
if (message.length == 0) {
message = default_message;
}
var expected = '<ul class="nav navbar-nav"><li ' +
'id="loadingindicator" class="navbar-text"><span ' +
'class="glyphicon glyphicon-' + icon +
'" aria-hidden="true"></span> ' + message + '</li></ul>';
$('body').html(
'<ul class="nav navbar-nav"><li id="loadingindicator" ' +
'class="navbar-text hidden"><span class="glyphicon ' +
'glyphicon-time" aria-hidden="true"></span> ' +
default_message + '</li></ul>'
);
$.PrivateBin.Alert.init();
$.PrivateBin.Alert.showLoading(message, number, icon);
var result = $('body').html();
return expected === result;
}
);
});
});