Clean history after every test that changes history

This commit is contained in:
Filipa Lacerda 2017-03-31 11:22:31 +01:00
parent 20b54b133c
commit c4d4f4d857
3 changed files with 16 additions and 0 deletions

View File

@ -91,6 +91,10 @@ describe('Environment', () => {
});
describe('pagination', () => {
afterEach(() => {
window.history.pushState({}, null, '');
});
it('should render pagination', (done) => {
setTimeout(() => {
expect(

View File

@ -46,6 +46,10 @@ require('~/lib/utils/common_utils');
spyOn(window.document, 'getElementById').and.callThrough();
});
afterEach(() => {
window.history.pushState({}, null, '');
});
function expectGetElementIdToHaveBeenCalledWith(elementId) {
expect(window.document.getElementById).toHaveBeenCalledWith(elementId);
}
@ -80,6 +84,10 @@ require('~/lib/utils/common_utils');
window.history.pushState({}, null, '?scope=all&p=2');
});
afterEach(() => {
window.history.pushState({}, null, '');
});
it('should return valid parameter', () => {
const value = gl.utils.getParameterByName('scope');
expect(value).toBe('all');

View File

@ -124,6 +124,10 @@ describe('Pagination component', () => {
});
describe('paramHelper', () => {
afterEach(() => {
window.history.pushState({}, null, '');
});
it('can parse url parameters correctly', () => {
window.history.pushState({}, null, '?scope=all&p=2');