Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
toast tests
  • Loading branch information
tomelsj committed Jan 13, 2021
1 parent c20afe0 commit 1e6e9dc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/spec/toast/toastSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ describe( 'Toasts:', function() {
}, toastInDuration);
});

it('Opens a toast with HTML content', function() {
it('Opens a toast with HTML content', function(done) {
let toastContent = document.createElement("span");
toastContent.innerText = 'I am toast content';
M.toast({html: toastContent.outerHTML, displayLength: 400});
let toastSpan = document.querySelector('.toast span');
expect(toastSpan.innerText).toBe('I am toast content');
expect(toastSpan.innerText).not.toBe('I am toast');

setTimeout(function() {
done();
}, 490);
});

it('Toasts should call the callback function when dismissed', function(done) {
Expand All @@ -48,11 +52,15 @@ describe( 'Toasts:', function() {
}, 500);
});

it('Apply two custom class to a toast', function() {
it('Apply two custom class to a toast', function(done) {
M.toast({html:'Hi', displayLength: 400, classes: 'round flat'});
let toastFlat = document.querySelectorAll('.toast.round.flat');
expect(toastFlat.length).toBe(1,
'because the class parameter was passed with two classes');

setTimeout(function() {
done();
}, 490);
});

});
Expand Down

0 comments on commit 1e6e9dc

Please sign in to comment.