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

Commit

Permalink
completed doc relative tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbender committed Apr 28, 2011
1 parent 84c1cfb commit 9b88587
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 12 deletions.
12 changes: 7 additions & 5 deletions tests/unit/navigation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ <h1>Dialog</h1>
<a href="dialog-param-test/dialog-param.html">go</a>
</div>

<div data-nstest-role="page" id="doc-rel-file-ref-no-nest">
<a href="file.html">go</a>
<div data-nstest-role="page" id="pathing-tests">
<a href="file.html" id="doc-rel-file-ref-no-nest">go</a>
<a href="path-tests/file.html" id="doc-rel-file-ref-nested">go</a>
<a href="path-tests/sub-dir/file.html" id="doc-rel-file-ref-double-nested">go</a>
<a href="path-tests/sub-dir/" id="doc-rel-dir-ref-nested-dir">go</a>
<a href="../../unit/navigation/path-tests/parent-ref.html" id="doc-rel-file-ref-parent">go</a>
<a href="../../unit/navigation/path-tests/parent/" id="doc-rel-dir-ref-parent">go</a>
</div>

<div data-nstest-role="page" id="doc-rel-file-ref-nested">
<a href="path-tests/file.html">go</a>
</div>
</body>
</html>
30 changes: 23 additions & 7 deletions tests/unit/navigation/navigation_paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
* mobile navigation path unit tests
*/
(function($){
module("jquery.mobile.navigation.js");

var testPageLoad = function(testPageSelector, expectedTextValue){
var testPageLoad = function(testPageAnchorSelector, expectedTextValue){
expect( 1 );

$.testHelper.sequence([
// open our test page
function(){
$.testHelper.openPage(testPageSelector);
$.testHelper.openPage("#pathing-tests");
},

// navigate to the linked page
function(){
$(".ui-page-active a").click();
$( ".ui-page-active a" + testPageAnchorSelector ).click();
},

// verify that the page has changed and the expected text value is present
Expand All @@ -26,11 +24,29 @@
], 800);
};

asyncTest( "document relative file reference no nesting", function(){
module("document relative paths");

asyncTest( "file reference no nesting", function(){
testPageLoad("#doc-rel-file-ref-no-nest", "doc rel file ref no nest");
});

asyncTest( "document relative file reference with nesting", function(){
asyncTest( "file reference with nesting", function(){
testPageLoad("#doc-rel-file-ref-nested", "doc rel file ref nested");
});

asyncTest( "file reference with double nesting", function(){
testPageLoad("#doc-rel-file-ref-double-nested", "doc rel file ref double nested");
});

asyncTest( "dir refrence with nesting", function(){
testPageLoad("#doc-rel-dir-ref-nested-dir", "doc rel dir ref nested dir");
});

asyncTest( "file refrence with parent dir", function(){
testPageLoad("#doc-rel-file-ref-parent", "doc rel dir ref parent");
});

asyncTest( "dir refrence with parent dir", function(){
testPageLoad("#doc-rel-dir-ref-parent", "doc rel dir ref parent");
});
})(jQuery);
11 changes: 11 additions & 0 deletions tests/unit/navigation/path-tests/parent-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div data-nstest-role="page">
<div class="test-value">doc rel dir ref parent</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions tests/unit/navigation/path-tests/parent/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div data-nstest-role="page">
<div class="test-value">doc rel dir ref parent</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions tests/unit/navigation/path-tests/sub-dir/file.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div data-nstest-role="page">
<div class="test-value">doc rel file ref double nested</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions tests/unit/navigation/path-tests/sub-dir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div data-nstest-role="page">
<div class="test-value">doc rel dir ref nested dir</div>
</div>
</body>
</html>

0 comments on commit 9b88587

Please sign in to comment.