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 @@ -539,7 +539,7 @@ describe('MatSelectionList with forms', () => {
539
539
. map ( optionDebugEl => optionDebugEl . componentInstance ) ;
540
540
} ) ;
541
541
542
- it ( 'should update the model if an option got selected' , fakeAsync ( ( ) => {
542
+ it ( 'should update the model if an option got selected programmatically ' , fakeAsync ( ( ) => {
543
543
expect ( fixture . componentInstance . selectedOptions . length )
544
544
. toBe ( 0 , 'Expected no options to be selected by default' ) ;
545
545
@@ -651,8 +651,8 @@ describe('MatSelectionList with forms', () => {
651
651
fixture . componentInstance . formControl . setValue ( [ 'opt2' , 'opt3' ] ) ;
652
652
fixture . detectChanges ( ) ;
653
653
654
- expect ( listOptions [ 1 ] . selected ) . toBe ( true , 'Expected option to be selected.' ) ;
655
- expect ( listOptions [ 2 ] . selected ) . toBe ( true , 'Expected option to be selected.' ) ;
654
+ expect ( listOptions [ 1 ] . selected ) . toBe ( true , 'Expected first option to be selected.' ) ;
655
+ expect ( listOptions [ 2 ] . selected ) . toBe ( true , 'Expected second option to be selected.' ) ;
656
656
657
657
fixture . componentInstance . formControl . setValue ( null ) ;
658
658
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -352,17 +352,17 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
352
352
}
353
353
354
354
/** Implemented as part of ControlValueAccessor. */
355
- registerOnChange ( fn : any ) : void {
355
+ registerOnChange ( fn : ( value : any ) => void ) : void {
356
356
this . _onChange = fn ;
357
357
}
358
358
359
359
/** Implemented as part of ControlValueAccessor. */
360
- registerOnTouched ( fn : any ) : void {
360
+ registerOnTouched ( fn : ( ) => void ) : void {
361
361
this . onTouched = fn ;
362
362
}
363
363
364
364
/** Returns the option with the specified value. */
365
- private _getOptionFromValue ( value : string ) : MatListOption | undefined {
365
+ private _getOptionByValue ( value : string ) : MatListOption | undefined {
366
366
return this . options . find ( option => option . value === value ) ;
367
367
}
368
368
@@ -371,8 +371,8 @@ export class MatSelectionList extends _MatSelectionListMixinBase implements Focu
371
371
this . options . forEach ( option => option . _setSelected ( false ) ) ;
372
372
373
373
values
374
- . map ( value => this . _getOptionFromValue ( value ) )
375
- . filter ( option => ! ! option )
374
+ . map ( value => this . _getOptionByValue ( value ) )
375
+ . filter ( Boolean )
376
376
. forEach ( option => option ! . _setSelected ( true ) ) ;
377
377
}
378
378
You can’t perform that action at this time.
0 commit comments