Permalink
Browse files

[sequence tests] Adding test page1 -> dialog1 <- back -> dialog2 <- back

  • Loading branch information...
1 parent 9e54272 commit 2493c0997fb87023c590a9446ec67d2a6e525060 @gabrielschulhof gabrielschulhof committed Sep 28, 2012
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+ <div id="anotherDialog" data-nstest-role="dialog">
+ <div data-nstest-role="header">
+ <h1>Dialog</h1>
+ </div>
+ <div data-nstest-role="content">
+ <a href="another-page.html" id="fromAnotherDialogToAnotherPage">Go</a>
+ </div>
+ </div>
+</body>
+</html>
@@ -52,6 +52,7 @@ <h2 id="qunit-userAgent"></h2>
</div>
<a id="openPopup" href="#thePopup" data-nstest-rel="popup">Pop</a>
<a id="openBasicDialog" href="basic-dialog.html" data-nstest-rel="dialog">Dialog</a>
+ <a id="openAnotherDialog" href="basic-dialog1.html" data-nstest-rel="dialog">Dialog 1</a>
</div>
</div>
@@ -151,4 +151,54 @@
]);
});
+ asyncTest( "Opening one dialog followed by opening another dialog works", function() {
+
+ expect( 4 );
+
+ $.testHelper.detailedEventCascade([
+ // This empty function and the following "navigate" event test is necessary to ensure
+ // that, when the initial URL contains the path to a page to be loaded via AJAX, the loading
+ // process which is done via a synthetic hashchange event completes.
+ function() { },
+ { navigate: { src: $( document ), event: "navigate.openingOneDialogFollowedByAnotherStep0" } },
+
+ // NOTE: The first part of this test is a copy of the test above
+ function() { $( "#openBasicDialog" ).click(); },
+ {
+ navigate: { src: $( document ), event: "navigate.openingOneDialogFollowedByAnotherStep1" },
+ pagechange: { src: $.mobile.pageContainer, event: "pagechange.openingOneDialogFollowedByAnotherStep1" }
+ },
+ function() {
+ ok( $.mobile.activePage.attr( "id" ) === "basicDialog", "Basic dialog has opened" );
+ $( "a:first", $.mobile.activePage[ 0 ] ).click();
+ },
+ {
+ navigate: { src: $( document ), event: "navigate.openingOneDialogFollowedByAnotherStep2" },
+ pagechange: { src: $.mobile.pageContainer, event: "pagechange.openingOneDialogFollowedByAnotherStep2" }
+ },
+
+ // NOTE: The second part of this test is also a copy of the test above
+ function() {
+ ok( $.mobile.activePage.attr( "id" ) === "basicTestPage", "Active page is original page" );
+ $( "#openAnotherDialog" ).click();
+ },
+ {
+ navigate: { src: $( document ), event: "navigate.openingOneDialogFollowedByAnotherStep3" },
+ pagechange: { src: $.mobile.pageContainer, event: "pagechange.openingOneDialogFollowedByAnotherStep3" }
+ },
+ function() {
+ ok( $.mobile.activePage.attr( "id" ) === "anotherDialog", "Another dialog has opened" );
+ $( "a:first", $.mobile.activePage[ 0 ] ).click();
+ },
+ {
+ navigate: { src: $( document ), event: "navigate.openingOneDialogFollowedByAnotherStep4" },
+ pagechange: { src: $.mobile.pageContainer, event: "pagechange.openingOneDialogFollowedByAnotherStep4" }
+ },
+ function() {
+ ok( $.mobile.activePage.attr( "id" ) === "basicTestPage", "Active page is original page" );
+ start();
+ },
+ ]);
+ });
+
})( jQuery );

0 comments on commit 2493c09

Please sign in to comment.