Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
[sequence tests] Adding test page1 -> dialog1 <- back -> dialog2 <- back
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Sep 28, 2012
1 parent 9e54272 commit 2493c09
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/unit/navigation/sequence-tests/basic-dialog1.html
@@ -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>
1 change: 1 addition & 0 deletions tests/unit/navigation/sequence-tests/sequence-tests.html
Expand Up @@ -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>

Expand Down
50 changes: 50 additions & 0 deletions tests/unit/navigation/sequence-tests/sequence_tests.js
Expand Up @@ -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.