added sub page hash key tests

This commit is contained in:
John Bender 2011-08-26 16:51:07 -07:00
parent 7ed31bedb5
commit 1811b31715
3 changed files with 114 additions and 0 deletions

View file

@ -706,4 +706,28 @@
}
]);
});
asyncTest( "nested pages hash key is always in the hash (replaceState)", function(){
$.testHelper.pageSequence([
function(){
//reset for relative url refs
$.testHelper.openPage( "#" + home );
},
function(){
// https://github.com/jquery/jquery-mobile/issues/1617
$.testHelper.openPage("#nested-lists-test");
},
function(){
// Click on the link of the third li element
$('.ui-page-active li:eq(2) a:eq(0)').click();
},
function(){
ok( location.hash.search($.mobile.subPageUrlKey) >= 0 );
start();
}
]);
});
})(jQuery);

View file

@ -0,0 +1,15 @@
(function($) {
asyncTest( "nested pages hash key is always in the hash on default page with no id (replaceState) ", function(){
$.testHelper.pageSequence([
function(){
// Click on the link of the third li element
$('.ui-page-active li:eq(2) a:eq(0)').click();
},
function(){
ok( location.hash.search($.mobile.subPageUrlKey) >= 0 );
start();
}
]);
});
})(jQuery);

View file

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery Mobile Listview Integration Test</title>
<script src="../../../js/jquery.js"></script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../../js/"></script>
<script src="../../jquery.testHelper.js"></script>
<link rel="stylesheet" href="../../../themes/default" />
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../../../external/qunit.js"></script>
<script src="listview_pushstate.js"></script>
</head>
<body>
<h1 id="qunit-header">jQuery Mobile Listview Integration Test</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div data-nstest-role="page">
<div data-nstest-role="header" data-nstest-position="inline">
<h1>Basic multiple lists view</h1>
</div>
<div data-nstest-role="content">
<ul data-nstest-role="listview" data-nstest-inset="true">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3
<ul data-nstest-role="listview">
<li>Item A-3-0</li>
<li>Item A-3-1</li>
<li>Item A-3-2</li>
</ul>
</li>
</ul>
<ul data-nstest-role="listview" data-nstest-inset="true">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3
<ul data-nstest-role="listview">
<li>Item B-3-0
<ul data-nstest-role="listview">
<li>Item B-3-0-0</li>
<li>Item B-3-0-1
<ul data-nstest-role="listview">
<li>Item B-3-0-1-0</li>
<li>Item B-3-0-1-1</li>
<li>Item B-3-0-1-2</li>
</ul>
</li>
<li>Item B-3-0-2</li>
</ul>
</li>
<li>Item B-3-1
<ul data-nstest-role="listview">
<li>Item B-3-1-0</li>
<li>Item B-3-1-1</li>
<li>Item B-3-1-2</li>
</ul>
</li>
<li>Item B-3-2</li>
</ul>
</li>
</ul>
</div>
</div>
</body>
</html>