File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ describe('MatSelectionList with forms', () => {
496
496
. map ( optionDebugEl => optionDebugEl . componentInstance ) ;
497
497
} ) ;
498
498
499
- it ( 'should update the model if an option got selected' , fakeAsync ( ( ) => {
499
+ it ( 'should update the model if an option got selected programmatically ' , fakeAsync ( ( ) => {
500
500
expect ( fixture . componentInstance . selectedOptions . length )
501
501
. toBe ( 0 , 'Expected no options to be selected by default' ) ;
502
502
@@ -608,8 +608,8 @@ describe('MatSelectionList with forms', () => {
608
608
fixture . componentInstance . formControl . setValue ( [ 'opt2' , 'opt3' ] ) ;
609
609
fixture . detectChanges ( ) ;
610
610
611
- expect ( listOptions [ 1 ] . selected ) . toBe ( true , 'Expected option to be selected.' ) ;
612
- expect ( listOptions [ 2 ] . selected ) . toBe ( true , 'Expected option to be selected.' ) ;
611
+ expect ( listOptions [ 1 ] . selected ) . toBe ( true , 'Expected first option to be selected.' ) ;
612
+ expect ( listOptions [ 2 ] . selected ) . toBe ( true , 'Expected second option to be selected.' ) ;
613
613
614
614
fixture . componentInstance . formControl . setValue ( null ) ;
615
615
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -351,17 +351,17 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
351
351
}
352
352
353
353
/** Implemented as part of ControlValueAccessor. */
354
- registerOnChange ( fn : any ) : void {
354
+ registerOnChange ( fn : ( value : any ) => void ) : void {
355
355
this . _onChange = fn ;
356
356
}
357
357
358
358
/** Implemented as part of ControlValueAccessor. */
359
- registerOnTouched ( fn : any ) : void {
359
+ registerOnTouched ( fn : ( ) => void ) : void {
360
360
this . onTouched = fn ;
361
361
}
362
362
363
363
/** Returns the option with the specified value. */
364
- private _getOptionFromValue ( value : string ) : MatListOption | undefined {
364
+ private _getOptionByValue ( value : string ) : MatListOption | undefined {
365
365
return this . options . find ( option => option . value === value ) ;
366
366
}
367
367
@@ -370,8 +370,8 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
370
370
this . options . forEach ( option => option . _setSelected ( false ) ) ;
371
371
372
372
values
373
- . map ( value => this . _getOptionFromValue ( value ) )
374
- . filter ( option => ! ! option )
373
+ . map ( value => this . _getOptionByValue ( value ) )
374
+ . filter ( Boolean )
375
375
. forEach ( option => option ! . _setSelected ( true ) ) ;
376
376
}
377
377
You can’t perform that action at this time.
0 commit comments