@@ -363,7 +363,7 @@ describe('MatSelectionList without forms', () => {
363
363
expect ( event . defaultPrevented ) . toBe ( true ) ;
364
364
} ) ;
365
365
366
- it ( 'should select all items using ctrl + a' , ( ) => {
366
+ it ( 'should select and deselect all items using ctrl + a' , ( ) => {
367
367
listOptions . forEach ( option => ( option . componentInstance . disabled = false ) ) ;
368
368
fixture . changeDetectorRef . markForCheck ( ) ;
369
369
fixture . detectChanges ( ) ;
@@ -375,6 +375,29 @@ describe('MatSelectionList without forms', () => {
375
375
fixture . detectChanges ( ) ;
376
376
377
377
expect ( listOptions . every ( option => option . componentInstance . selected ) ) . toBe ( true ) ;
378
+
379
+ dispatchKeyboardEvent ( listOptions [ 2 ] . nativeElement , 'keydown' , A , 'A' , { control : true } ) ;
380
+ fixture . detectChanges ( ) ;
381
+
382
+ expect ( listOptions . every ( option => option . componentInstance . selected ) ) . toBe ( false ) ;
383
+ } ) ;
384
+
385
+ it ( 'should select and deselect all items using meta + a' , ( ) => {
386
+ listOptions . forEach ( option => ( option . componentInstance . disabled = false ) ) ;
387
+ fixture . changeDetectorRef . markForCheck ( ) ;
388
+ fixture . detectChanges ( ) ;
389
+
390
+ expect ( listOptions . some ( option => option . componentInstance . selected ) ) . toBe ( false ) ;
391
+
392
+ listOptions [ 2 ] . nativeElement . focus ( ) ;
393
+ dispatchKeyboardEvent ( listOptions [ 2 ] . nativeElement , 'keydown' , A , 'A' , { meta : true } ) ;
394
+ fixture . detectChanges ( ) ;
395
+
396
+ expect ( listOptions . every ( option => option . componentInstance . selected ) ) . toBe ( true ) ;
397
+ dispatchKeyboardEvent ( listOptions [ 2 ] . nativeElement , 'keydown' , A , 'A' , { meta : true } ) ;
398
+ fixture . detectChanges ( ) ;
399
+
400
+ expect ( listOptions . every ( option => option . componentInstance . selected ) ) . toBe ( false ) ;
378
401
} ) ;
379
402
380
403
it ( 'should not select disabled items when pressing ctrl + a' , ( ) => {
0 commit comments