@@ -1653,9 +1653,9 @@ describe('MatAutocomplete', () => {
16531653
16541654 describe ( 'Fallback positions' , ( ) => {
16551655 it ( 'should use below positioning by default' , fakeAsync ( ( ) => {
1656- let fixture = createComponent ( SimpleAutocomplete ) ;
1656+ const fixture = createComponent ( SimpleAutocomplete ) ;
16571657 fixture . detectChanges ( ) ;
1658- let inputReference =
1658+ const inputReference =
16591659 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
16601660
16611661 fixture . componentInstance . trigger . openPanel ( ) ;
@@ -1673,16 +1673,16 @@ describe('MatAutocomplete', () => {
16731673 } ) ) ;
16741674
16751675 it ( 'should reposition the panel on scroll' , ( ) => {
1676- let scrolledSubject = new Subject ( ) ;
1677- let spacer = document . createElement ( 'div' ) ;
1678- let fixture = createComponent ( SimpleAutocomplete , [ {
1676+ const scrolledSubject = new Subject ( ) ;
1677+ const spacer = document . createElement ( 'div' ) ;
1678+ const fixture = createComponent ( SimpleAutocomplete , [ {
16791679 provide : ScrollDispatcher ,
16801680 useValue : { scrolled : ( ) => scrolledSubject }
16811681 } ] ) ;
16821682
16831683 fixture . detectChanges ( ) ;
16841684
1685- let inputReference =
1685+ const inputReference =
16861686 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
16871687 spacer . style . height = '1000px' ;
16881688 document . body . appendChild ( spacer ) ;
@@ -1706,9 +1706,9 @@ describe('MatAutocomplete', () => {
17061706 } ) ;
17071707
17081708 it ( 'should fall back to above position if panel cannot fit below' , fakeAsync ( ( ) => {
1709- let fixture = createComponent ( SimpleAutocomplete ) ;
1709+ const fixture = createComponent ( SimpleAutocomplete ) ;
17101710 fixture . detectChanges ( ) ;
1711- let inputReference =
1711+ const inputReference =
17121712 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
17131713
17141714 // Push the autocomplete trigger down so it won't have room to open "below"
@@ -1731,11 +1731,11 @@ describe('MatAutocomplete', () => {
17311731 } ) ) ;
17321732
17331733 it ( 'should allow the panel to expand when the number of results increases' , fakeAsync ( ( ) => {
1734- let fixture = createComponent ( SimpleAutocomplete ) ;
1734+ const fixture = createComponent ( SimpleAutocomplete ) ;
17351735 fixture . detectChanges ( ) ;
17361736
1737- let inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1738- let inputReference =
1737+ const inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1738+ const inputReference =
17391739 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
17401740
17411741 // Push the element down so it has a little bit of space, but not enough to render.
@@ -1752,7 +1752,7 @@ describe('MatAutocomplete', () => {
17521752 zone . simulateZoneExit ( ) ;
17531753
17541754 let panel = overlayContainerElement . querySelector ( '.cdk-overlay-pane' ) ! ;
1755- let initialPanelHeight = panel . getBoundingClientRect ( ) . height ;
1755+ const initialPanelHeight = panel . getBoundingClientRect ( ) . height ;
17561756
17571757 fixture . componentInstance . trigger . closePanel ( ) ;
17581758 fixture . detectChanges ( ) ;
@@ -1773,11 +1773,11 @@ describe('MatAutocomplete', () => {
17731773 } ) ) ;
17741774
17751775 it ( 'should align panel properly when filtering in "above" position' , fakeAsync ( ( ) => {
1776- let fixture = createComponent ( SimpleAutocomplete ) ;
1776+ const fixture = createComponent ( SimpleAutocomplete ) ;
17771777 fixture . detectChanges ( ) ;
17781778
1779- let input = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1780- let inputReference =
1779+ const input = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1780+ const inputReference =
17811781 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
17821782
17831783 // Push the autocomplete trigger down so it won't have room to open "below"
@@ -1802,13 +1802,13 @@ describe('MatAutocomplete', () => {
18021802
18031803 it ( 'should fall back to above position when requested if options are added while ' +
18041804 'the panel is open' , fakeAsync ( ( ) => {
1805- let fixture = createComponent ( SimpleAutocomplete ) ;
1805+ const fixture = createComponent ( SimpleAutocomplete ) ;
18061806 fixture . componentInstance . states = fixture . componentInstance . states . slice ( 0 , 1 ) ;
18071807 fixture . componentInstance . filteredStates = fixture . componentInstance . states . slice ( ) ;
18081808 fixture . detectChanges ( ) ;
18091809
1810- let inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1811- let inputReference =
1810+ const inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement ;
1811+ const inputReference =
18121812 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
18131813
18141814 // Push the element down so it has a little bit of space, but not enough to render.
@@ -1820,7 +1820,7 @@ describe('MatAutocomplete', () => {
18201820 zone . simulateZoneExit ( ) ;
18211821 fixture . detectChanges ( ) ;
18221822
1823- let panel = overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ! ;
1823+ const panel = overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ! ;
18241824 let inputRect = inputReference . getBoundingClientRect ( ) ;
18251825 let panelRect = panel . getBoundingClientRect ( ) ;
18261826
@@ -1846,17 +1846,17 @@ describe('MatAutocomplete', () => {
18461846 } ) ) ;
18471847
18481848 it ( 'should not throw if a panel reposition is requested while the panel is closed' , ( ) => {
1849- let fixture = createComponent ( SimpleAutocomplete ) ;
1849+ const fixture = createComponent ( SimpleAutocomplete ) ;
18501850 fixture . detectChanges ( ) ;
18511851
18521852 expect ( ( ) => fixture . componentInstance . trigger . updatePosition ( ) ) . not . toThrow ( ) ;
18531853 } ) ;
18541854
18551855 it ( 'should be able to force below position even if there is not enough space' , fakeAsync ( ( ) => {
1856- let fixture = createComponent ( SimpleAutocomplete ) ;
1856+ const fixture = createComponent ( SimpleAutocomplete ) ;
18571857 fixture . componentInstance . position = 'below' ;
18581858 fixture . detectChanges ( ) ;
1859- let inputReference =
1859+ const inputReference =
18601860 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
18611861
18621862 // Push the autocomplete trigger down so it won't have room to open below.
@@ -1879,10 +1879,10 @@ describe('MatAutocomplete', () => {
18791879 } ) ) ;
18801880
18811881 it ( 'should be able to force above position even if there is not enough space' , fakeAsync ( ( ) => {
1882- let fixture = createComponent ( SimpleAutocomplete ) ;
1882+ const fixture = createComponent ( SimpleAutocomplete ) ;
18831883 fixture . componentInstance . position = 'above' ;
18841884 fixture . detectChanges ( ) ;
1885- let inputReference =
1885+ const inputReference =
18861886 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
18871887
18881888 // Push the autocomplete trigger up so it won't have room to open above.
@@ -1905,11 +1905,11 @@ describe('MatAutocomplete', () => {
19051905 } ) ) ;
19061906
19071907 it ( 'should handle the position being changed after the first open' , fakeAsync ( ( ) => {
1908- let fixture = createComponent ( SimpleAutocomplete ) ;
1908+ const fixture = createComponent ( SimpleAutocomplete ) ;
19091909 fixture . detectChanges ( ) ;
1910- let inputReference =
1910+ const inputReference =
19111911 fixture . debugElement . query ( By . css ( '.mat-form-field-flex' ) ) ! . nativeElement ;
1912- let openPanel = ( ) => {
1912+ const openPanel = ( ) => {
19131913 fixture . componentInstance . trigger . openPanel ( ) ;
19141914 fixture . detectChanges ( ) ;
19151915 zone . simulateZoneExit ( ) ;
@@ -1966,7 +1966,7 @@ describe('MatAutocomplete', () => {
19661966 zone . simulateZoneExit ( ) ;
19671967 fixture . detectChanges ( ) ;
19681968
1969- let componentOptions = fixture . componentInstance . options . toArray ( ) ;
1969+ const componentOptions = fixture . componentInstance . options . toArray ( ) ;
19701970 expect ( componentOptions [ 0 ] . selected )
19711971 . toBe ( true , `Clicked option should be selected.` ) ;
19721972
@@ -1992,7 +1992,7 @@ describe('MatAutocomplete', () => {
19921992 zone . simulateZoneExit ( ) ;
19931993 fixture . detectChanges ( ) ;
19941994
1995- let componentOptions = fixture . componentInstance . options . toArray ( ) ;
1995+ const componentOptions = fixture . componentInstance . options . toArray ( ) ;
19961996 componentOptions . forEach ( option => spyOn ( option , 'deselect' ) ) ;
19971997
19981998 expect ( componentOptions [ 0 ] . selected )
@@ -2079,7 +2079,7 @@ describe('MatAutocomplete', () => {
20792079 fixture . destroy ( ) ;
20802080 fixture = TestBed . createComponent ( SimpleAutocomplete ) ;
20812081
2082- let spy = jasmine . createSpy ( 'option selection spy' ) ;
2082+ const spy = jasmine . createSpy ( 'option selection spy' ) ;
20832083 let subscription : Subscription ;
20842084
20852085 expect ( fixture . componentInstance . trigger . autocomplete ) . toBeFalsy ( ) ;
@@ -2103,9 +2103,9 @@ describe('MatAutocomplete', () => {
21032103 } ) ) ;
21042104
21052105 it ( 'should reposition the panel when the amount of options changes' , fakeAsync ( ( ) => {
2106- let formField = fixture . debugElement . query ( By . css ( '.mat-form-field' ) ) ! . nativeElement ;
2107- let inputReference = formField . querySelector ( '.mat-form-field-flex' ) ;
2108- let input = inputReference . querySelector ( 'input' ) ;
2106+ const formField = fixture . debugElement . query ( By . css ( '.mat-form-field' ) ) ! . nativeElement ;
2107+ const inputReference = formField . querySelector ( '.mat-form-field-flex' ) ;
2108+ const input = inputReference . querySelector ( 'input' ) ;
21092109
21102110 formField . style . bottom = '100px' ;
21112111 formField . style . position = 'fixed' ;
@@ -2607,7 +2607,7 @@ describe('MatAutocomplete', () => {
26072607
26082608 it ( 'should show the panel when the options are initialized later within a component with ' +
26092609 'OnPush change detection' , fakeAsync ( ( ) => {
2610- let fixture = createComponent ( AutocompleteWithOnPushDelay ) ;
2610+ const fixture = createComponent ( AutocompleteWithOnPushDelay ) ;
26112611
26122612 fixture . detectChanges ( ) ;
26132613 dispatchFakeEvent ( fixture . debugElement . query ( By . css ( 'input' ) ) ! . nativeElement , 'focusin' ) ;
@@ -2617,39 +2617,41 @@ describe('MatAutocomplete', () => {
26172617 tick ( ) ;
26182618
26192619 Promise . resolve ( ) . then ( ( ) => {
2620- let panel = overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) as HTMLElement ;
2621- let visibleClass = 'mat-autocomplete-visible' ;
2620+ const panel =
2621+ overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) as HTMLElement ;
2622+ const visibleClass = 'mat-autocomplete-visible' ;
26222623
26232624 fixture . detectChanges ( ) ;
26242625 expect ( panel . classList ) . toContain ( visibleClass , `Expected panel to be visible.` ) ;
26252626 } ) ;
26262627 } ) ) ;
26272628
26282629 it ( 'should emit an event when an option is selected' , fakeAsync ( ( ) => {
2629- let fixture = createComponent ( AutocompleteWithSelectEvent ) ;
2630+ const fixture = createComponent ( AutocompleteWithSelectEvent ) ;
26302631
26312632 fixture . detectChanges ( ) ;
26322633 fixture . componentInstance . trigger . openPanel ( ) ;
26332634 zone . simulateZoneExit ( ) ;
26342635 fixture . detectChanges ( ) ;
26352636
2636- let options = overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
2637- let spy = fixture . componentInstance . optionSelected ;
2637+ const options =
2638+ overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
2639+ const spy = fixture . componentInstance . optionSelected ;
26382640
26392641 options [ 1 ] . click ( ) ;
26402642 tick ( ) ;
26412643 fixture . detectChanges ( ) ;
26422644
26432645 expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
26442646
2645- let event = spy . calls . mostRecent ( ) . args [ 0 ] as MatAutocompleteSelectedEvent ;
2647+ const event = spy . calls . mostRecent ( ) . args [ 0 ] as MatAutocompleteSelectedEvent ;
26462648
26472649 expect ( event . source ) . toBe ( fixture . componentInstance . autocomplete ) ;
26482650 expect ( event . option . value ) . toBe ( 'Washington' ) ;
26492651 } ) ) ;
26502652
26512653 it ( 'should emit an event when a newly-added option is selected' , fakeAsync ( ( ) => {
2652- let fixture = createComponent ( AutocompleteWithSelectEvent ) ;
2654+ const fixture = createComponent ( AutocompleteWithSelectEvent ) ;
26532655
26542656 fixture . detectChanges ( ) ;
26552657 fixture . componentInstance . trigger . openPanel ( ) ;
@@ -2661,16 +2663,17 @@ describe('MatAutocomplete', () => {
26612663 tick ( ) ;
26622664 fixture . detectChanges ( ) ;
26632665
2664- let options = overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
2665- let spy = fixture . componentInstance . optionSelected ;
2666+ const options =
2667+ overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
2668+ const spy = fixture . componentInstance . optionSelected ;
26662669
26672670 options [ 3 ] . click ( ) ;
26682671 tick ( ) ;
26692672 fixture . detectChanges ( ) ;
26702673
26712674 expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
26722675
2673- let event = spy . calls . mostRecent ( ) . args [ 0 ] as MatAutocompleteSelectedEvent ;
2676+ const event = spy . calls . mostRecent ( ) . args [ 0 ] as MatAutocompleteSelectedEvent ;
26742677
26752678 expect ( event . source ) . toBe ( fixture . componentInstance . autocomplete ) ;
26762679 expect ( event . option . value ) . toBe ( 'Puerto Rico' ) ;
0 commit comments