Commit 77783617 authored by Samantha Ming's avatar Samantha Ming

Add spec to cover correct visibility description

parent df255ca2
...@@ -142,7 +142,9 @@ export default { ...@@ -142,7 +142,9 @@ export default {
text: s__('ForkProject|Private'), text: s__('ForkProject|Private'),
value: PRIVATE_VISIBILITY, value: PRIVATE_VISIBILITY,
icon: 'lock', icon: 'lock',
help: s__('ForkProject|Project access must be granted explicitly to each user. If this project is part of a group, access will be granted to members of the group.'), help: s__(
'ForkProject|Project access must be granted explicitly to each user. If this project is part of a group, access will be granted to members of the group.',
),
disabled: this.isVisibilityLevelDisabled(PRIVATE_VISIBILITY), disabled: this.isVisibilityLevelDisabled(PRIVATE_VISIBILITY),
}, },
{ {
...@@ -156,9 +158,7 @@ export default { ...@@ -156,9 +158,7 @@ export default {
text: s__('ForkProject|Public'), text: s__('ForkProject|Public'),
value: PUBLIC_VISIBILITY, value: PUBLIC_VISIBILITY,
icon: 'earth', icon: 'earth',
help: s__( help: s__('ForkProject|The project can be accessed without any authentication.'),
'ForkProject|The project can be accessed without any authentication.',
),
disabled: this.isVisibilityLevelDisabled(PUBLIC_VISIBILITY), disabled: this.isVisibilityLevelDisabled(PUBLIC_VISIBILITY),
}, },
]; ];
......
import { GlFormInputGroup, GlFormInput, GlForm } from '@gitlab/ui'; import { GlFormInputGroup, GlFormInput, GlForm, GlFormRadio } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
...@@ -15,6 +15,13 @@ describe('ForkForm component', () => { ...@@ -15,6 +15,13 @@ describe('ForkForm component', () => {
let wrapper; let wrapper;
let axiosMock; let axiosMock;
const PROJECT_VISIBILITY_TYPE = {
private:
'Private Project access must be granted explicitly to each user. If this project is part of a group, access will be granted to members of the group.',
internal: 'Internal The project can be accessed by any logged in user.',
public: 'Public The project can be accessed without any authentication.',
};
const GON_GITLAB_URL = 'https://gitlab.com'; const GON_GITLAB_URL = 'https://gitlab.com';
const GON_API_VERSION = 'v7'; const GON_API_VERSION = 'v7';
...@@ -61,6 +68,7 @@ describe('ForkForm component', () => { ...@@ -61,6 +68,7 @@ describe('ForkForm component', () => {
stubs: { stubs: {
GlFormInputGroup, GlFormInputGroup,
GlFormInput, GlFormInput,
GlFormRadio,
}, },
}); });
}; };
...@@ -203,6 +211,24 @@ describe('ForkForm component', () => { ...@@ -203,6 +211,24 @@ describe('ForkForm component', () => {
}); });
describe('visibility level', () => { describe('visibility level', () => {
it('displays the correct description', () => {
mockGetRequest();
createComponent();
const formRadios = wrapper.findAll(GlFormRadio);
Object.keys(PROJECT_VISIBILITY_TYPE).forEach((visibilityType, index) => {
expect(formRadios.at(index).text()).toBe(PROJECT_VISIBILITY_TYPE[visibilityType]);
});
});
it('displays all 3 visibility levels', () => {
mockGetRequest();
createComponent();
expect(wrapper.findAll(GlFormRadio)).toHaveLength(3);
});
it.each` it.each`
project | namespace | privateIsDisabled | internalIsDisabled | publicIsDisabled project | namespace | privateIsDisabled | internalIsDisabled | publicIsDisabled
${'private'} | ${'private'} | ${undefined} | ${'true'} | ${'true'} ${'private'} | ${'private'} | ${undefined} | ${'true'} | ${'true'}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment