@@ -620,11 +620,15 @@ describe('$uibModal', function() {
620
620
template :'<a href="#" id="tab-focus-link"><input type="text" id="tab-focus-input1"/><input type="text" id="tab-focus-input2"/>' +
621
621
'<button id="tab-focus-button">Open me!</button>'
622
622
} ) ;
623
+ $rootScope . $digest ( ) ;
623
624
expect ( $document ) . toHaveModalsOpen ( 1 ) ;
624
625
626
+ triggerKeyDown ( angular . element ( document . activeElement ) , 9 , true ) ;
627
+ expect ( document . activeElement . getAttribute ( 'id' ) ) . toBe ( 'tab-focus-button' ) ;
628
+
625
629
var lastElement = angular . element ( document . getElementById ( 'tab-focus-link' ) ) ;
626
630
lastElement . focus ( ) ;
627
- triggerKeyDown ( lastElement , 9 , true ) ;
631
+ triggerKeyDown ( angular . element ( document . activeElement ) , 9 , true ) ;
628
632
expect ( document . activeElement . getAttribute ( 'id' ) ) . toBe ( 'tab-focus-button' ) ;
629
633
630
634
initialPage . remove ( ) ;
@@ -660,11 +664,15 @@ describe('$uibModal', function() {
660
664
'<button id="tab-focus-button">Open me!</button>' ,
661
665
keyboard : false
662
666
} ) ;
667
+ $rootScope . $digest ( ) ;
663
668
expect ( $document ) . toHaveModalsOpen ( 1 ) ;
664
669
670
+ triggerKeyDown ( angular . element ( document . activeElement ) , 9 , true ) ;
671
+ expect ( document . activeElement . getAttribute ( 'id' ) ) . toBe ( 'tab-focus-button' ) ;
672
+
665
673
var lastElement = angular . element ( document . getElementById ( 'tab-focus-link' ) ) ;
666
674
lastElement . focus ( ) ;
667
- triggerKeyDown ( lastElement , 9 , true ) ;
675
+ triggerKeyDown ( angular . element ( document . activeElement ) , 9 , true ) ;
668
676
expect ( document . activeElement . getAttribute ( 'id' ) ) . toBe ( 'tab-focus-button' ) ;
669
677
670
678
initialPage . remove ( ) ;
0 commit comments