Commit e11d3642 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'incubation-5mp-service-account-checkbox' into 'master'

"Confirm checkbox" during Service Account creation

Changelog: changed

See merge request gitlab-org/gitlab!78875
parents 39f704cb 4c5fbdb8
<script>
import { GlButton, GlFormGroup, GlFormSelect } from '@gitlab/ui';
import { GlButton, GlFormGroup, GlFormSelect, GlFormCheckbox } from '@gitlab/ui';
import { __ } from '~/locale';
export default {
components: { GlButton, GlFormGroup, GlFormSelect },
components: { GlButton, GlFormGroup, GlFormSelect, GlFormCheckbox },
props: {
gcpProjects: { required: true, type: Array },
environments: { required: true, type: Array },
......@@ -19,6 +19,9 @@ export default {
environmentDescription: __('Generated service account is linked to the selected environment'),
submitLabel: __('Create service account'),
cancelLabel: __('Cancel'),
checkboxLabel: __(
'I understand the responsibilities involved with managing service account keys',
),
},
};
</script>
......@@ -59,6 +62,11 @@ export default {
</option>
</gl-form-select>
</gl-form-group>
<gl-form-group>
<gl-form-checkbox name="confirmation" required>
{{ $options.i18n.checkboxLabel }}
</gl-form-checkbox>
</gl-form-group>
<div class="form-actions row">
<gl-button type="submit" category="primary" variant="confirm">
......
......@@ -17799,6 +17799,9 @@ msgstr ""
msgid "I forgot my password"
msgstr ""
msgid "I understand the responsibilities involved with managing service account keys"
msgstr ""
msgid "I want to explore GitLab to see if it’s worth switching to"
msgstr ""
......
import { shallowMount } from '@vue/test-utils';
import { GlButton, GlFormGroup, GlFormSelect } from '@gitlab/ui';
import { GlButton, GlFormGroup, GlFormSelect, GlFormCheckbox } from '@gitlab/ui';
import ServiceAccountsForm from '~/google_cloud/components/service_accounts_form.vue';
describe('ServiceAccountsForm component', () => {
......@@ -9,11 +9,12 @@ describe('ServiceAccountsForm component', () => {
const findAllFormGroups = () => wrapper.findAllComponents(GlFormGroup);
const findAllFormSelects = () => wrapper.findAllComponents(GlFormSelect);
const findAllButtons = () => wrapper.findAllComponents(GlButton);
const findCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const propsData = { gcpProjects: [], environments: [], cancelPath: '#cancel-url' };
beforeEach(() => {
wrapper = shallowMount(ServiceAccountsForm, { propsData });
wrapper = shallowMount(ServiceAccountsForm, { propsData, stubs: { GlFormCheckbox } });
});
afterEach(() => {
......@@ -35,8 +36,8 @@ describe('ServiceAccountsForm component', () => {
});
it('contains Environments form group', () => {
const formGorup = findAllFormGroups().at(1);
expect(formGorup.exists()).toBe(true);
const formGroup = findAllFormGroups().at(1);
expect(formGroup.exists()).toBe(true);
});
it('contains Environments dropdown', () => {
......@@ -56,4 +57,14 @@ describe('ServiceAccountsForm component', () => {
expect(button.text()).toBe(ServiceAccountsForm.i18n.cancelLabel);
expect(button.attributes('href')).toBe('#cancel-url');
});
it('contains Confirmation checkbox', () => {
const checkbox = findCheckbox();
expect(checkbox.text()).toBe(ServiceAccountsForm.i18n.checkboxLabel);
});
it('checkbox must be required', () => {
const checkbox = findCheckbox();
expect(checkbox.attributes('required')).toBe('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