diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 12:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 12:08:56 +0300 |
commit | b4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (patch) | |
tree | 6694fa9d8f3e226597cc01dfb8e3e07b50ae85b6 /spec/javascripts/boards | |
parent | 2aaef94c80937d9d188f7b9cbbad2dcd1508c3c1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/boards')
-rw-r--r-- | spec/javascripts/boards/components/issue_card_inner_scoped_label_spec.js | 43 | ||||
-rw-r--r-- | spec/javascripts/boards/components/issue_due_date_spec.js | 65 |
2 files changed, 0 insertions, 108 deletions
diff --git a/spec/javascripts/boards/components/issue_card_inner_scoped_label_spec.js b/spec/javascripts/boards/components/issue_card_inner_scoped_label_spec.js deleted file mode 100644 index 6ac51ebdb2d..00000000000 --- a/spec/javascripts/boards/components/issue_card_inner_scoped_label_spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import Vue from 'vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -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 }); - - beforeEach(() => { - vm = createComponent(); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('should render label title', () => { - expect(vm.$el.querySelector('.color-label').textContent.trim()).toEqual('Foo::Bar'); - }); - - it('should render question mark symbol', () => { - expect(vm.$el.querySelector('.fa-question-circle')).not.toBeNull(); - }); - - it('should render label style provided', () => { - const node = vm.$el.querySelector('.color-label'); - - expect(node.style.background).toEqual(props.labelStyle.background); - expect(node.style.color).toEqual(props.labelStyle.color); - }); - - it('should render the docs link', () => { - expect(vm.$el.querySelector('a.scoped-label').href).toContain( - props.scopedLabelsDocumentationLink, - ); - }); -}); diff --git a/spec/javascripts/boards/components/issue_due_date_spec.js b/spec/javascripts/boards/components/issue_due_date_spec.js deleted file mode 100644 index 68e26b68f04..00000000000 --- a/spec/javascripts/boards/components/issue_due_date_spec.js +++ /dev/null @@ -1,65 +0,0 @@ -import Vue from 'vue'; -import dateFormat from 'dateformat'; -import IssueDueDate from '~/boards/components/issue_due_date.vue'; -import mountComponent from '../../helpers/vue_mount_component_helper'; - -describe('Issue Due Date component', () => { - let vm; - let date; - const Component = Vue.extend(IssueDueDate); - const createComponent = (dueDate = new Date()) => - mountComponent(Component, { date: dateFormat(dueDate, 'yyyy-mm-dd', true) }); - - beforeEach(() => { - date = new Date(); - vm = createComponent(); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('should render "Today" if the due date is today', () => { - const timeContainer = vm.$el.querySelector('time'); - - expect(timeContainer.textContent.trim()).toEqual('Today'); - }); - - it('should render "Yesterday" if the due date is yesterday', () => { - date.setDate(date.getDate() - 1); - vm = createComponent(date); - - expect(vm.$el.querySelector('time').textContent.trim()).toEqual('Yesterday'); - }); - - it('should render "Tomorrow" if the due date is one day from now', () => { - date.setDate(date.getDate() + 1); - vm = createComponent(date); - - expect(vm.$el.querySelector('time').textContent.trim()).toEqual('Tomorrow'); - }); - - it('should render day of the week if due date is one week away', () => { - date.setDate(date.getDate() + 5); - vm = createComponent(date); - - expect(vm.$el.querySelector('time').textContent.trim()).toEqual(dateFormat(date, 'dddd')); - }); - - it('should render month and day for other dates', () => { - date.setDate(date.getDate() + 17); - vm = 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)); - }); - - it('should contain the correct `.text-danger` css class for overdue issue', () => { - date.setDate(date.getDate() - 17); - vm = createComponent(date); - - expect(vm.$el.querySelector('time').classList.contains('text-danger')).toEqual(true); - }); -}); |