Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dalemanthei
Created January 24, 2016 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalemanthei/fe95680ee5948440fa85 to your computer and use it in GitHub Desktop.
Save dalemanthei/fe95680ee5948440fa85 to your computer and use it in GitHub Desktop.
Decorate $window to count page reloads
beforeEach(module(function ($provide) {
$provide.decorator('$window', ['$delegate',
function ($delegate) {
$windowMock = {};
$windowMock.prototype = $delegate;
$windowMock.reloadCount = 0;
$windowMock.location = {};
$windowMock.location.reload = function () {
$windowMock.reloadCount = $windowMock.reloadCount + 1;
};
return $windowMock;
}
]);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment