@@ -50,20 +50,20 @@ describe('IgxToast', () => {
5050
5151 it ( 'should auto hide after it\'s open' , fakeAsync ( ( ) => {
5252 spyOn ( toast . onClosing , 'emit' ) ;
53- toast . displayTime = 1000 ;
53+ toast . displayTime = 100 ;
5454
5555 toast . open ( ) ;
56- tick ( 1000 ) ;
56+ tick ( 100 ) ;
5757 expect ( toast . onClosing . emit ) . toHaveBeenCalled ( ) ;
5858 } ) ) ;
5959
6060 it ( 'should not auto hide after it\'s open' , fakeAsync ( ( ) => {
6161 spyOn ( toast . onClosing , 'emit' ) ;
62- toast . displayTime = 1000 ;
62+ toast . displayTime = 100 ;
6363 toast . autoHide = false ;
6464
6565 toast . open ( ) ;
66- tick ( 1000 ) ;
66+ tick ( 100 ) ;
6767 expect ( toast . onClosing . emit ) . not . toHaveBeenCalled ( ) ;
6868 } ) ) ;
6969
@@ -81,36 +81,49 @@ describe('IgxToast', () => {
8181 } ) ;
8282
8383 it ( 'should emit onOpened when toast is opened' , fakeAsync ( ( ) => {
84+ toast . displayTime = 100 ;
85+ toast . autoHide = false ;
8486 spyOn ( toast . onOpened , 'emit' ) ;
8587 toast . open ( ) ;
86- tick ( 4000 ) ;
88+ tick ( 100 ) ;
8789 expect ( toast . onOpened . emit ) . toHaveBeenCalled ( ) ;
8890 } ) ) ;
8991
9092 it ( 'should emit onClosed when toast is closed' , fakeAsync ( ( ) => {
93+ toast . displayTime = 100 ;
94+ toast . autoHide = false ;
9195 spyOn ( toast . onClosed , 'emit' ) ;
9296 toast . open ( ) ;
9397 toast . close ( ) ;
94- tick ( 4000 ) ;
98+ tick ( 100 ) ;
9599 expect ( toast . onClosed . emit ) . toHaveBeenCalled ( ) ;
96100 } ) ) ;
97101
98102 it ( 'visibility is updated by the toggle() method and isVisible setter' , fakeAsync ( ( ) => {
103+ toast . displayTime = 100 ;
104+ toast . autoHide = false ;
105+
99106 expect ( toast . isVisible ) . toBeFalse ( ) ;
100107 toast . toggle ( ) ;
101108 expect ( toast . isVisible ) . toBeTrue ( ) ;
102109 toast . isVisible = false ;
103- expect ( toast . collapsed ) . toBeFalse ( ) ;
104- toast . isVisible = true ;
105110 // Opening happens in a RAF
106- tick ( 4000 ) ;
111+ tick ( 100 ) ;
107112 expect ( toast . collapsed ) . toBeTrue ( ) ;
113+ toast . isVisible = true ;
114+ // Opening happens in a RAF
115+ tick ( 100 ) ;
116+ expect ( toast . collapsed ) . toBeFalse ( ) ;
108117 } ) ) ;
109118
110119 it ( 'can set message through show method' , fakeAsync ( ( ) => {
111120 toast . displayTime = 100 ;
112121 toast . autoHide = false ;
113122
123+ toast . message = 'Message' ;
124+ expect ( toast . toastMessage ) . toBe ( 'Message' ) ;
125+ expect ( toast . message ) . toBe ( 'Message' ) ;
126+
114127 toast . open ( 'Custom Message' ) ;
115128 tick ( 100 ) ;
116129 fixture . detectChanges ( ) ;
0 commit comments