had to introduce a mock function to test the historyChange state

This commit is contained in:
El RIDO 2017-10-22 09:56:44 +02:00
parent 379571d522
commit 6dbb098d7a
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 20 additions and 8 deletions

View file

@ -866,7 +866,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
{
var currentLocation = Helper.baseUri();
if (event.originalEvent.state === null && // no state object passed
event.originalEvent.target.location.href === currentLocation && // target location is home page
event.target.location.href === currentLocation && // target location is home page
window.location.href === currentLocation // and we are not already on the home page
) {
// redirect to home page
@ -958,6 +958,19 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
});
}
/**
* trigger a history (pop) state change
*
* used to test the UiHelper.historyChange private function
*
* @name UiHelper.mockHistoryChange
* @function
*/
me.mockHistoryChange = function()
{
historyChange($.Event('popstate', {originalEvent: new PopStateEvent('popstate', {state: null}), target: window}));
}
/**
* initialize
*