This repository was archived by the owner on Oct 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 7878 < p > This is the test popup</ p >
7979 </ div >
8080 < a id ="go-to-another-page " href ="back-two.html "> Go</ a >
81+
82+ < div data-nstest-role ="popup " id ="popupLogin ">
83+ < form >
84+ < input type ="text " name ="user " id ="textBox " value ="" placeholder ="username " />
85+ </ form >
86+ </ div >
87+
8188 </ div >
8289 </ div >
8390
Original file line number Diff line number Diff line change 553553 }
554554 ] ) ;
555555 } ) ;
556+
557+ asyncTest ( "Elements inside the popup lose focus when the popup is closed" , function ( ) {
558+
559+ expect ( 5 ) ;
560+
561+ var $popup = $ ( "#popupLogin" ) ,
562+ $popupContainer = $ ( "#popupLogin-popup" ) ,
563+ $textBox = $ ( "#textBox" ) ,
564+ eventSuffix = ".ElementsInsideThePopupLoseFocus" ;
565+
566+ $ . testHelper . detailedEventCascade ( [
567+ function ( ) {
568+ $popup . popup ( "open" ) ;
569+ } ,
570+ {
571+ popupafteropen : { src : $popup , event : "popupafteropen" + eventSuffix + "1" }
572+ } ,
573+ function ( result ) {
574+ deepEqual ( result . popupafteropen . timedOut , false , "Popup did open" ) ;
575+ $textBox . focus ( ) ;
576+ } ,
577+ {
578+ focusevent : { src : $textBox , event : "focus" + eventSuffix + "2" }
579+ } ,
580+ function ( result ) {
581+ deepEqual ( result . focusevent . timedOut , false , "Text box did experience focus event" ) ;
582+ $popup . popup ( "close" ) ;
583+ } ,
584+ {
585+ popupafterclose : { src : $popup , event : "popupafterclose" + eventSuffix + "3" }
586+ } ,
587+ function ( result ) {
588+ deepEqual ( result . popupafterclose . timedOut , false , "Popup did close" ) ;
589+ deepEqual ( $popupContainer . is ( ":focus" ) , false , "The popup container is not focused" ) ;
590+ deepEqual ( $popupContainer . find ( ":focus" ) . length , 0 , "The popup container contains no focused elements" ) ;
591+ start ( ) ;
592+ }
593+ ] ) ;
594+ } ) ;
556595} ) ( jQuery ) ;
You can’t perform that action at this time.
0 commit comments