@@ -2742,8 +2742,9 @@ describe('MatSelect', () => {
2742
2742
2743
2743
it ( 'should be able to programmatically select a falsy option' , fakeAsync ( ( ) => {
2744
2744
const fixture = TestBed . createComponent ( FalsyValueSelect ) ;
2745
-
2746
2745
fixture . detectChanges ( ) ;
2746
+ flush ( ) ;
2747
+
2747
2748
fixture . debugElement . query ( By . css ( '.mat-select-trigger' ) ) ! . nativeElement . click ( ) ;
2748
2749
fixture . componentInstance . control . setValue ( 0 ) ;
2749
2750
fixture . detectChanges ( ) ;
@@ -3374,6 +3375,8 @@ describe('MatSelect', () => {
3374
3375
3375
3376
let groupFixture = TestBed . createComponent ( SelectWithGroups ) ;
3376
3377
groupFixture . detectChanges ( ) ;
3378
+ flush ( ) ;
3379
+
3377
3380
trigger = groupFixture . debugElement . query ( By . css ( '.mat-select-trigger' ) ) ! . nativeElement ;
3378
3381
formField = groupFixture . debugElement . query ( By . css ( 'mat-form-field' ) ) ! . nativeElement ;
3379
3382
@@ -3423,6 +3426,7 @@ describe('MatSelect', () => {
3423
3426
// Select an option in the third group, which has a couple of group labels before it.
3424
3427
groupFixture . componentInstance . control . setValue ( 'vulpix-7' ) ;
3425
3428
groupFixture . detectChanges ( ) ;
3429
+ flush ( ) ;
3426
3430
3427
3431
trigger . click ( ) ;
3428
3432
groupFixture . detectChanges ( ) ;
@@ -4082,7 +4086,8 @@ describe('MatSelect', () => {
4082
4086
describe ( 'with multiple selection' , ( ) => {
4083
4087
beforeEach ( async ( ( ) => configureMatSelectTestingModule ( [
4084
4088
MultiSelect ,
4085
- MultiSelectWithLotsOfOptions
4089
+ MultiSelectWithLotsOfOptions ,
4090
+ MultiSelectWithLotsOfPreselectedOptions
4086
4091
] ) ) ) ;
4087
4092
4088
4093
let fixture : ComponentFixture < MultiSelect > ;
@@ -4471,6 +4476,16 @@ describe('MatSelect', () => {
4471
4476
4472
4477
expect ( ( ) => {
4473
4478
lotsOfOptionsFixture . componentInstance . checkAll ( ) ;
4479
+ flush ( ) ;
4480
+ } ) . not . toThrow ( ) ;
4481
+ } ) ) ;
4482
+
4483
+ it ( 'should not throw with a large amount of preselected options' , fakeAsync ( ( ) => {
4484
+ fixture . destroy ( ) ;
4485
+
4486
+ const lotsOfOptionsFixture = TestBed . createComponent ( MultiSelectWithLotsOfPreselectedOptions ) ;
4487
+
4488
+ expect ( ( ) => {
4474
4489
lotsOfOptionsFixture . detectChanges ( ) ;
4475
4490
flush ( ) ;
4476
4491
} ) . not . toThrow ( ) ;
@@ -5313,3 +5328,18 @@ class MultiSelectWithLotsOfOptions {
5313
5328
this . value = [ ] ;
5314
5329
}
5315
5330
}
5331
+
5332
+
5333
+ @Component ( {
5334
+ template : `
5335
+ <mat-form-field>
5336
+ <mat-select multiple [ngModel]="value">
5337
+ <mat-option *ngFor="let item of items" [value]="item">{{item}}</mat-option>
5338
+ </mat-select>
5339
+ </mat-form-field>
5340
+ `
5341
+ } )
5342
+ class MultiSelectWithLotsOfPreselectedOptions {
5343
+ items = new Array ( 1000 ) . fill ( 0 ) . map ( ( _ , i ) => i ) ;
5344
+ value = [ ...this . items ] ;
5345
+ }
0 commit comments