diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2018-12-15 10:50:39 +0100 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-12-18 08:32:05 +0100 |
commit | 7b507e87b1d5f487ce51e9f3f1b5aa62e457d32e (patch) | |
tree | eb0350e54b6e652d925f1f6db20ae94b080ed69b | |
parent | 3271fb360e0c9b6035bfe5c232a3b844749bf8b5 (diff) | |
download | gitlab-ce-11-5-stable-patch-4.tar.gz |
Fix broken karma test11-5-stable-patch-4
2 files changed, 9 insertions, 3 deletions
diff --git a/changelogs/unreleased/55402-broken-master-karma-test-failing-in-spec-javascripts-boards-components-issue_due_date_spec-js.yml b/changelogs/unreleased/55402-broken-master-karma-test-failing-in-spec-javascripts-boards-components-issue_due_date_spec-js.yml new file mode 100644 index 00000000000..d2ff095ce55 --- /dev/null +++ b/changelogs/unreleased/55402-broken-master-karma-test-failing-in-spec-javascripts-boards-components-issue_due_date_spec-js.yml @@ -0,0 +1,5 @@ +--- +title: Fix due date test +merge_request: 23845 +author: +type: other diff --git a/spec/javascripts/boards/components/issue_due_date_spec.js b/spec/javascripts/boards/components/issue_due_date_spec.js index 9e49330c052..054cf8c5b7d 100644 --- a/spec/javascripts/boards/components/issue_due_date_spec.js +++ b/spec/javascripts/boards/components/issue_due_date_spec.js @@ -49,10 +49,11 @@ describe('Issue Due Date component', () => { 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, 'mmm d', true), - ); + expect(vm.$el.querySelector('time').textContent.trim()).toEqual(dateFormat(date, format, true)); }); it('should contain the correct `.text-danger` css class for overdue issue', () => { |