File tree 2 files changed +13
-9
lines changed 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -763,17 +763,19 @@ describe('MdAutocomplete', () => {
763
763
. toEqual ( 32 , `Expected panel to reveal the sixth option.` ) ;
764
764
} ) ) ;
765
765
766
- it ( 'should scroll to active options on UP arrow' , fakeAsync ( ( ) => {
767
- tick ( ) ;
768
- const scrollContainer =
769
- document . querySelector ( '.cdk-overlay-pane .mat-autocomplete-panel' ) ! ;
766
+ it ( 'should scroll to active options on UP arrow' , async ( ( ) => {
767
+ fixture . whenStable ( ) . then ( ( ) => {
768
+ const scrollContainer =
769
+ document . querySelector ( '.cdk-overlay-pane .mat-autocomplete-panel' ) ! ;
770
770
771
- fixture . componentInstance . trigger . _handleKeydown ( UP_ARROW_EVENT ) ;
772
- tick ( ) ;
773
- fixture . detectChanges ( ) ;
771
+ fixture . componentInstance . trigger . _handleKeydown ( UP_ARROW_EVENT ) ;
772
+ fixture . detectChanges ( ) ;
774
773
775
- // Expect option bottom minus the panel height (528 - 256 = 272)
776
- expect ( scrollContainer . scrollTop ) . toEqual ( 272 , `Expected panel to reveal last option.` ) ;
774
+ fixture . whenStable ( ) . then ( ( ) => {
775
+ // Expect option bottom minus the panel height (528 - 256 = 272)
776
+ expect ( scrollContainer . scrollTop ) . toEqual ( 272 , `Expected panel to reveal last option.` ) ;
777
+ } ) ;
778
+ } ) ;
777
779
} ) ) ;
778
780
779
781
it ( 'should not scroll to active options that are fully in the panel' , fakeAsync ( ( ) => {
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
ViewChild ,
18
18
ViewEncapsulation ,
19
19
ChangeDetectorRef ,
20
+ ChangeDetectionStrategy ,
20
21
} from '@angular/core' ;
21
22
import { MdOption } from '../core' ;
22
23
import { ActiveDescendantKeyManager } from '../core/a11y/activedescendant-key-manager' ;
@@ -35,6 +36,7 @@ export type AutocompletePositionY = 'above' | 'below';
35
36
templateUrl : 'autocomplete.html' ,
36
37
styleUrls : [ 'autocomplete.css' ] ,
37
38
encapsulation : ViewEncapsulation . None ,
39
+ changeDetection : ChangeDetectionStrategy . OnPush ,
38
40
exportAs : 'mdAutocomplete' ,
39
41
host : {
40
42
'class' : 'mat-autocomplete'
You can’t perform that action at this time.
0 commit comments