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:
Diffstat (limited to 'spec/frontend/pages/projects/forks/new/components/fork_form_spec.js')
-rw-r--r--spec/frontend/pages/projects/forks/new/components/fork_form_spec.js35
1 files changed, 34 insertions, 1 deletions
diff --git a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js
index 694a0c2b9c1..2992c7f0624 100644
--- a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js
+++ b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js
@@ -1,7 +1,8 @@
-import { GlForm, GlFormInputGroup } from '@gitlab/ui';
+import { GlForm, GlFormInputGroup, GlFormInput } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import axios from 'axios';
import AxiosMockAdapter from 'axios-mock-adapter';
+import { kebabCase } from 'lodash';
import createFlash from '~/flash';
import httpStatus from '~/lib/utils/http_status';
import * as urlUtility from '~/lib/utils/url_utility';
@@ -59,6 +60,7 @@ describe('ForkForm component', () => {
},
stubs: {
GlFormInputGroup,
+ GlFormInput,
},
});
};
@@ -204,6 +206,37 @@ describe('ForkForm component', () => {
});
});
+ describe('project slug', () => {
+ const projectPath = 'some other project slug';
+
+ beforeEach(() => {
+ mockGetRequest();
+ createComponent({
+ projectPath,
+ });
+ });
+
+ it('initially loads slug without kebab-case transformation', () => {
+ expect(findForkSlugInput().attributes('value')).toBe(projectPath);
+ });
+
+ it('changes to kebab case when project name changes', async () => {
+ const newInput = `${projectPath}1`;
+ findForkNameInput().vm.$emit('input', newInput);
+ await wrapper.vm.$nextTick();
+
+ expect(findForkSlugInput().attributes('value')).toBe(kebabCase(newInput));
+ });
+
+ it('does not change to kebab case when project slug is changed manually', async () => {
+ const newInput = `${projectPath}1`;
+ findForkSlugInput().vm.$emit('input', newInput);
+ await wrapper.vm.$nextTick();
+
+ expect(findForkSlugInput().attributes('value')).toBe(newInput);
+ });
+ });
+
describe('visibility level', () => {
it.each`
project | namespace | privateIsDisabled | internalIsDisabled | publicIsDisabled