diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-10-18 11:31:01 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-18 11:31:01 +0000 |
commit | 941c11824a191216fd43805b910cdbd172157cb0 (patch) | |
tree | 14a4dd1c7cbddd117c6fe321925915af7933c444 /spec | |
parent | ed194a6d4af3e51246c8cb1927c0e4cc9fea5321 (diff) | |
download | gitlab-ce-941c11824a191216fd43805b910cdbd172157cb0.tar.gz |
Fix Pikaday
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/lib/utils/datefix_spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/datefix_spec.js b/spec/javascripts/lib/utils/datefix_spec.js new file mode 100644 index 00000000000..0b9fde2be67 --- /dev/null +++ b/spec/javascripts/lib/utils/datefix_spec.js @@ -0,0 +1,29 @@ +import { pad, parsePikadayDate, pikadayToString } from '~/lib/utils/datefix'; + +describe('datefix', () => { + describe('pad', () => { + it('should add a 0 when length is smaller than 2', () => { + expect(pad(2)).toEqual('02'); + }); + + it('should not add a zero when lenght matches the default', () => { + expect(pad(12)).toEqual('12'); + }); + + it('should add a 0 when lenght is smaller than the provided', () => { + expect(pad(12, 3)).toEqual('012'); + }); + }); + + describe('parsePikadayDate', () => { + it('should return a UTC date', () => { + expect(parsePikadayDate('2020-01-29')).toEqual(new Date('2020-01-29')); + }); + }); + + describe('pikadayToString', () => { + it('should format a UTC date into yyyy-mm-dd format', () => { + expect(pikadayToString(new Date('2020-01-29'))).toEqual('2020-01-29'); + }); + }); +}); |