|
450 | 450 | ], eventNs ); |
451 | 451 | }); |
452 | 452 |
|
| 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 | + |
453 | 513 | })( jQuery ); |
0 commit comments