Bert Leunis pushed to branch feature/CHANNELMGR-1391 at cms-community / hippo-addon-channel-manager
Commits: 44609e97 by Bert Leunis at 2018-03-26T13:30:37+02:00 CHANNELMGR-1391 add unit tests that check that a change on a time value does not update the other values The three input fields should only change and their corresponding values and have no effect on the other values. - - - - - 1 changed file: - frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/fields/dateField/dateValue.model.spec.js Changes: ===================================== frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/fields/dateField/dateValue.model.spec.js ===================================== --- a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/fields/dateField/dateValue.model.spec.js +++ b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/fields/dateField/dateValue.model.spec.js @@ -47,12 +47,28 @@ describe('DateValue', () => { expect(dateValue.hours).toBe(23); }); - it('when a new date is set, existing hours and minutes are maintained', () => { + it('does not change hours or minutes values when changing the date', () => { const newDate = new Date(2017, 2, 2, 0, 0, 0, 0); // date with hours and minutes = 0 dateValue.date = newDate; expect(dateValue.hours).toBe(12); expect(dateValue.minutes).toBe('01'); }); + + it('does not change date or minutes values when changing the hours', () => { + dateValue.hours = 3; + expect(dateValue.minutes).toBe('01'); + expect(dateValue.date.getFullYear()).toBe(2018); + expect(dateValue.date.getMonth()).toBe(2); // month is zero based + expect(dateValue.date.getDate()).toBe(12); + }); + + it('does not change date or hours values when changing the minutes', () => { + dateValue.minutes = 59; + expect(dateValue.hours).toBe(12); + expect(dateValue.date.getFullYear()).toBe(2018); + expect(dateValue.date.getMonth()).toBe(2); // month is zero based + expect(dateValue.date.getDate()).toBe(12); + }); }); describe('when populated with time zone', () => { View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/44609e975f4e8b76dbf6938a06b4c4a93920c366 --- View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/44609e975f4e8b76dbf6938a06b4c4a93920c366 You're receiving this email because of your account on code.onehippo.org.
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn