Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests: Integration: Popup: Add test to make sure popup elements do no…

…t have focus after the popup is closed. Tests #5974.
  • Loading branch information...
commit 273624b864b52707aeb3136a26b53afdcfe45db1 1 parent 7d59d30
Gabriel "_|Nix|_" Schulhof gabrielschulhof authored
7 tests/integration/popup/index.html
View
@@ -75,6 +75,13 @@
<p>This is the test popup</p>
</div>
<a id="go-to-another-page" href="back-two.html">Go</a>
+
+ <div data-nstest-role="popup" id="popupLogin">
+ <form>
+ <input type="text" name="user" id="textBox" value="" placeholder="username" />
+ </form>
+ </div>
+
</div>
</div>
39 tests/integration/popup/popup_core.js
View
@@ -495,4 +495,43 @@
}
]);
});
+
+ asyncTest( "Elements inside the popup lose focus when the popup is closed", function() {
+
+ expect( 5 );
+
+ var $popup = $( "#popupLogin" ),
+ $popupContainer = $( "#popupLogin-popup" ),
+ $textBox = $( "#textBox" ),
+ eventSuffix = ".ElementsInsideThePopupLoseFocus";
+
+ $.testHelper.detailedEventCascade( [
+ function() {
+ $popup.popup( "open" );
+ },
+ {
+ popupafteropen: { src: $popup, event: "popupafteropen" + eventSuffix + "1" }
+ },
+ function( result ) {
+ deepEqual( result.popupafteropen.timedOut, false, "Popup did open" );
+ $textBox.focus();
+ },
+ {
+ focusevent: { src: $textBox, event: "focus" + eventSuffix + "2" }
+ },
+ function( result ) {
+ deepEqual( result.focusevent.timedOut, false, "Text box did experience focus event" );
+ $popup.popup( "close" );
+ },
+ {
+ popupafterclose: { src: $popup, event: "popupafterclose" + eventSuffix + "3" }
+ },
+ function( result ) {
+ deepEqual( result.popupafterclose.timedOut, false, "Popup did close" );
+ deepEqual( $popupContainer.is( ":focus" ), false, "The popup container is not focused" );
+ deepEqual( $popupContainer.find( ":focus" ).length, 0, "The popup container contains no focused elements" );
+ start();
+ }
+ ]);
+ });
})( jQuery );
Please sign in to comment.
Something went wrong with that request. Please try again.