Skip to content

Commit 90cb692

Browse files
committed
test(toast): add isVisibleChange event test #10812
1 parent edb20e7 commit 90cb692

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

projects/igniteui-angular/src/lib/toast/toast.component.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,20 @@ describe('IgxToast', () => {
4242
expect(toast.element.id).toContain('customToast');
4343
});
4444

45-
it('should properly toggle', fakeAsync(() => {
46-
//spyOn(toast.isVisibleChange, 'emit').and.callThrough();
45+
it('should properly toggle and emit isVisibleChange', fakeAsync(() => {
46+
spyOn(toast.isVisibleChange, 'emit').and.callThrough();
4747
expect(toast.isVisible).toBe(false);
48+
expect(toast.isVisibleChange.emit).toHaveBeenCalledTimes(0);
49+
4850
toast.toggle();
4951
expect(toast.isVisible).toBe(true);
52+
flushMicrotasks();
53+
expect(toast.isVisibleChange.emit).toHaveBeenCalledOnceWith({ owner: toast, id: '0' });
54+
5055
toast.toggle();
5156
flushMicrotasks();
5257
expect(toast.isVisible).toBe(false);
58+
expect(toast.isVisibleChange.emit).toHaveBeenCalledTimes(2);
5359
}));
5460
});
5561

0 commit comments

Comments
 (0)