mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 14:36:08 -04:00
had to introduce a mock function to test the historyChange state
This commit is contained in:
parent
379571d522
commit
6dbb098d7a
4 changed files with 20 additions and 8 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue