mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-17 06:20:26 +00:00
added two helpers and tests for proper url stack history traversal
This commit is contained in:
parent
20dce2ce42
commit
86eceb03fc
4 changed files with 45 additions and 0 deletions
|
|
@ -53,6 +53,16 @@
|
|||
} else {
|
||||
setTimeout($.testHelper.hideActivePageWhenComplete, 500);
|
||||
}
|
||||
},
|
||||
|
||||
openPage: function(hash){
|
||||
location.href = location.href.split('#')[0] + hash;
|
||||
},
|
||||
|
||||
sequence: function(fns, interval){
|
||||
$.each(fns, function(i, fn){
|
||||
setTimeout(fn, i * interval);
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
1
tests/unit/listview/.#listview_core.js
Symbolic link
1
tests/unit/listview/.#listview_core.js
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
johnbender@john-benders-macbook-pro.local.504
|
||||
|
|
@ -94,5 +94,23 @@
|
|||
<div id="no-trans-dialog" data-role="page">
|
||||
</div>
|
||||
|
||||
<div id="dup-history-first" data-role="page">
|
||||
<a href="#dup-history-second" data-transition="slideup" data-role="button" >
|
||||
Page 2
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="dup-history-second" data-role="page">
|
||||
<a href="#dup-history-first" data-transition="slideup" data-role="button">
|
||||
Page 1
|
||||
</a>
|
||||
<a href="#dup-history-dialog" data-role="button" data-transition="pop" data-rel="dialog">Dialog</a>
|
||||
</div>
|
||||
|
||||
<div id="dup-history-dialog" data-role="dialog">
|
||||
<div data-role="header" data-position="inline">
|
||||
<h1>Dialog</h1>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -228,5 +228,21 @@
|
|||
test( "data url works when role and url are reversed on the page element", function(){
|
||||
testDataUrlHash("#reverse-attr-data-url a", /^#foo\/bar\/reverse.html$/);
|
||||
});
|
||||
|
||||
asyncTest( "last entry choosen amongst multiple identical url history stack entries on hash change", function(){
|
||||
$.testHelper.openPage("#dup-history-first");
|
||||
|
||||
$.testHelper.sequence([
|
||||
function(){ $("#dup-history-first a").click(); },
|
||||
function(){ $("#dup-history-second a:first").click(); },
|
||||
function(){ $("#dup-history-first a").click(); },
|
||||
function(){ $("#dup-history-second a:last").click(); },
|
||||
function(){ $("#dup-history-dialog .ui-icon-delete").click(); },
|
||||
function(){
|
||||
// third page because the first opened page is manual hash manip
|
||||
same($.mobile.urlHistory.activeIndex, 3, "should be the third page in the stack");
|
||||
start();
|
||||
}], 1000);
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue