@@ -39,6 +39,7 @@ describe('MatSelectionList without forms', () => {
39
39
SelectionListWithListDisabled ,
40
40
SelectionListWithOnlyOneOption ,
41
41
SelectionListWithIndirectChildOptions ,
42
+ SelectionListWithSelectedOptionAndValue ,
42
43
] ,
43
44
} ) ;
44
45
@@ -594,6 +595,14 @@ describe('MatSelectionList without forms', () => {
594
595
. toBe ( 0 , 'Expected no ripples after list ripples are disabled.' ) ;
595
596
} ) ) ;
596
597
598
+ it ( 'can bind both selected and value at the same time' , ( ) => {
599
+ const fixture = TestBed . createComponent ( SelectionListWithSelectedOptionAndValue ) ;
600
+ fixture . detectChanges ( ) ;
601
+ const listItemEl = fixture . debugElement . query ( By . directive ( MatListOption ) ) ! ;
602
+ expect ( listItemEl . componentInstance . selected ) . toBe ( true ) ;
603
+ expect ( listItemEl . componentInstance . value ) . toBe ( fixture . componentInstance . itemValue ) ;
604
+ } ) ;
605
+
597
606
} ) ;
598
607
599
608
describe ( 'with list option selected' , ( ) => {
@@ -1191,18 +1200,6 @@ describe('MatSelectionList with forms', () => {
1191
1200
expect ( testComponent . optionInstances . toArray ( ) [ 1 ] . selected ) . toBe ( true ) ;
1192
1201
} ) ) ;
1193
1202
} ) ;
1194
-
1195
- it ( 'can bind both selected and value at the same time' , ( ) => {
1196
- const fixture =
1197
- TestBed
1198
- . configureTestingModule (
1199
- { imports : [ MatListModule ] , declarations : [ SelectionListWithSelectedOptionAndValue ] } )
1200
- . createComponent ( SelectionListWithSelectedOptionAndValue ) ;
1201
- fixture . detectChanges ( ) ;
1202
- const listItemEl = fixture . debugElement . query ( By . directive ( MatListOption ) ) ! ;
1203
- expect ( listItemEl . componentInstance . selected ) . toBe ( true ) ;
1204
- expect ( listItemEl . componentInstance . value ) . toBe ( fixture . componentInstance . itemValue ) ;
1205
- } ) ;
1206
1203
} ) ;
1207
1204
1208
1205
0 commit comments