diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-07 09:09:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-07 09:09:06 +0000 |
commit | dc7cd84a3edeab2f799e3a99edf33bf2a381eee7 (patch) | |
tree | 44b902f672e6bdef2d8852d233b4046ce18320cf /spec/frontend/pages | |
parent | e28ed4a6b2aece29230c5dd0e08a0fd458663627 (diff) | |
download | gitlab-ce-dc7cd84a3edeab2f799e3a99edf33bf2a381eee7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pages')
-rw-r--r-- | spec/frontend/pages/projects/forks/new/components/fork_form_spec.js | 35 |
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 |