@@ -31,7 +31,6 @@ describe('IgxSnackbar', () => {
31
31
32
32
it ( 'should properly initialize properties' , ( ) => {
33
33
expect ( snackbar . id ) . toContain ( 'igx-snackbar-' ) ;
34
- expect ( snackbar . message ) . toBeUndefined ( ) ;
35
34
expect ( snackbar . actionText ) . toBeUndefined ( ) ;
36
35
expect ( snackbar . displayTime ) . toBe ( 4000 ) ;
37
36
expect ( snackbar . autoHide ) . toBeTruthy ( ) ;
@@ -115,8 +114,7 @@ describe('IgxSnackbar with custom content', () => {
115
114
116
115
it ( 'should display a message, a custom content element and a button' , ( ) => {
117
116
fixture . componentInstance . text = 'Undo' ;
118
- snackbar . message = 'Item shown' ;
119
- snackbar . isVisible = true ;
117
+ snackbar . show ( 'Item shown' ) ;
120
118
fixture . detectChanges ( ) ;
121
119
122
120
const messageEl = fixture . debugElement . query ( By . css ( '.igx-snackbar__message' ) ) ;
@@ -136,6 +134,25 @@ describe('IgxSnackbar with custom content', () => {
136
134
expect ( customContentRect . right <= buttonRect . left ) . toBe ( true , 'The custom element is not on the left of the button' ) ;
137
135
expect ( messageElRect . right <= buttonRect . left ) . toBe ( true , 'The button is not on the right side of the snackbar content' ) ;
138
136
} ) ;
137
+
138
+ it ( 'should be able to set a message though show method' , ( ) => {
139
+ snackbar . autoHide = false ;
140
+ fixture . componentInstance . text = 'Retry' ;
141
+ fixture . detectChanges ( ) ;
142
+
143
+ snackbar . show ( 'The message was not send. Would you like to retry?' ) ;
144
+ fixture . detectChanges ( ) ;
145
+
146
+ expect ( fixture . nativeElement . querySelector ( '.igx-snackbar__message' ) . innerText )
147
+ . toBe ( 'The message was not send. Would you like to retry? Custom content' ) ;
148
+
149
+ snackbar . show ( 'Another Message?!' ) ;
150
+ fixture . detectChanges ( ) ;
151
+
152
+ expect ( snackbar . isVisible ) . toBe ( true ) ;
153
+ expect ( fixture . nativeElement . querySelector ( '.igx-snackbar__message' ) . innerText )
154
+ . toBe ( 'Another Message?! Custom content' ) ;
155
+ } ) ;
139
156
} ) ;
140
157
141
158
@Component ( {
0 commit comments