This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first pass at supporting query params in the hash Fixes #5085
This commit strips any query string from the hash when referencing an internal page. This allows users to reference exising pages but communicate information to parts of their application and allows users to use a singple page to do different things with the page event bindings to do so. The information about the url is preserved under the data.options object provided to the page lifecycle events as data.options.target which will contain the original url.
- Loading branch information
1 parent
c7e87d4
commit 824261b
Showing
8 changed files
with
93 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- forces the base-tests into a push state disabled run and allows for | ||
the test suite runner to pick it up as a seperate test set. See test/unit/ls.php, | ||
test/unit/runner.js, base-tests.html, and tests/jquery.testHelper.js for more. --> | ||
<script src="../../../js/jquery.js"></script> | ||
<script src="../../jquery.testHelper.js"></script> | ||
<script type="text/javascript"> | ||
$.testHelper.redirect( "init-tests/query-param-hash.html#loaded?test-query-param-hash=true" ); | ||
</script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
tests/unit/navigation/init-tests/navigation_query_param_hash.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(function( $ ) { | ||
module( "initial page loading tests" ); | ||
|
||
test( "loading a url that refs an embedded page with a query param works", function() { | ||
ok( location.href.indexOf( "?test-query-param-hash=true" ) >= -1, "query param present in url" ); | ||
ok( location.hash.indexOf( "loaded" ) >= -1, "the hash is targeted at the page to be loaded" ); | ||
ok( $.mobile.activePage.attr( "id" ), "loaded", "the correct page is loaded" ); | ||
}); | ||
})( jQuery ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Navigation Test Suite</title> | ||
|
||
<script src="../../../../js/jquery.tag.inserter.js"></script> | ||
<script src="../../jquery.setNameSpace.js"></script> | ||
<script src="../../../../tests/jquery.testHelper.js"></script> | ||
<script src="../../../../js/"></script> | ||
<script type="text/javascript"> | ||
$.testHelper.setPushState(); | ||
</script> | ||
<link rel="stylesheet" href="../../../../css/themes/default/jquery.mobile.css"/> | ||
<link rel="stylesheet" href="../../../../external/qunit.css"/> | ||
<script src="../../../../external/qunit.js"></script> | ||
<script src="../../swarminject.js"></script> | ||
<script type="text/javascript" src="navigation_query_param_hash.js"></script> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
|
||
<!-- default page is not the targeted page --> | ||
<div id="default" data-nstest-role="page"> | ||
</div> | ||
|
||
<div id="loaded" data-nstest-role="page"> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters