@@ -363,7 +363,7 @@ describe('MatSelectionList without forms', () => {
363363 expect ( event . defaultPrevented ) . toBe ( true ) ;
364364 } ) ;
365365
366- it ( 'should select all items using ctrl + a' , ( ) => {
366+ it ( 'should select and deselect all items using ctrl + a' , ( ) => {
367367 listOptions . forEach ( option => ( option . componentInstance . disabled = false ) ) ;
368368 fixture . changeDetectorRef . markForCheck ( ) ;
369369 fixture . detectChanges ( ) ;
@@ -375,6 +375,29 @@ describe('MatSelectionList without forms', () => {
375375 fixture . detectChanges ( ) ;
376376
377377 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 ) ;
378401 } ) ;
379402
380403 it ( 'should not select disabled items when pressing ctrl + a' , ( ) => {
0 commit comments