Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 21:09:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 21:09:28 +0300
commitce8a0b90849ac5d1895e741c023432930f24d724 (patch)
treedbdc97de542cdbe18a2fc8b1a6b64ac0673ed3d3 /spec/frontend/projects/project_import_gitlab_project_spec.js
parentdc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/projects/project_import_gitlab_project_spec.js')
-rw-r--r--spec/frontend/projects/project_import_gitlab_project_spec.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/frontend/projects/project_import_gitlab_project_spec.js b/spec/frontend/projects/project_import_gitlab_project_spec.js
new file mode 100644
index 00000000000..3c94934699d
--- /dev/null
+++ b/spec/frontend/projects/project_import_gitlab_project_spec.js
@@ -0,0 +1,59 @@
+import projectImportGitlab from '~/projects/project_import_gitlab_project';
+
+describe('Import Gitlab project', () => {
+ const pathName = 'my-project';
+ const projectName = 'My Project';
+
+ const setTestFixtures = url => {
+ window.history.pushState({}, null, url);
+
+ setFixtures(`
+ <input class="js-path-name" />
+ <input class="js-project-name" />
+ `);
+
+ projectImportGitlab();
+ };
+
+ beforeEach(() => {
+ setTestFixtures(`?name=${projectName}&path=${pathName}`);
+ });
+
+ afterEach(() => {
+ window.history.pushState({}, null, '');
+ });
+
+ describe('project name', () => {
+ it('should fill in the project name derived from the previously filled project name', () => {
+ 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);
+ });
+ });
+ });
+});