@@ -416,12 +416,32 @@ test('#handleKeydown space/enter key does not cause event.preventDefault when si
416
416
td . when ( mockAdapter . toggleCheckbox ( 0 ) ) . thenReturn ( false ) ;
417
417
foundation . setSingleSelection ( false ) ;
418
418
foundation . handleKeydown ( event , true , 0 ) ;
419
- event . key = 'Enter ' ;
419
+ event . key = 'Space ' ;
420
420
foundation . handleKeydown ( event , true , 0 ) ;
421
421
422
422
td . verify ( preventDefault ( ) , { times : 0 } ) ;
423
423
} ) ;
424
424
425
+ test ( '#handleKeydown space/enter key call adapter.followHref regardless of singleSelection' , ( ) => {
426
+ const { foundation, mockAdapter} = setupTest ( ) ;
427
+ const target = { classList : [ 'mdc-list-item' ] } ;
428
+ const event = { key : 'Enter' , target, preventDefault : ( ) => { } } ;
429
+
430
+ td . when ( mockAdapter . getFocusedElementIndex ( ) ) . thenReturn ( 0 ) ;
431
+ td . when ( mockAdapter . getListItemCount ( ) ) . thenReturn ( 3 ) ;
432
+ td . when ( mockAdapter . toggleCheckbox ( 0 ) ) . thenReturn ( false ) ;
433
+ foundation . setSingleSelection ( false ) ;
434
+ foundation . handleKeydown ( event , true , 0 ) ;
435
+ foundation . setSingleSelection ( true ) ;
436
+ foundation . handleKeydown ( event , true , 0 ) ;
437
+ event . key = 'Space' ;
438
+ foundation . handleKeydown ( event , true , 0 ) ;
439
+ foundation . setSingleSelection ( false ) ;
440
+ foundation . handleKeydown ( event , true , 0 ) ;
441
+
442
+ td . verify ( mockAdapter . followHref ( 0 ) , { times : 4 } ) ;
443
+ } ) ;
444
+
425
445
test ( '#handleKeydown space key does not cause preventDefault to be called if singleSelection=false' , ( ) => {
426
446
const { foundation, mockAdapter} = setupTest ( ) ;
427
447
const preventDefault = td . func ( 'preventDefault' ) ;
0 commit comments