@@ -496,6 +496,16 @@ describe('$aria', function() {
496
496
expect ( clickFn ) . toHaveBeenCalled ( ) ;
497
497
} ) ;
498
498
499
+ it ( 'should a trigger click from the keyboard' , function ( ) {
500
+ scope . someAction = function ( ) { } ;
501
+ compileInput ( '<li ng-click="someAction()" tabindex="0"></li>' ) ;
502
+ clickFn = spyOn ( scope , 'someAction' ) ;
503
+
504
+ element . triggerHandler ( { type : 'keypress' , keyCode : 32 } ) ;
505
+
506
+ expect ( clickFn ) . toHaveBeenCalled ( ) ;
507
+ } ) ;
508
+
499
509
it ( 'should not override existing ng-keypress' , function ( ) {
500
510
scope . someOtherAction = function ( ) { } ;
501
511
var keypressFn = spyOn ( scope , 'someOtherAction' ) ;
@@ -528,6 +538,24 @@ describe('$aria', function() {
528
538
} ) ;
529
539
} ) ;
530
540
541
+ describe ( 'actions for different configured elements' , function ( ) {
542
+ beforeEach ( configAriaProvider ( {
543
+ keypressEls : [ 'DIV' ]
544
+ } ) ) ;
545
+ beforeEach ( injectScopeAndCompiler ) ;
546
+
547
+ it ( 'should not a trigger click from the keyboard' , function ( ) {
548
+ scope . someAction = function ( ) { } ;
549
+ var clickFn = spyOn ( scope , 'someAction' ) ;
550
+
551
+ element = $compile ( '<li ng-click="someAction()" tabindex="0"></li>' ) ( scope ) ;
552
+
553
+ element . triggerHandler ( { type : 'keypress' , keyCode : 32 } ) ;
554
+
555
+ expect ( clickFn ) . not . toHaveBeenCalled ( ) ;
556
+ } ) ;
557
+ } ) ;
558
+
531
559
describe ( 'actions when bindKeypress set to false' , function ( ) {
532
560
beforeEach ( configAriaProvider ( {
533
561
bindKeypress : false
@@ -538,7 +566,7 @@ describe('$aria', function() {
538
566
scope . someAction = function ( ) { } ;
539
567
var clickFn = spyOn ( scope , 'someAction' ) ;
540
568
541
- element = $compile ( '<div ng-click="someAction()" tabindex="0">> </div>' ) ( scope ) ;
569
+ element = $compile ( '<div ng-click="someAction()" tabindex="0"></div>' ) ( scope ) ;
542
570
543
571
element . triggerHandler ( { type : 'keypress' , keyCode : 32 } ) ;
544
572
0 commit comments