Commit 4c5fbdb8 authored by Sri's avatar Sri

Confirm checkbox for Service Account creation

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