@@ -180,6 +180,7 @@ describe('MDC-based MatAutocomplete', () => {
180
180
fixture . detectChanges ( ) ;
181
181
zone . simulateZoneExit ( ) ;
182
182
dispatchFakeEvent ( document , 'click' ) ;
183
+ tick ( ) ;
183
184
184
185
expect ( fixture . componentInstance . trigger . panelOpen )
185
186
. toBe ( false , `Expected clicking outside the panel to set its state to closed.` ) ;
@@ -219,6 +220,7 @@ describe('MDC-based MatAutocomplete', () => {
219
220
const option = overlayContainerElement . querySelector ( 'mat-option' ) as HTMLElement ;
220
221
option . click ( ) ;
221
222
fixture . detectChanges ( ) ;
223
+ tick ( ) ;
222
224
223
225
expect ( fixture . componentInstance . trigger . panelOpen )
224
226
. toBe ( false , `Expected clicking an option to set the panel state to closed.` ) ;
@@ -251,25 +253,27 @@ describe('MDC-based MatAutocomplete', () => {
251
253
options = overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
252
254
options [ 1 ] . click ( ) ;
253
255
fixture . detectChanges ( ) ;
256
+ tick ( ) ;
254
257
255
258
expect ( fixture . componentInstance . trigger . panelOpen )
256
259
. toBe ( false , `Expected clicking a new option to set the panel state to closed.` ) ;
257
260
expect ( overlayContainerElement . textContent )
258
261
. toEqual ( '' , `Expected clicking a new option to close the panel.` ) ;
259
262
} ) ) ;
260
263
261
- it ( 'should close the panel programmatically' , ( ) => {
264
+ it ( 'should close the panel programmatically' , fakeAsync ( ( ) => {
262
265
fixture . componentInstance . trigger . openPanel ( ) ;
263
266
fixture . detectChanges ( ) ;
264
267
265
268
fixture . componentInstance . trigger . closePanel ( ) ;
266
269
fixture . detectChanges ( ) ;
270
+ tick ( ) ;
267
271
268
272
expect ( fixture . componentInstance . trigger . panelOpen )
269
273
. toBe ( false , `Expected closing programmatically to set the panel state to closed.` ) ;
270
274
expect ( overlayContainerElement . textContent )
271
275
. toEqual ( '' , `Expected closing programmatically to close the panel.` ) ;
272
- } ) ;
276
+ } ) ) ;
273
277
274
278
it ( 'should not throw when attempting to close the panel of a destroyed autocomplete' , ( ) => {
275
279
const trigger = fixture . componentInstance . trigger ;
@@ -1032,6 +1036,7 @@ describe('MDC-based MatAutocomplete', () => {
1032
1036
flush ( ) ;
1033
1037
fixture . componentInstance . trigger . _handleKeydown ( ENTER_EVENT ) ;
1034
1038
fixture . detectChanges ( ) ;
1039
+ tick ( ) ;
1035
1040
1036
1041
expect ( fixture . componentInstance . trigger . panelOpen )
1037
1042
. toBe ( false , `Expected panel state to read closed after ENTER key.` ) ;
@@ -1248,6 +1253,7 @@ describe('MDC-based MatAutocomplete', () => {
1248
1253
1249
1254
dispatchKeyboardEvent ( input , 'keydown' , TAB ) ;
1250
1255
fixture . detectChanges ( ) ;
1256
+ tick ( ) ;
1251
1257
1252
1258
expect ( overlayContainerElement . querySelector ( '.mat-mdc-autocomplete-panel' ) )
1253
1259
. toBeFalsy ( 'Expected panel to be removed.' ) ;
0 commit comments