2017-08-07 10:09:50 +00:00
|
|
|
import projectImportGitlab from '~/projects/project_import_gitlab_project';
|
|
|
|
|
|
|
|
describe('Import Gitlab project', () => {
|
2020-01-17 21:08:29 +00:00
|
|
|
const pathName = 'my-project';
|
|
|
|
const projectName = 'My Project';
|
|
|
|
|
2020-12-24 00:10:25 +00:00
|
|
|
const setTestFixtures = (url) => {
|
2020-01-17 21:08:29 +00:00
|
|
|
window.history.pushState({}, null, url);
|
2017-08-07 10:09:50 +00:00
|
|
|
|
|
|
|
setFixtures(`
|
|
|
|
<input class="js-path-name" />
|
2020-01-17 21:08:29 +00:00
|
|
|
<input class="js-project-name" />
|
2017-08-07 10:09:50 +00:00
|
|
|
`);
|
|
|
|
|
2018-02-21 20:22:56 +00:00
|
|
|
projectImportGitlab();
|
2020-01-17 21:08:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
setTestFixtures(`?name=${projectName}&path=${pathName}`);
|
2017-08-07 10:09:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
window.history.pushState({}, null, '');
|
|
|
|
});
|
|
|
|
|
2020-01-17 21:08:29 +00:00
|
|
|
describe('project name', () => {
|
2017-08-07 10:09:50 +00:00
|
|
|
it('should fill in the project name derived from the previously filled project name', () => {
|
2020-01-17 21:08:29 +00:00
|
|
|
expect(document.querySelector('.js-project-name').value).toEqual(projectName);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('empty path name', () => {
|
|
|
|
it('derives the path name from the previously filled project name', () => {
|
|
|
|
const alternateProjectName = 'My Alt Project';
|
|
|
|
const alternatePathName = 'my-alt-project';
|
|
|
|
|
|
|
|
setTestFixtures(`?name=${alternateProjectName}`);
|
|
|
|
|
|
|
|
expect(document.querySelector('.js-path-name').value).toEqual(alternatePathName);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('path name', () => {
|
|
|
|
it('should fill in the path name derived from the previously filled path name', () => {
|
|
|
|
expect(document.querySelector('.js-path-name').value).toEqual(pathName);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('empty project name', () => {
|
|
|
|
it('derives the project name from the previously filled path name', () => {
|
|
|
|
const alternateProjectName = 'My Alt Project';
|
|
|
|
const alternatePathName = 'my-alt-project';
|
|
|
|
|
|
|
|
setTestFixtures(`?path=${alternatePathName}`);
|
|
|
|
|
|
|
|
expect(document.querySelector('.js-project-name').value).toEqual(alternateProjectName);
|
|
|
|
});
|
2017-08-07 10:09:50 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|