@@ -102,11 +102,11 @@ describe('MatAutocomplete', () => {
102
102
let fixture : ComponentFixture < SimpleAutocomplete > ;
103
103
let input : HTMLInputElement ;
104
104
105
- beforeEach ( fakeAsync ( ( ) => {
105
+ beforeEach ( ( ) => {
106
106
fixture = createComponent ( SimpleAutocomplete ) ;
107
107
fixture . detectChanges ( ) ;
108
108
input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
109
- } ) ) ;
109
+ } ) ;
110
110
111
111
it ( 'should open the panel when the input is focused' , ( ) => {
112
112
expect ( fixture . componentInstance . trigger . panelOpen )
@@ -412,7 +412,7 @@ describe('MatAutocomplete', () => {
412
412
} ) ) ;
413
413
} ) ;
414
414
415
- it ( 'should have the correct text direction in RTL' , fakeAsync ( ( ) => {
415
+ it ( 'should have the correct text direction in RTL' , ( ) => {
416
416
const rtlFixture = createComponent ( SimpleAutocomplete , [
417
417
{ provide : Directionality , useFactory : ( ) => ( { value : 'rtl' } ) } ,
418
418
] ) ;
@@ -424,18 +424,18 @@ describe('MatAutocomplete', () => {
424
424
const overlayPane = overlayContainerElement . querySelector ( '.cdk-overlay-pane' ) ! ;
425
425
expect ( overlayPane . getAttribute ( 'dir' ) ) . toEqual ( 'rtl' ) ;
426
426
427
- } ) ) ;
427
+ } ) ;
428
428
429
429
describe ( 'forms integration' , ( ) => {
430
430
let fixture : ComponentFixture < SimpleAutocomplete > ;
431
431
let input : HTMLInputElement ;
432
432
433
- beforeEach ( fakeAsync ( ( ) => {
433
+ beforeEach ( ( ) => {
434
434
fixture = createComponent ( SimpleAutocomplete ) ;
435
435
fixture . detectChanges ( ) ;
436
436
437
437
input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
438
- } ) ) ;
438
+ } ) ;
439
439
440
440
it ( 'should update control value as user types with input value' , ( ) => {
441
441
fixture . componentInstance . trigger . openPanel ( ) ;
@@ -616,23 +616,22 @@ describe('MatAutocomplete', () => {
616
616
. toBe ( true , `Expected control to become touched on blur.` ) ;
617
617
} ) ;
618
618
619
- it ( 'should disable the input when used with a value accessor and without `matInput`' ,
620
- fakeAsync ( ( ) => {
621
- overlayContainer . ngOnDestroy ( ) ;
622
- fixture . destroy ( ) ;
623
- TestBed . resetTestingModule ( ) ;
619
+ it ( 'should disable the input when used with a value accessor and without `matInput`' , ( ) => {
620
+ overlayContainer . ngOnDestroy ( ) ;
621
+ fixture . destroy ( ) ;
622
+ TestBed . resetTestingModule ( ) ;
624
623
625
- const plainFixture = createComponent ( PlainAutocompleteInputWithFormControl ) ;
626
- plainFixture . detectChanges ( ) ;
627
- input = plainFixture . nativeElement . querySelector ( 'input' ) ;
624
+ const plainFixture = createComponent ( PlainAutocompleteInputWithFormControl ) ;
625
+ plainFixture . detectChanges ( ) ;
626
+ input = plainFixture . nativeElement . querySelector ( 'input' ) ;
628
627
629
- expect ( input . disabled ) . toBe ( false ) ;
628
+ expect ( input . disabled ) . toBe ( false ) ;
630
629
631
- plainFixture . componentInstance . formControl . disable ( ) ;
632
- plainFixture . detectChanges ( ) ;
630
+ plainFixture . componentInstance . formControl . disable ( ) ;
631
+ plainFixture . detectChanges ( ) ;
633
632
634
- expect ( input . disabled ) . toBe ( true ) ;
635
- } ) ) ;
633
+ expect ( input . disabled ) . toBe ( true ) ;
634
+ } ) ;
636
635
637
636
} ) ;
638
637
@@ -1116,12 +1115,12 @@ describe('MatAutocomplete', () => {
1116
1115
let fixture : ComponentFixture < SimpleAutocomplete > ;
1117
1116
let input : HTMLInputElement ;
1118
1117
1119
- beforeEach ( fakeAsync ( ( ) => {
1118
+ beforeEach ( ( ) => {
1120
1119
fixture = createComponent ( SimpleAutocomplete ) ;
1121
1120
fixture . detectChanges ( ) ;
1122
1121
1123
1122
input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
1124
- } ) ) ;
1123
+ } ) ;
1125
1124
1126
1125
it ( 'should set role of input to combobox' , ( ) => {
1127
1126
expect ( input . getAttribute ( 'role' ) )
@@ -1233,13 +1232,13 @@ describe('MatAutocomplete', () => {
1233
1232
let input : HTMLInputElement ;
1234
1233
let inputReference : HTMLInputElement ;
1235
1234
1236
- beforeEach ( fakeAsync ( ( ) => {
1235
+ beforeEach ( ( ) => {
1237
1236
fixture = createComponent ( SimpleAutocomplete ) ;
1238
1237
fixture . detectChanges ( ) ;
1239
1238
1240
1239
input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
1241
1240
inputReference = fixture . debugElement . query ( By . css ( '.mat-input-flex' ) ) . nativeElement ;
1242
- } ) ) ;
1241
+ } ) ;
1243
1242
1244
1243
it ( 'should use below positioning by default' , fakeAsync ( ( ) => {
1245
1244
fixture . componentInstance . trigger . openPanel ( ) ;
@@ -1320,10 +1319,10 @@ describe('MatAutocomplete', () => {
1320
1319
describe ( 'Option selection' , ( ) => {
1321
1320
let fixture : ComponentFixture < SimpleAutocomplete > ;
1322
1321
1323
- beforeEach ( fakeAsync ( ( ) => {
1322
+ beforeEach ( ( ) => {
1324
1323
fixture = createComponent ( SimpleAutocomplete ) ;
1325
1324
fixture . detectChanges ( ) ;
1326
- } ) ) ;
1325
+ } ) ;
1327
1326
1328
1327
it ( 'should deselect any other selected option' , fakeAsync ( ( ) => {
1329
1328
fixture . componentInstance . trigger . openPanel ( ) ;
@@ -1513,10 +1512,10 @@ describe('MatAutocomplete', () => {
1513
1512
describe ( 'without matInput' , ( ) => {
1514
1513
let fixture : ComponentFixture < AutocompleteWithNativeInput > ;
1515
1514
1516
- beforeEach ( fakeAsync ( ( ) => {
1515
+ beforeEach ( ( ) => {
1517
1516
fixture = createComponent ( AutocompleteWithNativeInput ) ;
1518
1517
fixture . detectChanges ( ) ;
1519
- } ) ) ;
1518
+ } ) ;
1520
1519
1521
1520
it ( 'should not throw when clicking outside' , fakeAsync ( ( ) => {
1522
1521
dispatchFakeEvent ( fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement , 'focus' ) ;
@@ -1529,28 +1528,27 @@ describe('MatAutocomplete', () => {
1529
1528
1530
1529
describe ( 'misc' , ( ) => {
1531
1530
1532
- it ( 'should allow basic use without any forms directives' , fakeAsync ( ( ) => {
1531
+ it ( 'should allow basic use without any forms directives' , ( ) => {
1533
1532
expect ( ( ) => {
1534
1533
const fixture = createComponent ( AutocompleteWithoutForms ) ;
1535
1534
fixture . detectChanges ( ) ;
1536
1535
1537
1536
const input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
1538
1537
typeInElement ( 'd' , input ) ;
1539
1538
fixture . detectChanges ( ) ;
1540
- tick ( ) ;
1541
1539
1542
1540
const options =
1543
1541
overlayContainerElement . querySelectorAll ( 'mat-option' ) as NodeListOf < HTMLElement > ;
1544
1542
expect ( options . length ) . toBe ( 1 ) ;
1545
1543
} ) . not . toThrowError ( ) ;
1546
- } ) ) ;
1544
+ } ) ;
1547
1545
1548
- it ( 'should display an empty input when the value is undefined with ngModel' , fakeAsync ( ( ) => {
1546
+ it ( 'should display an empty input when the value is undefined with ngModel' , ( ) => {
1549
1547
const fixture = createComponent ( AutocompleteWithNgModel ) ;
1550
1548
fixture . detectChanges ( ) ;
1551
1549
1552
1550
expect ( fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement . value ) . toBe ( '' ) ;
1553
- } ) ) ;
1551
+ } ) ;
1554
1552
1555
1553
it ( 'should display the number when the selected option is the number zero' , fakeAsync ( ( ) => {
1556
1554
const fixture = createComponent ( AutocompleteWithNumbers ) ;
@@ -1562,7 +1560,7 @@ describe('MatAutocomplete', () => {
1562
1560
expect ( fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement . value ) . toBe ( '0' ) ;
1563
1561
} ) ) ;
1564
1562
1565
- it ( 'should work when input is wrapped in ngIf' , fakeAsync ( ( ) => {
1563
+ it ( 'should work when input is wrapped in ngIf' , ( ) => {
1566
1564
const fixture = createComponent ( NgIfAutocomplete ) ;
1567
1565
fixture . detectChanges ( ) ;
1568
1566
@@ -1575,9 +1573,9 @@ describe('MatAutocomplete', () => {
1575
1573
. toContain ( 'One' , `Expected panel to display when input is focused.` ) ;
1576
1574
expect ( overlayContainerElement . textContent )
1577
1575
. toContain ( 'Two' , `Expected panel to display when input is focused.` ) ;
1578
- } ) ) ;
1576
+ } ) ;
1579
1577
1580
- it ( 'should filter properly with ngIf after setting the active item' , fakeAsync ( ( ) => {
1578
+ it ( 'should filter properly with ngIf after setting the active item' , ( ) => {
1581
1579
const fixture = createComponent ( NgIfAutocomplete ) ;
1582
1580
fixture . detectChanges ( ) ;
1583
1581
@@ -1591,19 +1589,18 @@ describe('MatAutocomplete', () => {
1591
1589
const input = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
1592
1590
typeInElement ( 'o' , input ) ;
1593
1591
fixture . detectChanges ( ) ;
1594
- tick ( ) ;
1595
1592
1596
1593
expect ( fixture . componentInstance . matOptions . length ) . toBe ( 2 ) ;
1597
- } ) ) ;
1594
+ } ) ;
1598
1595
1599
- it ( 'should throw if the user attempts to open the panel too early' , fakeAsync ( ( ) => {
1596
+ it ( 'should throw if the user attempts to open the panel too early' , ( ) => {
1600
1597
const fixture = createComponent ( AutocompleteWithoutPanel ) ;
1601
1598
fixture . detectChanges ( ) ;
1602
1599
1603
1600
expect ( ( ) => {
1604
1601
fixture . componentInstance . trigger . openPanel ( ) ;
1605
1602
} ) . toThrow ( getMatAutocompleteMissingPanelError ( ) ) ;
1606
- } ) ) ;
1603
+ } ) ;
1607
1604
1608
1605
it ( 'should not throw on init, even if the panel is not defined' , fakeAsync ( ( ) => {
1609
1606
expect ( ( ) => {
@@ -1682,7 +1679,7 @@ describe('MatAutocomplete', () => {
1682
1679
1683
1680
} ) ;
1684
1681
1685
- it ( 'should have correct width when opened' , fakeAsync ( ( ) => {
1682
+ it ( 'should have correct width when opened' , ( ) => {
1686
1683
const widthFixture = createComponent ( SimpleAutocomplete ) ;
1687
1684
widthFixture . componentInstance . width = 300 ;
1688
1685
widthFixture . detectChanges ( ) ;
@@ -1705,9 +1702,9 @@ describe('MatAutocomplete', () => {
1705
1702
1706
1703
// Firefox, edge return a decimal value for width, so we need to parse and round it to verify
1707
1704
expect ( Math . ceil ( parseFloat ( overlayPane . style . width as string ) ) ) . toBe ( 500 ) ;
1708
- } ) ) ;
1705
+ } ) ;
1709
1706
1710
- it ( 'should update the width while the panel is open' , fakeAsync ( ( ) => {
1707
+ it ( 'should update the width while the panel is open' , ( ) => {
1711
1708
const widthFixture = createComponent ( SimpleAutocomplete ) ;
1712
1709
1713
1710
widthFixture . componentInstance . width = 300 ;
@@ -1729,7 +1726,7 @@ describe('MatAutocomplete', () => {
1729
1726
widthFixture . detectChanges ( ) ;
1730
1727
1731
1728
expect ( Math . ceil ( parseFloat ( overlayPane . style . width as string ) ) ) . toBe ( 500 ) ;
1732
- } ) ) ;
1729
+ } ) ;
1733
1730
1734
1731
it ( 'should show the panel when the options are initialized later within a component with ' +
1735
1732
'OnPush change detection' , fakeAsync ( ( ) => {
0 commit comments