Skip to content

Commit 7f09ec6

Browse files
author
Gabriel Schulhof
committed
[sequence tests] Test page -> popup1 -> dialog -> popup2 <- back <- back
1 parent ea768cb commit 7f09ec6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/unit/navigation/sequence-tests/sequence_tests.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,4 +450,64 @@
450450
], eventNs );
451451
});
452452

453+
asyncTest( "Sequence page -> popup1 -> dialog -> popup2 <- back <- back", function() {
454+
var eventNs = ".pagePopupDialogPopup";
455+
456+
expect( 12 );
457+
458+
maybeWaitForStartPage([
459+
function() {
460+
$( "#openPopup" ).click();
461+
},
462+
{
463+
popupafteropen: { src: function() { return $( "#thePopup" ); }, event: "popupafteropen" + eventNs + "1" },
464+
navigate: { src: $.mobile.pageContainer, event: "navigate" + eventNs + "1" }
465+
},
466+
function( result ) {
467+
ok( !result.popupafteropen.timedOut, "Popup emitted 'popupafteropen'" );
468+
ok( !result.navigate.timedOut, "A 'navigate' event has occurred as a result of opening the popup" );
469+
$( "#openDialogFromPopup" ).click();
470+
},
471+
{
472+
popupafterclose: { src: function() { return $( "#thePopup" ); }, event: "popupafterclose" + eventNs + "2" },
473+
navigate: { src: $( document ), event: "navigate" + eventNs + "2" },
474+
pagechange: { src: $.mobile.pageContainer, event: "pagechange" + eventNs + "2" }
475+
},
476+
function( result ) {
477+
ok( !result.popupafterclose.timedOut, "Popup emitted 'popupafterclose'" );
478+
ok( $.mobile.activePage.attr( "id" ) === "basicDialog", "Basic dialog has opened" );
479+
$( "#fromDialogToPopup" ).click();
480+
},
481+
{
482+
popupafteropen: { src: function() { return $( "#popupFromBasicDialog" ); }, event: "popupafteropen" + eventNs + "1" },
483+
navigate: { src: $.mobile.pageContainer, event: "navigate" + eventNs + "1" }
484+
},
485+
function( result ) {
486+
ok( !result.popupafteropen.timedOut, "Popup emitted 'popupafteropen'" );
487+
ok( !result.navigate.timedOut, "A 'navigate' event has occurred as a result of opening the popup" );
488+
$( "#popupFromBasicDialog" ).parent().prev().click();
489+
},
490+
{
491+
popupafterclose: { src: function() { return $( "#popupFromBasicDialog" ); }, event: "popupafterclose" + eventNs + "2" },
492+
navigate: { src: $( document ), event: "navigate" + eventNs + "2" },
493+
},
494+
function( result ) {
495+
ok( !result.popupafterclose.timedOut, "Popup emitted 'popupafterclose'" );
496+
ok( !result.navigate.timedOut, "A 'navigate' event has occurred as a result of closing the popup" );
497+
ok( $.mobile.activePage.attr( "id" ) === "basicDialog", "Basic dialog is active page" );
498+
$( "a:first", $.mobile.activePage[ 0 ] ).click();
499+
},
500+
{
501+
navigate: { src: $( document ), event: "navigate" + eventNs + "2" },
502+
pagechange: { src: $.mobile.pageContainer, event: "pagechange" + eventNs + "2" }
503+
},
504+
function( result ) {
505+
ok( !result.navigate.timedOut, "A 'navigate' event has occurred as a result of returning from the dialog" );
506+
ok( !result.pagechange.timedOut, "A pagechange event has occurred as a result of returning from the dialog" );
507+
ok( $.mobile.activePage.attr( "id" ) === "basicTestPage", "Basic test page is active page" );
508+
start();
509+
}
510+
], eventNs );
511+
});
512+
453513
})( jQuery );

0 commit comments

Comments
 (0)