diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 12:07:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 12:07:59 +0300 |
commit | a325f3a104748ecc68df7c3d793940aa709a111f (patch) | |
tree | b3bce12be64ab2d9e31627dacd059165819797a3 /spec | |
parent | 8fb943c7df5f2b399caaeaebd6c00d0630bc763c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
5 files changed, 85 insertions, 72 deletions
diff --git a/spec/fixtures/lib/gitlab/import_export/group/project.json b/spec/fixtures/lib/gitlab/import_export/group/project.json index ce4fa1981ff..e8e1e53a86a 100644 --- a/spec/fixtures/lib/gitlab/import_export/group/project.json +++ b/spec/fixtures/lib/gitlab/import_export/group/project.json @@ -205,36 +205,40 @@ "iid": 1, "group_id": 100 }, - "epic": { - "id": 1, - "group_id": 5, - "author_id": 1, - "assignee_id": null, - "iid": 1, - "updated_by_id": null, - "last_edited_by_id": null, - "lock_version": 0, - "start_date": null, - "end_date": null, - "last_edited_at": null, - "created_at": "2019-12-08T19:37:07.098Z", - "updated_at": "2019-12-08T19:43:11.568Z", - "title": "An epic", - "description": null, - "start_date_sourcing_milestone_id": null, - "due_date_sourcing_milestone_id": null, - "start_date_fixed": null, - "due_date_fixed": null, - "start_date_is_fixed": null, - "due_date_is_fixed": null, - "closed_by_id": null, - "closed_at": null, - "parent_id": null, - "relative_position": null, - "state_id": "opened", - "start_date_sourcing_epic_id": null, - "due_date_sourcing_epic_id": null, - "milestone_id": null + "epic_issue": { + "id": 78, + "relative_position": 1073740323, + "epic": { + "id": 1, + "group_id": 5, + "author_id": 1, + "assignee_id": null, + "iid": 1, + "updated_by_id": null, + "last_edited_by_id": null, + "lock_version": 0, + "start_date": null, + "end_date": null, + "last_edited_at": null, + "created_at": "2019-12-08T19:37:07.098Z", + "updated_at": "2019-12-08T19:43:11.568Z", + "title": "An epic", + "description": null, + "start_date_sourcing_milestone_id": null, + "due_date_sourcing_milestone_id": null, + "start_date_fixed": null, + "due_date_fixed": null, + "start_date_is_fixed": null, + "due_date_is_fixed": null, + "closed_by_id": null, + "closed_at": null, + "parent_id": null, + "relative_position": null, + "state_id": "opened", + "start_date_sourcing_epic_id": null, + "due_date_sourcing_epic_id": null, + "milestone_id": null + } } } ], diff --git a/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js b/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js index 7389cb14ecb..53e670e76da 100644 --- a/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js +++ b/spec/frontend/boards/components/issue_card_inner_scoped_label_spec.js @@ -1,43 +1,40 @@ -import Vue from 'vue'; -import mountComponent from 'helpers/vue_mount_component_helper'; +import { GlLink } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import IssueCardInnerScopedLabel from '~/boards/components/issue_card_inner_scoped_label.vue'; describe('IssueCardInnerScopedLabel Component', () => { - let vm; - const Component = Vue.extend(IssueCardInnerScopedLabel); - const props = { - label: { title: 'Foo::Bar', description: 'Some Random Description' }, - labelStyle: { background: 'white', color: 'black' }, - scopedLabelsDocumentationLink: '/docs-link', - }; - const createComponent = () => mountComponent(Component, { ...props }); + let wrapper; beforeEach(() => { - vm = createComponent(); + wrapper = shallowMount(IssueCardInnerScopedLabel, { + propsData: { + label: { title: 'Foo::Bar', description: 'Some Random Description' }, + labelStyle: { background: 'white', color: 'black' }, + scopedLabelsDocumentationLink: '/docs-link', + }, + }); }); afterEach(() => { - vm.$destroy(); + wrapper.destroy(); }); it('should render label title', () => { - expect(vm.$el.querySelector('.color-label').textContent.trim()).toEqual('Foo::Bar'); + expect(wrapper.find('.color-label').text()).toBe('Foo::Bar'); }); it('should render question mark symbol', () => { - expect(vm.$el.querySelector('.fa-question-circle')).not.toBeNull(); + expect(wrapper.find('.fa-question-circle').exists()).toBe(true); }); it('should render label style provided', () => { - const node = vm.$el.querySelector('.color-label'); + const label = wrapper.find('.color-label'); - expect(node.style.background).toEqual(props.labelStyle.background); - expect(node.style.color).toEqual(props.labelStyle.color); + expect(label.attributes('style')).toContain('background: white;'); + expect(label.attributes('style')).toContain('color: black;'); }); it('should render the docs link', () => { - expect(vm.$el.querySelector('a.scoped-label').href).toContain( - props.scopedLabelsDocumentationLink, - ); + expect(wrapper.find(GlLink).attributes('href')).toBe('/docs-link'); }); }); diff --git a/spec/frontend/boards/components/issue_due_date_spec.js b/spec/frontend/boards/components/issue_due_date_spec.js index 8cb1d963851..880859287e1 100644 --- a/spec/frontend/boards/components/issue_due_date_spec.js +++ b/spec/frontend/boards/components/issue_due_date_spec.js @@ -1,72 +1,78 @@ -import Vue from 'vue'; +import { shallowMount } from '@vue/test-utils'; import dateFormat from 'dateformat'; import IssueDueDate from '~/boards/components/issue_due_date.vue'; -import mountComponent from '../../helpers/vue_mount_component_helper'; + +const createComponent = (dueDate = new Date(), closed = false) => + shallowMount(IssueDueDate, { + propsData: { + closed, + date: dateFormat(dueDate, 'yyyy-mm-dd', true), + }, + }); + +const findTime = wrapper => wrapper.find('time'); describe('Issue Due Date component', () => { - let vm; + let wrapper; let date; - const Component = Vue.extend(IssueDueDate); - const createComponent = (dueDate = new Date(), closed = false) => - mountComponent(Component, { closed, date: dateFormat(dueDate, 'yyyy-mm-dd', true) }); beforeEach(() => { date = new Date(); - vm = createComponent(); }); afterEach(() => { - vm.$destroy(); + wrapper.destroy(); }); it('should render "Today" if the due date is today', () => { - const timeContainer = vm.$el.querySelector('time'); + wrapper = createComponent(); - expect(timeContainer.textContent.trim()).toEqual('Today'); + expect(findTime(wrapper).text()).toBe('Today'); }); it('should render "Yesterday" if the due date is yesterday', () => { date.setDate(date.getDate() - 1); - vm = createComponent(date); + wrapper = createComponent(date); - expect(vm.$el.querySelector('time').textContent.trim()).toEqual('Yesterday'); + expect(findTime(wrapper).text()).toBe('Yesterday'); }); it('should render "Tomorrow" if the due date is one day from now', () => { date.setDate(date.getDate() + 1); - vm = createComponent(date); + wrapper = createComponent(date); - expect(vm.$el.querySelector('time').textContent.trim()).toEqual('Tomorrow'); + expect(findTime(wrapper).text()).toBe('Tomorrow'); }); it('should render day of the week if due date is one week away', () => { date.setDate(date.getDate() + 5); - vm = createComponent(date); + wrapper = createComponent(date); - expect(vm.$el.querySelector('time').textContent.trim()).toEqual(dateFormat(date, 'dddd')); + expect(findTime(wrapper).text()).toBe(dateFormat(date, 'dddd')); }); it('should render month and day for other dates', () => { date.setDate(date.getDate() + 17); - vm = createComponent(date); + wrapper = createComponent(date); const today = new Date(); const isDueInCurrentYear = today.getFullYear() === date.getFullYear(); const format = isDueInCurrentYear ? 'mmm d' : 'mmm d, yyyy'; - expect(vm.$el.querySelector('time').textContent.trim()).toEqual(dateFormat(date, format)); + expect(findTime(wrapper).text()).toBe(dateFormat(date, format)); }); it('should contain the correct `.text-danger` css class for overdue issue that is open', () => { date.setDate(date.getDate() - 17); - vm = createComponent(date); + wrapper = createComponent(date); - expect(vm.$el.querySelector('time').classList.contains('text-danger')).toEqual(true); + expect(findTime(wrapper).classes('text-danger')).toBe(true); }); it('should not contain the `.text-danger` css class for overdue issue that is closed', () => { date.setDate(date.getDate() - 17); - vm = createComponent(date, true); + const closed = true; + wrapper = createComponent(date, closed); - expect(vm.$el.querySelector('time').classList.contains('text-danger')).toEqual(false); + expect(findTime(wrapper).classes('text-danger')).toBe(false); }); }); diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index f6a3ade7f18..7740c34702b 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -609,3 +609,6 @@ epic: - events - resource_label_events - user_mentions +epic_issue: +- epic +- issue diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 1cd3071ac68..0b5fb7e4a9f 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -832,3 +832,6 @@ Epic: - start_date_sourcing_epic_id - due_date_sourcing_epic_id - health_status +EpicIssue: + - id + - relative_position |