diff options
Diffstat (limited to 'spec/frontend/vue_shared/issuable/create')
-rw-r--r-- | spec/frontend/vue_shared/issuable/create/components/issuable_create_root_spec.js | 3 | ||||
-rw-r--r-- | spec/frontend/vue_shared/issuable/create/components/issuable_form_spec.js | 32 |
2 files changed, 28 insertions, 7 deletions
diff --git a/spec/frontend/vue_shared/issuable/create/components/issuable_create_root_spec.js b/spec/frontend/vue_shared/issuable/create/components/issuable_create_root_spec.js index 03f509a3fa3..35e3564c599 100644 --- a/spec/frontend/vue_shared/issuable/create/components/issuable_create_root_spec.js +++ b/spec/frontend/vue_shared/issuable/create/components/issuable_create_root_spec.js @@ -5,6 +5,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import IssuableCreateRoot from '~/vue_shared/issuable/create/components/issuable_create_root.vue'; import IssuableForm from '~/vue_shared/issuable/create/components/issuable_form.vue'; +import { TYPE_TEST_CASE } from '~/issues/constants'; Vue.use(VueApollo); @@ -13,6 +14,7 @@ const createComponent = ({ descriptionHelpPath = '/help/user/markdown', labelsFetchPath = '/gitlab-org/gitlab-shell/-/labels.json', labelsManagePath = '/gitlab-org/gitlab-shell/-/labels', + issuableType = TYPE_TEST_CASE, } = {}) => { return mount(IssuableCreateRoot, { propsData: { @@ -20,6 +22,7 @@ const createComponent = ({ descriptionHelpPath, labelsFetchPath, labelsManagePath, + issuableType, }, apolloProvider: createMockApollo(), slots: { diff --git a/spec/frontend/vue_shared/issuable/create/components/issuable_form_spec.js b/spec/frontend/vue_shared/issuable/create/components/issuable_form_spec.js index 62361705843..61185f913d9 100644 --- a/spec/frontend/vue_shared/issuable/create/components/issuable_form_spec.js +++ b/spec/frontend/vue_shared/issuable/create/components/issuable_form_spec.js @@ -1,9 +1,10 @@ -import { GlFormInput } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; +import { GlFormInput, GlFormGroup, GlFormCheckbox } from '@gitlab/ui'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import IssuableForm from '~/vue_shared/issuable/create/components/issuable_form.vue'; import MarkdownEditor from '~/vue_shared/components/markdown/markdown_editor.vue'; import LabelsSelect from '~/sidebar/components/labels/labels_select_vue/labels_select_root.vue'; +import { TYPE_TEST_CASE } from '~/issues/constants'; import { __ } from '~/locale'; const createComponent = ({ @@ -11,13 +12,15 @@ const createComponent = ({ descriptionHelpPath = '/help/user/markdown', labelsFetchPath = '/gitlab-org/gitlab-shell/-/labels.json', labelsManagePath = '/gitlab-org/gitlab-shell/-/labels', + issuableType = TYPE_TEST_CASE, } = {}) => { - return shallowMount(IssuableForm, { + return shallowMountExtended(IssuableForm, { propsData: { descriptionPreviewPath, descriptionHelpPath, labelsFetchPath, labelsManagePath, + issuableType, }, slots: { actions: ` @@ -58,7 +61,7 @@ describe('IssuableForm', () => { describe('template', () => { it('renders issuable title input field', () => { - const titleFieldEl = wrapper.find('[data-testid="issuable-title"]'); + const titleFieldEl = wrapper.findByTestId('issuable-title'); expect(titleFieldEl.exists()).toBe(true); expect(titleFieldEl.find('label').text()).toBe('Title'); @@ -68,7 +71,7 @@ describe('IssuableForm', () => { }); it('renders issuable description input field', () => { - const descriptionFieldEl = wrapper.find('[data-testid="issuable-description"]'); + const descriptionFieldEl = wrapper.findByTestId('issuable-description'); expect(descriptionFieldEl.exists()).toBe(true); expect(descriptionFieldEl.find('label').text()).toBe('Description'); @@ -88,8 +91,23 @@ describe('IssuableForm', () => { }); }); + it('renders issuable confidential checkbox', () => { + const confidentialCheckboxEl = wrapper.findByTestId('issuable-confidential'); + expect(confidentialCheckboxEl.exists()).toBe(true); + + expect(confidentialCheckboxEl.findComponent(GlFormGroup).exists()).toBe(true); + expect(confidentialCheckboxEl.findComponent(GlFormGroup).attributes('label')).toBe( + 'Confidentiality', + ); + + expect(confidentialCheckboxEl.findComponent(GlFormCheckbox).exists()).toBe(true); + expect(confidentialCheckboxEl.findComponent(GlFormCheckbox).text()).toBe( + 'This test case is confidential and should only be visible to team members with at least Reporter access.', + ); + }); + it('renders labels select field', () => { - const labelsSelectEl = wrapper.find('[data-testid="issuable-labels"]'); + const labelsSelectEl = wrapper.findByTestId('issuable-labels'); expect(labelsSelectEl.exists()).toBe(true); expect(labelsSelectEl.find('label').text()).toBe('Labels'); @@ -111,7 +129,7 @@ describe('IssuableForm', () => { it('renders contents for slot "actions"', () => { const buttonEl = wrapper - .find('[data-testid="issuable-create-actions"]') + .findByTestId('issuable-create-actions') .find('button.js-issuable-save'); expect(buttonEl.exists()).toBe(true); |