Skip to content

Commit 3f3e44e

Browse files
committed
Merge branch 'sivanova/fix-toast-margin' of github.com:IgniteUI/igniteui-angular into sivanova/fix-toast-margin
2 parents daf06d8 + 98d2f5a commit 3f3e44e

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, ViewChild, ElementRef} from '@angular/core';
1+
import {Component, ViewChild } from '@angular/core';
22
import {async, TestBed, fakeAsync, tick, ComponentFixture} from '@angular/core/testing';
33
import {By} from '@angular/platform-browser';
44
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@@ -84,13 +84,13 @@ describe('IgxToast', () => {
8484
toast.show();
8585

8686
expect(toast.isVisible).toBeTruthy();
87-
expect(toast._animationState).toBe('visible');
87+
expect(toast.animationState).toBe('visible');
8888
expect(toast.autoHide).toBeTruthy();
8989

9090
tick(1000);
9191

9292
expect(toast.isVisible).toBeFalsy();
93-
expect(toast._animationState).toBe('invisible');
93+
expect(toast.animationState).toBe('invisible');
9494
}));
9595

9696
it('should not auto hide after it\'s open', fakeAsync(() => {
@@ -100,13 +100,13 @@ describe('IgxToast', () => {
100100
toast.show();
101101

102102
expect(toast.isVisible).toBeTruthy();
103-
expect(toast._animationState).toBe('visible');
103+
expect(toast.animationState).toBe('visible');
104104
expect(toast.autoHide).toBeFalsy();
105105

106106
tick(1000);
107107

108108
expect(toast.isVisible).toBeTruthy();
109-
expect(toast._animationState).toBe('visible');
109+
expect(toast.animationState).toBe('visible');
110110
}));
111111

112112
it('visibility is updated by the toggle() method', () => {
@@ -117,7 +117,7 @@ describe('IgxToast', () => {
117117

118118
toast.show();
119119
expect(toast.isVisible).toBe(true);
120-
expect(toast._animationState).toBe('visible');
120+
expect(toast.animationState).toBe('visible');
121121

122122
expect(toast.onShowing.emit).toHaveBeenCalledTimes(1);
123123
expect(toast.onShown.emit).toHaveBeenCalledTimes(1);
@@ -126,12 +126,13 @@ describe('IgxToast', () => {
126126

127127
toast.toggle();
128128
expect(toast.isVisible).toBe(false);
129-
expect(toast._animationState).toBe('invisible');
129+
expect(toast.animationState).toBe('invisible');
130130

131131
expect(toast.onShowing.emit).toHaveBeenCalledTimes(1);
132132
expect(toast.onShown.emit).toHaveBeenCalledTimes(1);
133133
expect(toast.onHiding.emit).toHaveBeenCalledTimes(1);
134134
expect(toast.onHidden.emit).toHaveBeenCalledTimes(1);
135+
135136
});
136137
});
137138

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ let NEXT_ID = 0;
5151
`]
5252
})
5353
export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
54-
@HostBinding('@animate')
55-
private _animationState = 'invisible';
5654
private _isVisible = false;
5755

56+
/**
57+
* @hidden
58+
*/
59+
@HostBinding('@animate')
60+
public animationState = 'invisible';
61+
5862
/**
5963
* Sets/gets the `id` of the toast.
6064
* If not set, the `id` will have value `"igx-toast-0"`.
@@ -230,7 +234,7 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
230234
/**
231235
* @hidden
232236
*/
233-
private timeoutId;
237+
private timeoutId: number;
234238

235239
constructor(
236240
private elementRef: ElementRef,
@@ -248,10 +252,10 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
248252
clearInterval(this.timeoutId);
249253
this.onShowing.emit(this);
250254
this.isVisible = true;
251-
this._animationState = 'visible';
255+
this.animationState = 'visible';
252256

253257
if (this.autoHide) {
254-
this.timeoutId = setTimeout(() => {
258+
this.timeoutId = window.setTimeout(() => {
255259
this.hide();
256260
}, this.displayTime);
257261
}
@@ -270,7 +274,7 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
270274
this.onHiding.emit(this);
271275
this.isVisible = false;
272276
this.onHidden.emit(this);
273-
this._animationState = 'invisible';
277+
this.animationState = 'invisible';
274278

275279
clearInterval(this.timeoutId);
276280
}

0 commit comments

Comments
 (0)