Fix mixed test for "show" and "showTemporary"

"showTemporary()" when a timeout was given was being tested along with
the "show()" tests; now there are two separate tests when a timeout is
given, one for "showTemporary()" and one for "show()".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2019-07-26 17:49:58 +02:00
parent 2b1c80ea3f
commit 14006b548e
1 changed files with 19 additions and 1 deletions

View File

@ -958,13 +958,31 @@ describe('Core base tests', function() {
// travel in time +7000 milliseconds
clock.tick(7500);
$row = $('#testArea .toastify');
expect($row.length).toEqual(0);
});
it('hides itself after a given time', function() {
OC.Notification.showTemporary('', {timeout: 10});
var $row = $('#testArea .toastify');
expect($row.length).toEqual(1);
// travel in time +7000 milliseconds
clock.tick(7500);
$row = $('#testArea .toastify');
expect($row.length).toEqual(1);
// travel in time another 4000 milliseconds
clock.tick(4000);
$row = $('#testArea .toastify');
expect($row.length).toEqual(0);
});
});
describe('show', function() {
it('hides itself after a given time', function() {
OC.Notification.showTemporary('', {timeout: 10});
OC.Notification.show('', {timeout: 10});
var $row = $('#testArea .toastify');
expect($row.length).toEqual(1);