mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
fix for back button page index check by reseting history stack
This commit is contained in:
parent
7b00335dcc
commit
4dac49359f
1 changed files with 12 additions and 9 deletions
|
|
@ -7,8 +7,6 @@
|
|||
siteDirectory = location.pathname.replace(/[^/]+$/, "");
|
||||
module('jquery.mobile.navigation.js', {
|
||||
setup: function(){
|
||||
$.mobile.urlHistory.stack = [];
|
||||
$.mobile.urlHistory.activeIndex = 0;
|
||||
$.mobile.changePage = changePageFn;
|
||||
document.title = originalTitle;
|
||||
|
||||
|
|
@ -19,6 +17,9 @@
|
|||
} );
|
||||
location.hash = "";
|
||||
}
|
||||
|
||||
$.mobile.urlHistory.stack = [];
|
||||
$.mobile.urlHistory.activeIndex = 0;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -142,13 +143,15 @@
|
|||
});
|
||||
|
||||
var testDataUrlHash = function(linkSelector, hashRegex){
|
||||
window.location.hash = "";
|
||||
$(linkSelector).click();
|
||||
$.testHelper.pageSequence([
|
||||
function(){ window.location.hash = ""; },
|
||||
function(){ $(linkSelector).click(); },
|
||||
function(){
|
||||
ok(hashRegex.test(location.hash), "should match the regex");
|
||||
start();
|
||||
}
|
||||
]);
|
||||
|
||||
setTimeout(function(){
|
||||
ok(hashRegex.test(location.hash), "should match the regex");
|
||||
start();
|
||||
}, 600);
|
||||
stop();
|
||||
};
|
||||
|
||||
|
|
@ -181,7 +184,7 @@
|
|||
// fourth page (third index) in the stack to account for first page being hash manipulation,
|
||||
// the third page is dup-history-second which has two entries in history
|
||||
// the test is to make sure the index isn't 1 in this case, or the first entry for dup-history-second
|
||||
same($.mobile.urlHistory.activeIndex, 4, "should be the fourth page in the stack");
|
||||
same($.mobile.urlHistory.activeIndex, 3, "should be the fourth page in the stack");
|
||||
start();
|
||||
}]);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue