Clean history after every test that changes history
This commit is contained in:
parent
20b54b133c
commit
c4d4f4d857
|
@ -91,6 +91,10 @@ describe('Environment', () => {
|
|||
});
|
||||
|
||||
describe('pagination', () => {
|
||||
afterEach(() => {
|
||||
window.history.pushState({}, null, '');
|
||||
});
|
||||
|
||||
it('should render pagination', (done) => {
|
||||
setTimeout(() => {
|
||||
expect(
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in New Issue