File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ public function testFocus()
5656
5757 $ focusBlurDetector ->focus ();
5858 $ this ->assertEquals ('focused ' , $ focusBlurDetector ->getValue ());
59+
60+ $ focusableAnchor = $ this ->getAssertSession ()->elementExists ('css ' , '.elements a#focusable ' );
61+ $ this ->assertEquals ('no action detected ' , $ focusableAnchor ->getText ());
62+
63+ $ focusableAnchor ->focus ();
64+ // checking that we're on same page
65+ $ this ->getAssertSession ()->addressEquals ('/js_test.html ' );
66+ $ this ->assertEquals ('focused ' , $ focusableAnchor ->getText ());
67+
5968 }
6069
6170 /**
@@ -68,6 +77,8 @@ public function testBlur()
6877 $ focusBlurDetector = $ this ->getAssertSession ()->elementExists ('css ' , '.elements input#focus-blur-detector ' );
6978 $ this ->assertEquals ('no action detected ' , $ focusBlurDetector ->getValue ());
7079
80+ // focusing before, because blur won't be triggered if HTMLElement is not focused
81+ $ focusBlurDetector ->focus ();
7182 $ focusBlurDetector ->blur ();
7283 $ this ->assertEquals ('blured ' , $ focusBlurDetector ->getValue ());
7384 }
Original file line number Diff line number Diff line change 3030 < input class ="input second " type ="text " value ="" />
3131 < input class ="input third " type ="text " value ="" />
3232 < div class ="text-event "> </ div >
33+ < a href ="index.html " id ="focusable "> no action detected</ a >
3334 </ div >
3435
3536 < div id ="draggable " class ="ui-widget-content "> </ div >
5859 $ ( this ) . text ( 'right clicked' ) ;
5960 } ) ;
6061
61- var $focusDetector = $ ( '#focus-blur-detector' ) ;
62+ var $focusDetector = $ ( '#focus-blur-detector, #focusable ' ) ;
6263
6364 $focusDetector . focus ( function ( ) {
64- $ ( this ) . val ( 'focused' ) ;
65+ if ( this . nodeName === 'A' ) {
66+ $ ( this ) . text ( 'focused' ) ;
67+ } else {
68+ $ ( this ) . val ( 'focused' ) ;
69+ }
6570 } ) ;
6671
6772 $focusDetector . blur ( function ( ) {
68- $ ( this ) . val ( 'blured' ) ;
73+ if ( this . nodeName === 'A' ) {
74+ $ ( this ) . text ( 'blured' ) ;
75+ } else {
76+ $ ( this ) . val ( 'blured' ) ;
77+ }
6978 } ) ;
7079
7180 $ ( '#mouseover-detector' ) . mouseover ( function ( ) {
You can’t perform that action at this time.
0 commit comments