Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Navigation: Test correct URL upon navigation to internal page
  • Loading branch information
Gabriel Schulhof committed Aug 19, 2014
commit 21a2fcdc39301af2c5cb1c680a7035723298eb37
2 changes: 2 additions & 0 deletions tests/integration/navigation/sequence/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@
<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>
<a id="openAnotherPage" href="another-page.html">Another page</a>
<a id="openInternalPage" href="#internal-page">Internal page</a>
</div>
</div>

<div id="internal-page" data-nstest-role="page"></div>
</body>
</html>
7 changes: 2 additions & 5 deletions tests/integration/navigation/sequence/sequence-redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@
</head>
<body>

<h1 id="qunit-header">jQuery Mobile Sequence Test Suite</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="qunit"></div>

<div data-nstest-role="page" id="sequenceRedirect"></div>
<div id="internal-page" data-nstest-role="page"></div>

<!--
This test page is used when testing initial URLs of the form
Expand Down
28 changes: 28 additions & 0 deletions tests/integration/navigation/sequence/sequence_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@
}
}

asyncTest( "Navigating to an internal page", function() {
var origUrl,
eventNs = ".navigatingToAnInternalPage";

expect( 1 );

maybeWaitForStartPage([
function() {
origUrl = location.href.replace( "&ui-state=dialog", "" );
$( "#openInternalPage" ).click();
},
{
pagecontainerchange: { src: $.mobile.pageContainer, event: "pagecontainerchange" + eventNs + "1" }
},
function() {
deepEqual( location.href, origUrl.indexOf( "#" ) >= 0 ?
origUrl + "internal-page" :
origUrl + "#internal-page",
"URL after popup opens differs only by an appended dialog hash key" );
$.mobile.back();
},
{
pagecontainerchange: { src: $.mobile.pageContainer, event: "pagecontainerchange" + eventNs + "2" }
},
start
]);
});

asyncTest( "Returning from a dialog results in the page from which it opened", function() {
var eventNs = ".returningFromADialog";
expect( 2 );
Expand Down