|
78 | 78 | ok( $container.children().is( $payload ), "After destroying on-the-fly popup, its payload is returned to its original location" ); |
79 | 79 | }); |
80 | 80 |
|
| 81 | + asyncTest( "Popup does not go back in history twice when opening on separate page", function() { |
| 82 | + var eventNs = ".backTwice", popup = function() { return $( "#back-twice-test-popup" ); }; |
| 83 | + $.testHelper.detailedEventCascade([ |
| 84 | + function() { |
| 85 | + $( "#go-to-another-page" ).click(); |
| 86 | + }, |
| 87 | + { |
| 88 | + navigate: { src: $( document ), event: "navigate" + eventNs + "1" }, |
| 89 | + pagechange: { src: $.mobile.pageContainer, event: "pagechange" + eventNs + "1" } |
| 90 | + }, |
| 91 | + function() { |
| 92 | + deepEqual( $.mobile.activePage.attr( "id" ), "another-page", "Reached another page" ); |
| 93 | + $( "#open-back-twice-test-popup" ).click(); |
| 94 | + }, |
| 95 | + { |
| 96 | + popupafteropen: { src: popup, event: "popupafteropen" + eventNs + "2" }, |
| 97 | + navigate: { src: $(document), event: "navigate" + eventNs + "2" } |
| 98 | + }, |
| 99 | + function( result ) { |
| 100 | + deepEqual( result.popupafteropen.timedOut, false, "popupafteropen event did arrive" ); |
| 101 | + deepEqual( result.navigate.timedOut, false, "navigate event did arrive" ); |
| 102 | + $( "#back-twice-test-popup-screen" ).click(); |
| 103 | + }, |
| 104 | + { |
| 105 | + popupafterclose: { src: popup, event: "popupafterclose" + eventNs + "3" }, |
| 106 | + navigate: { src: $( document ), event: "navigate" + eventNs + "3" }, |
| 107 | + pagechange: { src: $( document ), event: "pagechange" + eventNs + "3" } |
| 108 | + }, |
| 109 | + function( result ) { |
| 110 | + deepEqual( result.popupafterclose.timedOut, false, "popupafterclose event did arrive" ); |
| 111 | + deepEqual( result.navigate.timedOut, false, "navigate event did arrived" ); |
| 112 | + deepEqual( result.pagechange.timedOut, false, "pagechange event did arrive" ); |
| 113 | + deepEqual( $.mobile.activePage.attr( "id" ), "another-page", "Back to another page" ); |
| 114 | + $.mobile.back(); |
| 115 | + }, |
| 116 | + { |
| 117 | + navigate: { src: $( document ), event: "navigate" + eventNs + "4" } |
| 118 | + }, |
| 119 | + function( result ) { |
| 120 | + deepEqual( result.navigate.timedOut, false, "navigate event did arrive" ); |
| 121 | + deepEqual( $.mobile.activePage.attr( "id" ), "start-page", "Back to start page" ); |
| 122 | + start(); |
| 123 | + } |
| 124 | + ]); |
| 125 | + }); |
| 126 | + |
81 | 127 | asyncTest( "Popup opens and closes", function() { |
82 | 128 | var $popup = $( "#test-popup" ); |
83 | 129 | expect( 9 ); |
|
0 commit comments