Commit 1eb11771 authored by Coung Ngo's avatar Coung Ngo Committed by Jacques Erasmus

Add labels to UI toggles

Add labels to GlToggles with missing labels for accessibility
parent dbcd4ec7
<script> <script>
import { GlToggle } from '@gitlab/ui'; import { GlToggle } from '@gitlab/ui';
import AccessorUtilities from '~/lib/utils/accessor'; import AccessorUtilities from '~/lib/utils/accessor';
import { __ } from '~/locale';
import { disableShortcuts, enableShortcuts, shouldDisableShortcuts } from './shortcuts_toggle'; import { disableShortcuts, enableShortcuts, shouldDisableShortcuts } from './shortcuts_toggle';
export default { export default {
i18n: {
toggleLabel: __('Keyboard shortcuts'),
},
components: { components: {
GlToggle, GlToggle,
}, },
...@@ -31,7 +35,7 @@ export default { ...@@ -31,7 +35,7 @@ export default {
<gl-toggle <gl-toggle
v-model="shortcutsEnabled" v-model="shortcutsEnabled"
aria-describedby="shortcutsToggle" aria-describedby="shortcutsToggle"
label="Keyboard shortcuts" :label="$options.i18n.toggleLabel"
label-position="left" label-position="left"
@change="onChange" @change="onChange"
/> />
......
...@@ -29,6 +29,9 @@ import EnvironmentsDropdown from './environments_dropdown.vue'; ...@@ -29,6 +29,9 @@ import EnvironmentsDropdown from './environments_dropdown.vue';
import Strategy from './strategy.vue'; import Strategy from './strategy.vue';
export default { export default {
i18n: {
statusLabel: s__('FeatureFlags|Status'),
},
components: { components: {
GlButton, GlButton,
GlBadge, GlBadge,
...@@ -396,12 +399,14 @@ export default { ...@@ -396,12 +399,14 @@ export default {
<div class="table-section section-20 text-center" role="gridcell"> <div class="table-section section-20 text-center" role="gridcell">
<div class="table-mobile-header" role="rowheader"> <div class="table-mobile-header" role="rowheader">
{{ s__('FeatureFlags|Status') }} {{ $options.i18n.statusLabel }}
</div> </div>
<div class="table-mobile-content gl-display-flex gl-justify-content-center"> <div class="table-mobile-content gl-display-flex gl-justify-content-center">
<gl-toggle <gl-toggle
:value="scope.active" :value="scope.active"
:disabled="!active || !canUpdateScope(scope)" :disabled="!active || !canUpdateScope(scope)"
:label="$options.i18n.statusLabel"
label-position="hidden"
@change="(status) => (scope.active = status)" @change="(status) => (scope.active = status)"
/> />
</div> </div>
...@@ -529,11 +534,13 @@ export default { ...@@ -529,11 +534,13 @@ export default {
<div class="table-section section-20 text-center" role="gridcell"> <div class="table-section section-20 text-center" role="gridcell">
<div class="table-mobile-header" role="rowheader"> <div class="table-mobile-header" role="rowheader">
{{ s__('FeatureFlags|Status') }} {{ $options.i18n.statusLabel }}
</div> </div>
<div class="table-mobile-content gl-display-flex gl-justify-content-center"> <div class="table-mobile-content gl-display-flex gl-justify-content-center">
<gl-toggle <gl-toggle
:disabled="!active" :disabled="!active"
:label="$options.i18n.statusLabel"
label-position="hidden"
:value="false" :value="false"
@change="createNewScope({ active: true })" @change="createNewScope({ active: true })"
/> />
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { GlSprintf, GlToggle, GlFormGroup, GlFormInput } from '@gitlab/ui'; import { GlSprintf, GlToggle, GlFormGroup, GlFormInput } from '@gitlab/ui';
import { import {
MAVEN_TOGGLE_LABEL,
MAVEN_TITLE, MAVEN_TITLE,
MAVEN_SETTINGS_SUBTITLE, MAVEN_SETTINGS_SUBTITLE,
MAVEN_DUPLICATES_ALLOWED_DISABLED, MAVEN_DUPLICATES_ALLOWED_DISABLED,
...@@ -15,6 +16,7 @@ import { ...@@ -15,6 +16,7 @@ import {
export default { export default {
name: 'MavenSettings', name: 'MavenSettings',
i18n: { i18n: {
MAVEN_TOGGLE_LABEL,
MAVEN_TITLE, MAVEN_TITLE,
MAVEN_SETTINGS_SUBTITLE, MAVEN_SETTINGS_SUBTITLE,
MAVEN_SETTING_EXCEPTION_TITLE, MAVEN_SETTING_EXCEPTION_TITLE,
...@@ -80,6 +82,8 @@ export default { ...@@ -80,6 +82,8 @@ export default {
<div class="gl-display-flex"> <div class="gl-display-flex">
<gl-toggle <gl-toggle
data-qa-selector="allow_duplicates_toggle" data-qa-selector="allow_duplicates_toggle"
:label="$options.i18n.MAVEN_TOGGLE_LABEL"
label-position="hidden"
:value="mavenDuplicatesAllowed" :value="mavenDuplicatesAllowed"
@change="update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)" @change="update($options.modelNames.MAVEN_DUPLICATES_ALLOWED, $event)"
/> />
......
...@@ -8,6 +8,7 @@ export const PACKAGE_SETTINGS_DESCRIPTION = s__( ...@@ -8,6 +8,7 @@ export const PACKAGE_SETTINGS_DESCRIPTION = s__(
export const MAVEN_TITLE = s__('PackageRegistry|Maven'); export const MAVEN_TITLE = s__('PackageRegistry|Maven');
export const MAVEN_SETTINGS_SUBTITLE = s__('PackageRegistry|Settings for Maven packages'); export const MAVEN_SETTINGS_SUBTITLE = s__('PackageRegistry|Settings for Maven packages');
export const MAVEN_TOGGLE_LABEL = s__('PackageRegistry|Allow duplicates');
export const MAVEN_DUPLICATES_ALLOWED_DISABLED = s__( export const MAVEN_DUPLICATES_ALLOWED_DISABLED = s__(
'PackageRegistry|%{boldStart}Do not allow duplicates%{boldEnd} - Packages with the same name and version are rejected.', 'PackageRegistry|%{boldStart}Do not allow duplicates%{boldEnd} - Packages with the same name and version are rejected.',
); );
......
...@@ -12,6 +12,11 @@ export default { ...@@ -12,6 +12,11 @@ export default {
event: 'change', event: 'change',
}, },
props: { props: {
label: {
type: String,
required: false,
default: '',
},
name: { name: {
type: String, type: String,
required: false, required: false,
...@@ -82,6 +87,8 @@ export default { ...@@ -82,6 +87,8 @@ export default {
class="gl-mr-3" class="gl-mr-3"
:value="featureEnabled" :value="featureEnabled"
:disabled="disabledInput" :disabled="disabledInput"
:label="label"
label-position="hidden"
@change="toggleFeature" @change="toggleFeature"
/> />
<div class="select-wrapper gl-flex-fill-1"> <div class="select-wrapper gl-flex-fill-1">
......
...@@ -22,6 +22,21 @@ const PAGE_FEATURE_ACCESS_LEVEL = s__('ProjectSettings|Everyone'); ...@@ -22,6 +22,21 @@ const PAGE_FEATURE_ACCESS_LEVEL = s__('ProjectSettings|Everyone');
export default { export default {
i18n: { i18n: {
...CVE_ID_REQUEST_BUTTON_I18N, ...CVE_ID_REQUEST_BUTTON_I18N,
analyticsLabel: s__('ProjectSettings|Analytics'),
containerRegistryLabel: s__('ProjectSettings|Container registry'),
forksLabel: s__('ProjectSettings|Forks'),
issuesLabel: s__('ProjectSettings|Issues'),
lfsLabel: s__('ProjectSettings|Git Large File Storage (LFS)'),
mergeRequestsLabel: s__('ProjectSettings|Merge requests'),
operationsLabel: s__('ProjectSettings|Operations'),
packagesLabel: s__('ProjectSettings|Packages'),
pagesLabel: s__('ProjectSettings|Pages'),
ciCdLabel: s__('CI/CD'),
repositoryLabel: s__('ProjectSettings|Repository'),
requirementsLabel: s__('ProjectSettings|Requirements'),
securityAndComplianceLabel: s__('ProjectSettings|Security & Compliance'),
snippetsLabel: s__('ProjectSettings|Snippets'),
wikiLabel: s__('ProjectSettings|Wiki'),
}, },
components: { components: {
...@@ -423,11 +438,12 @@ export default { ...@@ -423,11 +438,12 @@ export default {
> >
<project-setting-row <project-setting-row
ref="issues-settings" ref="issues-settings"
:label="s__('ProjectSettings|Issues')" :label="$options.i18n.issuesLabel"
:help-text="s__('ProjectSettings|Lightweight issue tracking system.')" :help-text="s__('ProjectSettings|Lightweight issue tracking system.')"
> >
<project-feature-setting <project-feature-setting
v-model="issuesAccessLevel" v-model="issuesAccessLevel"
:label="$options.i18n.issuesLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][issues_access_level]" name="project[project_feature_attributes][issues_access_level]"
/> />
...@@ -440,6 +456,8 @@ export default { ...@@ -440,6 +456,8 @@ export default {
v-model="cveIdRequestEnabled" v-model="cveIdRequestEnabled"
class="gl-my-2" class="gl-my-2"
:disabled="cveIdRequestIsDisabled" :disabled="cveIdRequestIsDisabled"
:label="$options.i18n.cve_request_toggle_label"
label-position="hidden"
name="project[project_setting_attributes][cve_id_request_enabled]" name="project[project_setting_attributes][cve_id_request_enabled]"
data-testid="cve_id_request_toggle" data-testid="cve_id_request_toggle"
/> />
...@@ -447,11 +465,12 @@ export default { ...@@ -447,11 +465,12 @@ export default {
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="repository-settings" ref="repository-settings"
:label="s__('ProjectSettings|Repository')" :label="$options.i18n.repositoryLabel"
:help-text="repositoryHelpText" :help-text="repositoryHelpText"
> >
<project-feature-setting <project-feature-setting
v-model="repositoryAccessLevel" v-model="repositoryAccessLevel"
:label="$options.i18n.repositoryLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][repository_access_level]" name="project[project_feature_attributes][repository_access_level]"
/> />
...@@ -459,11 +478,12 @@ export default { ...@@ -459,11 +478,12 @@ export default {
<div class="project-feature-setting-group gl-pl-7 gl-sm-pl-5"> <div class="project-feature-setting-group gl-pl-7 gl-sm-pl-5">
<project-setting-row <project-setting-row
ref="merge-request-settings" ref="merge-request-settings"
:label="s__('ProjectSettings|Merge requests')" :label="$options.i18n.mergeRequestsLabel"
:help-text="s__('ProjectSettings|Submit changes to be merged upstream.')" :help-text="s__('ProjectSettings|Submit changes to be merged upstream.')"
> >
<project-feature-setting <project-feature-setting
v-model="mergeRequestsAccessLevel" v-model="mergeRequestsAccessLevel"
:label="$options.i18n.mergeRequestsLabel"
:options="repoFeatureAccessLevelOptions" :options="repoFeatureAccessLevelOptions"
:disabled-input="!repositoryEnabled" :disabled-input="!repositoryEnabled"
name="project[project_feature_attributes][merge_requests_access_level]" name="project[project_feature_attributes][merge_requests_access_level]"
...@@ -471,11 +491,12 @@ export default { ...@@ -471,11 +491,12 @@ export default {
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="fork-settings" ref="fork-settings"
:label="s__('ProjectSettings|Forks')" :label="$options.i18n.forksLabel"
:help-text="s__('ProjectSettings|Users can copy the repository to a new project.')" :help-text="s__('ProjectSettings|Users can copy the repository to a new project.')"
> >
<project-feature-setting <project-feature-setting
v-model="forkingAccessLevel" v-model="forkingAccessLevel"
:label="$options.i18n.forksLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
:disabled-input="!repositoryEnabled" :disabled-input="!repositoryEnabled"
name="project[project_feature_attributes][forking_access_level]" name="project[project_feature_attributes][forking_access_level]"
...@@ -485,7 +506,7 @@ export default { ...@@ -485,7 +506,7 @@ export default {
v-if="registryAvailable" v-if="registryAvailable"
ref="container-registry-settings" ref="container-registry-settings"
:help-path="registryHelpPath" :help-path="registryHelpPath"
:label="s__('ProjectSettings|Container registry')" :label="$options.i18n.containerRegistryLabel"
:help-text=" :help-text="
s__('ProjectSettings|Every project can have its own space to store its Docker images') s__('ProjectSettings|Every project can have its own space to store its Docker images')
" "
...@@ -501,6 +522,8 @@ export default { ...@@ -501,6 +522,8 @@ export default {
v-model="containerRegistryEnabled" v-model="containerRegistryEnabled"
class="gl-my-2" class="gl-my-2"
:disabled="!repositoryEnabled" :disabled="!repositoryEnabled"
:label="$options.i18n.containerRegistryLabel"
label-position="hidden"
name="project[container_registry_enabled]" name="project[container_registry_enabled]"
/> />
</project-setting-row> </project-setting-row>
...@@ -508,7 +531,7 @@ export default { ...@@ -508,7 +531,7 @@ export default {
v-if="lfsAvailable" v-if="lfsAvailable"
ref="git-lfs-settings" ref="git-lfs-settings"
:help-path="lfsHelpPath" :help-path="lfsHelpPath"
:label="s__('ProjectSettings|Git Large File Storage (LFS)')" :label="$options.i18n.lfsLabel"
:help-text=" :help-text="
s__('ProjectSettings|Manages large files such as audio, video, and graphics files.') s__('ProjectSettings|Manages large files such as audio, video, and graphics files.')
" "
...@@ -517,6 +540,8 @@ export default { ...@@ -517,6 +540,8 @@ export default {
v-model="lfsEnabled" v-model="lfsEnabled"
class="gl-my-2" class="gl-my-2"
:disabled="!repositoryEnabled" :disabled="!repositoryEnabled"
:label="$options.i18n.lfsLabel"
label-position="hidden"
name="project[lfs_enabled]" name="project[lfs_enabled]"
/> />
<p v-if="!lfsEnabled && lfsObjectsExist"> <p v-if="!lfsEnabled && lfsObjectsExist">
...@@ -541,7 +566,7 @@ export default { ...@@ -541,7 +566,7 @@ export default {
v-if="packagesAvailable" v-if="packagesAvailable"
ref="package-settings" ref="package-settings"
:help-path="packagesHelpPath" :help-path="packagesHelpPath"
:label="s__('ProjectSettings|Packages')" :label="$options.i18n.packagesLabel"
:help-text=" :help-text="
s__('ProjectSettings|Every project can have its own space to store its packages.') s__('ProjectSettings|Every project can have its own space to store its packages.')
" "
...@@ -550,17 +575,20 @@ export default { ...@@ -550,17 +575,20 @@ export default {
v-model="packagesEnabled" v-model="packagesEnabled"
class="gl-my-2" class="gl-my-2"
:disabled="!repositoryEnabled" :disabled="!repositoryEnabled"
:label="$options.i18n.packagesLabel"
label-position="hidden"
name="project[packages_enabled]" name="project[packages_enabled]"
/> />
</project-setting-row> </project-setting-row>
</div> </div>
<project-setting-row <project-setting-row
ref="pipeline-settings" ref="pipeline-settings"
:label="__('CI/CD')" :label="$options.i18n.ciCdLabel"
:help-text="s__('ProjectSettings|Build, test, and deploy your changes.')" :help-text="s__('ProjectSettings|Build, test, and deploy your changes.')"
> >
<project-feature-setting <project-feature-setting
v-model="buildsAccessLevel" v-model="buildsAccessLevel"
:label="$options.i18n.ciCdLabel"
:options="repoFeatureAccessLevelOptions" :options="repoFeatureAccessLevelOptions"
:disabled-input="!repositoryEnabled" :disabled-input="!repositoryEnabled"
name="project[project_feature_attributes][builds_access_level]" name="project[project_feature_attributes][builds_access_level]"
...@@ -568,11 +596,12 @@ export default { ...@@ -568,11 +596,12 @@ export default {
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="analytics-settings" ref="analytics-settings"
:label="s__('ProjectSettings|Analytics')" :label="$options.i18n.analyticsLabel"
:help-text="s__('ProjectSettings|View project analytics.')" :help-text="s__('ProjectSettings|View project analytics.')"
> >
<project-feature-setting <project-feature-setting
v-model="analyticsAccessLevel" v-model="analyticsAccessLevel"
:label="$options.i18n.analyticsLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][analytics_access_level]" name="project[project_feature_attributes][analytics_access_level]"
/> />
...@@ -580,43 +609,47 @@ export default { ...@@ -580,43 +609,47 @@ export default {
<project-setting-row <project-setting-row
v-if="requirementsAvailable" v-if="requirementsAvailable"
ref="requirements-settings" ref="requirements-settings"
:label="s__('ProjectSettings|Requirements')" :label="$options.i18n.requirementsLabel"
:help-text="s__('ProjectSettings|Requirements management system.')" :help-text="s__('ProjectSettings|Requirements management system.')"
> >
<project-feature-setting <project-feature-setting
v-model="requirementsAccessLevel" v-model="requirementsAccessLevel"
:label="$options.i18n.requirementsLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][requirements_access_level]" name="project[project_feature_attributes][requirements_access_level]"
/> />
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
:label="s__('ProjectSettings|Security & Compliance')" :label="$options.i18n.securityAndComplianceLabel"
:help-text="s__('ProjectSettings|Security & Compliance for this project')" :help-text="s__('ProjectSettings|Security & Compliance for this project')"
> >
<project-feature-setting <project-feature-setting
v-model="securityAndComplianceAccessLevel" v-model="securityAndComplianceAccessLevel"
:label="$options.i18n.securityAndComplianceLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][security_and_compliance_access_level]" name="project[project_feature_attributes][security_and_compliance_access_level]"
/> />
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="wiki-settings" ref="wiki-settings"
:label="s__('ProjectSettings|Wiki')" :label="$options.i18n.wikiLabel"
:help-text="s__('ProjectSettings|Pages for project documentation.')" :help-text="s__('ProjectSettings|Pages for project documentation.')"
> >
<project-feature-setting <project-feature-setting
v-model="wikiAccessLevel" v-model="wikiAccessLevel"
:label="$options.i18n.wikiLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][wiki_access_level]" name="project[project_feature_attributes][wiki_access_level]"
/> />
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="snippet-settings" ref="snippet-settings"
:label="s__('ProjectSettings|Snippets')" :label="$options.i18n.snippetsLabel"
:help-text="s__('ProjectSettings|Share code with others outside the project.')" :help-text="s__('ProjectSettings|Share code with others outside the project.')"
> >
<project-feature-setting <project-feature-setting
v-model="snippetsAccessLevel" v-model="snippetsAccessLevel"
:label="$options.i18n.snippetsLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][snippets_access_level]" name="project[project_feature_attributes][snippets_access_level]"
/> />
...@@ -625,26 +658,28 @@ export default { ...@@ -625,26 +658,28 @@ export default {
v-if="pagesAvailable && pagesAccessControlEnabled" v-if="pagesAvailable && pagesAccessControlEnabled"
ref="pages-settings" ref="pages-settings"
:help-path="pagesHelpPath" :help-path="pagesHelpPath"
:label="s__('ProjectSettings|Pages')" :label="$options.i18n.pagesLabel"
:help-text=" :help-text="
s__('ProjectSettings|With GitLab Pages you can host your static websites on GitLab.') s__('ProjectSettings|With GitLab Pages you can host your static websites on GitLab.')
" "
> >
<project-feature-setting <project-feature-setting
v-model="pagesAccessLevel" v-model="pagesAccessLevel"
:label="$options.i18n.pagesLabel"
:options="pagesFeatureAccessLevelOptions" :options="pagesFeatureAccessLevelOptions"
name="project[project_feature_attributes][pages_access_level]" name="project[project_feature_attributes][pages_access_level]"
/> />
</project-setting-row> </project-setting-row>
<project-setting-row <project-setting-row
ref="operations-settings" ref="operations-settings"
:label="s__('ProjectSettings|Operations')" :label="$options.i18n.operationsLabel"
:help-text=" :help-text="
s__('ProjectSettings|Configure your project resources and monitor their health.') s__('ProjectSettings|Configure your project resources and monitor their health.')
" "
> >
<project-feature-setting <project-feature-setting
v-model="operationsAccessLevel" v-model="operationsAccessLevel"
:label="$options.i18n.operationsLabel"
:options="featureAccessLevelOptions" :options="featureAccessLevelOptions"
name="project[project_feature_attributes][operations_access_level]" name="project[project_feature_attributes][operations_access_level]"
/> />
......
---
title: Add labels to UI toggles
merge_request: 56848
author:
type: fixed
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
target="_blank" target="_blank"
class="gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-500" class="gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-500"
> >
<gl-icon name="question" :size="12" role="text" /> <gl-icon name="question" :size="12" />
</gl-link> </gl-link>
<span <span
class="gl-display-inline-flex gl-align-items-center gl-ml-4" class="gl-display-inline-flex gl-align-items-center gl-ml-4"
......
...@@ -21775,6 +21775,9 @@ msgstr "" ...@@ -21775,6 +21775,9 @@ msgstr ""
msgid "PackageRegistry|Add composer registry" msgid "PackageRegistry|Add composer registry"
msgstr "" msgstr ""
msgid "PackageRegistry|Allow duplicates"
msgstr ""
msgid "PackageRegistry|An error occurred while saving the settings" msgid "PackageRegistry|An error occurred while saving the settings"
msgstr "" msgstr ""
......
...@@ -123,6 +123,10 @@ describe('feature flag form', () => { ...@@ -123,6 +123,10 @@ describe('feature flag form', () => {
}); });
}); });
it('has label', () => {
expect(findGlToggle().props('label')).toBe(Form.i18n.statusLabel);
});
it('should be disabled if the feature flag is not active', (done) => { it('should be disabled if the feature flag is not active', (done) => {
wrapper.setProps({ active: false }); wrapper.setProps({ active: false });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -59,7 +59,10 @@ describe('Maven Settings', () => { ...@@ -59,7 +59,10 @@ describe('Maven Settings', () => {
mountComponent(); mountComponent();
expect(findToggle().exists()).toBe(true); expect(findToggle().exists()).toBe(true);
expect(findToggle().props('value')).toBe(defaultProps.mavenDuplicatesAllowed); expect(findToggle().props()).toMatchObject({
label: component.i18n.MAVEN_TOGGLE_LABEL,
value: defaultProps.mavenDuplicatesAllowed,
});
}); });
it('toggle emits an update event', () => { it('toggle emits an update event', () => {
......
...@@ -46,6 +46,7 @@ const defaultProps = { ...@@ -46,6 +46,7 @@ const defaultProps = {
pagesHelpPath: '/help/user/project/pages/introduction#gitlab-pages-access-control', pagesHelpPath: '/help/user/project/pages/introduction#gitlab-pages-access-control',
packagesAvailable: false, packagesAvailable: false,
packagesHelpPath: '/help/user/packages/index', packagesHelpPath: '/help/user/packages/index',
requestCveAvailable: true,
}; };
describe('Settings Panel', () => { describe('Settings Panel', () => {
...@@ -76,6 +77,7 @@ describe('Settings Panel', () => { ...@@ -76,6 +77,7 @@ describe('Settings Panel', () => {
const findRepositoryFeatureSetting = () => const findRepositoryFeatureSetting = () =>
findRepositoryFeatureProjectRow().find(projectFeatureSetting); findRepositoryFeatureProjectRow().find(projectFeatureSetting);
const findProjectVisibilitySettings = () => wrapper.find({ ref: 'project-visibility-settings' }); const findProjectVisibilitySettings = () => wrapper.find({ ref: 'project-visibility-settings' });
const findIssuesSettingsRow = () => wrapper.find({ ref: 'issues-settings' });
const findAnalyticsRow = () => wrapper.find({ ref: 'analytics-settings' }); const findAnalyticsRow = () => wrapper.find({ ref: 'analytics-settings' });
const findProjectVisibilityLevelInput = () => wrapper.find('[name="project[visibility_level]"]'); const findProjectVisibilityLevelInput = () => wrapper.find('[name="project[visibility_level]"]');
const findRequestAccessEnabledInput = () => const findRequestAccessEnabledInput = () =>
...@@ -174,6 +176,16 @@ describe('Settings Panel', () => { ...@@ -174,6 +176,16 @@ describe('Settings Panel', () => {
}); });
}); });
describe('Issues settings', () => {
it('has label for CVE request toggle', () => {
wrapper = mountComponent();
expect(findIssuesSettingsRow().findComponent(GlToggle).props('label')).toBe(
settingsPanel.i18n.cve_request_toggle_label,
);
});
});
describe('Repository', () => { describe('Repository', () => {
it('should set the repository help text when the visibility level is set to private', () => { it('should set the repository help text when the visibility level is set to private', () => {
wrapper = mountComponent({ currentSettings: { visibilityLevel: visibilityOptions.PRIVATE } }); wrapper = mountComponent({ currentSettings: { visibilityLevel: visibilityOptions.PRIVATE } });
...@@ -304,6 +316,17 @@ describe('Settings Panel', () => { ...@@ -304,6 +316,17 @@ describe('Settings Panel', () => {
expect(findContainerRegistryEnabledInput().props('disabled')).toBe(true); expect(findContainerRegistryEnabledInput().props('disabled')).toBe(true);
}); });
it('has label for the toggle', () => {
wrapper = mountComponent({
currentSettings: { visibilityLevel: visibilityOptions.PUBLIC },
registryAvailable: true,
});
expect(findContainerRegistrySettings().findComponent(GlToggle).props('label')).toBe(
settingsPanel.i18n.containerRegistryLabel,
);
});
}); });
describe('Git Large File Storage', () => { describe('Git Large File Storage', () => {
...@@ -342,6 +365,15 @@ describe('Settings Panel', () => { ...@@ -342,6 +365,15 @@ describe('Settings Panel', () => {
expect(findLFSFeatureToggle().props('disabled')).toBe(true); expect(findLFSFeatureToggle().props('disabled')).toBe(true);
}); });
it('has label for toggle', () => {
wrapper = mountComponent({
currentSettings: { repositoryAccessLevel: featureAccessLevel.EVERYONE },
lfsAvailable: true,
});
expect(findLFSFeatureToggle().props('label')).toBe(settingsPanel.i18n.lfsLabel);
});
it('should not change lfsEnabled when disabling the repository', async () => { it('should not change lfsEnabled when disabling the repository', async () => {
// mount over shallowMount, because we are aiming to test rendered state of toggle // mount over shallowMount, because we are aiming to test rendered state of toggle
wrapper = mountComponent({ currentSettings: { lfsEnabled: true } }, mount); wrapper = mountComponent({ currentSettings: { lfsEnabled: true } }, mount);
...@@ -432,6 +464,17 @@ describe('Settings Panel', () => { ...@@ -432,6 +464,17 @@ describe('Settings Panel', () => {
expect(findPackagesEnabledInput().props('disabled')).toBe(true); expect(findPackagesEnabledInput().props('disabled')).toBe(true);
}); });
it('has label for toggle', () => {
wrapper = mountComponent({
currentSettings: { repositoryAccessLevel: featureAccessLevel.EVERYONE },
packagesAvailable: true,
});
expect(findPackagesEnabledInput().findComponent(GlToggle).props('label')).toBe(
settingsPanel.i18n.packagesLabel,
);
});
}); });
describe('Pages', () => { describe('Pages', () => {
......
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