@@ -344,6 +344,37 @@ describe('MdAutocomplete', () => {
344
344
} ) ;
345
345
} ) ) ;
346
346
347
+ it ( 'should toggle the visibility when typing and closing the panel' , fakeAsync ( ( ) => {
348
+ fixture . componentInstance . trigger . openPanel ( ) ;
349
+ tick ( ) ;
350
+ fixture . detectChanges ( ) ;
351
+
352
+ expect ( overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ! . classList )
353
+ . toContain ( 'mat-autocomplete-visible' , 'Expected panel to be visible.' ) ;
354
+
355
+ typeInElement ( 'x' , input ) ;
356
+ fixture . detectChanges ( ) ;
357
+ tick ( ) ;
358
+ fixture . detectChanges ( ) ;
359
+
360
+ expect ( overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ! . classList )
361
+ . toContain ( 'mat-autocomplete-hidden' , 'Expected panel to be hidden.' ) ;
362
+
363
+ fixture . componentInstance . trigger . closePanel ( ) ;
364
+ fixture . detectChanges ( ) ;
365
+
366
+ fixture . componentInstance . trigger . openPanel ( ) ;
367
+ fixture . detectChanges ( ) ;
368
+
369
+ typeInElement ( 'al' , input ) ;
370
+ fixture . detectChanges ( ) ;
371
+ tick ( ) ;
372
+ fixture . detectChanges ( ) ;
373
+
374
+ expect ( overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ! . classList )
375
+ . toContain ( 'mat-autocomplete-visible' , 'Expected panel to be visible.' ) ;
376
+ } ) ) ;
377
+
347
378
} ) ;
348
379
349
380
it ( 'should have the correct text direction in RTL' , ( ) => {
0 commit comments