diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 15:06:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 15:06:45 +0000 |
commit | a98649b71085bcd21af674a47d6a746336c56a65 (patch) | |
tree | 1e518ce4f61a8d7260ba9d6d3b8db8906251d6a0 /spec/frontend/lib | |
parent | a4484fd22dd0d055a10fe084b82349e42f7363e1 (diff) | |
download | gitlab-ce-a98649b71085bcd21af674a47d6a746336c56a65.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r-- | spec/frontend/lib/utils/datetime_utility_spec.js | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/spec/frontend/lib/utils/datetime_utility_spec.js b/spec/frontend/lib/utils/datetime_utility_spec.js index fd75c9aa0cd..872779299d2 100644 --- a/spec/frontend/lib/utils/datetime_utility_spec.js +++ b/spec/frontend/lib/utils/datetime_utility_spec.js @@ -1,15 +1,16 @@ +import { __, s__ } from '~/locale'; import * as datetimeUtility from '~/lib/utils/datetime_utility'; describe('Date time utils', () => { describe('timeFor', () => { - it('returns `past due` when in past', () => { + it('returns localize `past due` when in past', () => { const date = new Date(); date.setFullYear(date.getFullYear() - 1); - expect(datetimeUtility.timeFor(date)).toBe('Past due'); + expect(datetimeUtility.timeFor(date)).toBe(s__('Timeago|Past due')); }); - it('returns remaining time when in the future', () => { + it('returns localized remaining time when in the future', () => { const date = new Date(); date.setFullYear(date.getFullYear() + 1); @@ -17,51 +18,51 @@ describe('Date time utils', () => { // short of a full year, timeFor will return '11 months remaining' date.setDate(date.getDate() + 1); - expect(datetimeUtility.timeFor(date)).toBe('1 year remaining'); + expect(datetimeUtility.timeFor(date)).toBe(s__('Timeago|1 year remaining')); }); }); - describe('get day name', () => { + describe('get localized day name', () => { it('should return Sunday', () => { const day = datetimeUtility.getDayName(new Date('07/17/2016')); - expect(day).toBe('Sunday'); + expect(day).toBe(__('Sunday')); }); it('should return Monday', () => { const day = datetimeUtility.getDayName(new Date('07/18/2016')); - expect(day).toBe('Monday'); + expect(day).toBe(__('Monday')); }); it('should return Tuesday', () => { const day = datetimeUtility.getDayName(new Date('07/19/2016')); - expect(day).toBe('Tuesday'); + expect(day).toBe(__('Tuesday')); }); it('should return Wednesday', () => { const day = datetimeUtility.getDayName(new Date('07/20/2016')); - expect(day).toBe('Wednesday'); + expect(day).toBe(__('Wednesday')); }); it('should return Thursday', () => { const day = datetimeUtility.getDayName(new Date('07/21/2016')); - expect(day).toBe('Thursday'); + expect(day).toBe(__('Thursday')); }); it('should return Friday', () => { const day = datetimeUtility.getDayName(new Date('07/22/2016')); - expect(day).toBe('Friday'); + expect(day).toBe(__('Friday')); }); it('should return Saturday', () => { const day = datetimeUtility.getDayName(new Date('07/23/2016')); - expect(day).toBe('Saturday'); + expect(day).toBe(__('Saturday')); }); }); @@ -114,10 +115,10 @@ describe('Date time utils', () => { describe('timeIntervalInWords', () => { it('should return string with number of minutes and seconds', () => { - expect(datetimeUtility.timeIntervalInWords(9.54)).toEqual('9 seconds'); - expect(datetimeUtility.timeIntervalInWords(1)).toEqual('1 second'); - expect(datetimeUtility.timeIntervalInWords(200)).toEqual('3 minutes 20 seconds'); - expect(datetimeUtility.timeIntervalInWords(6008)).toEqual('100 minutes 8 seconds'); + expect(datetimeUtility.timeIntervalInWords(9.54)).toEqual(s__('Timeago|9 seconds')); + expect(datetimeUtility.timeIntervalInWords(1)).toEqual(s__('Timeago|1 second')); + expect(datetimeUtility.timeIntervalInWords(200)).toEqual(s__('Timeago|3 minutes 20 seconds')); + expect(datetimeUtility.timeIntervalInWords(6008)).toEqual(s__('Timeago|100 minutes 8 seconds')); }); }); @@ -125,15 +126,15 @@ describe('dateInWords', () => { const date = new Date('07/01/2016'); it('should return date in words', () => { - expect(datetimeUtility.dateInWords(date)).toEqual('July 1, 2016'); + expect(datetimeUtility.dateInWords(date)).toEqual(s__('July 1, 2016')); }); it('should return abbreviated month name', () => { - expect(datetimeUtility.dateInWords(date, true)).toEqual('Jul 1, 2016'); + expect(datetimeUtility.dateInWords(date, true)).toEqual(s__('Jul 1, 2016')); }); it('should return date in words without year', () => { - expect(datetimeUtility.dateInWords(date, true, true)).toEqual('Jul 1'); + expect(datetimeUtility.dateInWords(date, true, true)).toEqual(s__('Jul 1')); }); }); @@ -141,11 +142,11 @@ describe('monthInWords', () => { const date = new Date('2017-01-20'); it('returns month name from provided date', () => { - expect(datetimeUtility.monthInWords(date)).toBe('January'); + expect(datetimeUtility.monthInWords(date)).toBe(s__('January')); }); it('returns abbreviated month name from provided date', () => { - expect(datetimeUtility.monthInWords(date, true)).toBe('Jan'); + expect(datetimeUtility.monthInWords(date, true)).toBe(s__('Jan')); }); }); |