Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-26 21:10:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-26 21:10:52 +0300
commit4c47bc5ec6420ab3a4ef629010e89de45b2776b9 (patch)
tree941f43a86f23dc601a0778571a36f53dfb4c44c6 /spec/frontend/integrations
parentede9464fd957582e4e0232f70113942b08ddfe78 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/integrations')
-rw-r--r--spec/frontend/integrations/edit/components/jira_issues_fields_spec.js47
1 files changed, 31 insertions, 16 deletions
diff --git a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
index f121a148f27..9cc041490d0 100644
--- a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
+++ b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
@@ -3,8 +3,10 @@ import { mount } from '@vue/test-utils';
import JiraIssuesFields from '~/integrations/edit/components/jira_issues_fields.vue';
import JiraUpgradeCta from '~/integrations/edit/components/jira_upgrade_cta.vue';
import eventHub from '~/integrations/edit/event_hub';
+import { createStore } from '~/integrations/edit/store';
describe('JiraIssuesFields', () => {
+ let store;
let wrapper;
const defaultProps = {
@@ -13,22 +15,26 @@ describe('JiraIssuesFields', () => {
showJiraVulnerabilitiesIntegration: true,
};
- const createComponent = ({ props, ...options } = {}) => {
+ const createComponent = ({ isInheriting = false, props, ...options } = {}) => {
+ store = createStore({
+ defaultState: isInheriting ? {} : undefined,
+ });
+
wrapper = mount(JiraIssuesFields, {
propsData: { ...defaultProps, ...props },
+ store,
stubs: ['jira-issue-creation-vulnerabilities'],
...options,
});
};
afterEach(() => {
- if (wrapper) {
- wrapper.destroy();
- wrapper = null;
- }
+ wrapper.destroy();
});
const findEnableCheckbox = () => wrapper.findComponent(GlFormCheckbox);
+ const findEnableCheckboxDisabled = () =>
+ findEnableCheckbox().find('[type=checkbox]').attributes('disabled');
const findProjectKey = () => wrapper.findComponent(GlFormInput);
const findJiraUpgradeCta = () => wrapper.findComponent(JiraUpgradeCta);
const findJiraForVulnerabilities = () => wrapper.find('[data-testid="jira-for-vulnerabilities"]');
@@ -79,6 +85,19 @@ describe('JiraIssuesFields', () => {
createComponent({ props: { initialProjectKey: '' } });
});
+ it('renders enabled checkbox', () => {
+ expect(findEnableCheckbox().exists()).toBe(true);
+ expect(findEnableCheckboxDisabled()).toBeUndefined();
+ });
+
+ it('renders disabled project_key input', () => {
+ const projectKey = findProjectKey();
+
+ expect(projectKey.exists()).toBe(true);
+ expect(projectKey.attributes('disabled')).toBe('disabled');
+ expect(projectKey.attributes('required')).toBeUndefined();
+ });
+
it('does not show upgrade banner', () => {
expect(findJiraUpgradeCta().exists()).toBe(false);
});
@@ -89,24 +108,20 @@ describe('JiraIssuesFields', () => {
expect(wrapper.find('input[name="service[issues_enabled]"]').exists()).toBe(true);
});
- it('disables project_key input', () => {
- expect(findProjectKey().attributes('disabled')).toBe('disabled');
- });
+ describe('when isInheriting = true', () => {
+ it('disables checkbox and sets input as readonly', () => {
+ createComponent({ isInheriting: true });
- it('does not require project_key', () => {
- expect(findProjectKey().attributes('required')).toBeUndefined();
+ expect(findEnableCheckboxDisabled()).toBe('disabled');
+ expect(findProjectKey().attributes('readonly')).toBe('readonly');
+ });
});
describe('on enable issues', () => {
- it('enables project_key input', async () => {
+ it('enables project_key input as required', async () => {
await setEnableCheckbox(true);
expect(findProjectKey().attributes('disabled')).toBeUndefined();
- });
-
- it('requires project_key input', async () => {
- await setEnableCheckbox(true);
-
expect(findProjectKey().attributes('required')).toBe('required');
});
});