From 1f1201c01389b9cfc41719571ec43319ebf72ee0 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 19 Oct 2015 08:12:15 +0000 Subject: [PATCH] CRM-17303 Make new test more stable by deliberately moving the day a whole day forward in a verfiable way Fix another test based on new test Fix text and increment the year also Add another unit test to try to work out what is going on Fix tests now working out the issue Fix tests now working out the issue Deliberately cause fail test to see values Fix test by manually setting values --- tests/karma/unit/crmMailingRadioDateSpec.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/karma/unit/crmMailingRadioDateSpec.js b/tests/karma/unit/crmMailingRadioDateSpec.js index 4ffee0cc6d..16d6b2a08d 100644 --- a/tests/karma/unit/crmMailingRadioDateSpec.js +++ b/tests/karma/unit/crmMailingRadioDateSpec.js @@ -87,24 +87,25 @@ describe('crmMailingRadioDate', function() { expect(element.find('.crm-form-time').timeEntry('getTime').getMinutes()).toBe(3); var now = new Date(); - now.setDate(now.getDate() + 1); var month = '' + (now.getMonth() + 1); - var day = '' + now.getDate(); - var year = now.getFullYear(); - var hours = '' + now.getHours(); - var minutes = '' + now.getMinutes(); + var day = '' + (now.getDate() + 1); + var year = (now.getFullYear() + 1); + var hours = '03'; + var minutes = '30'; if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; var datenow = [year, month, day].join('-'); var time = [hours, minutes, "00"].join(':'); var currentDate = datenow + ' ' + time; - var n = now.toDateString(); + var ndate = new Date(datenow); + var n = ndate.toDateString(); model.the_date = currentDate; $rootScope.$digest(); expect($rootScope.myForm.$valid).toBe(true); expect(element.find('.radio-now').prop('checked')).toBe(false); expect(element.find('.radio-at').prop('checked')).toBe(true); expect(element.find('.crm-form-date').datepicker('getDate').toDateString()).toEqual(n); + expect(element.find('.crm-hidden-date').val()).toEqual(currentDate); }); it('should update the model after changing the date and time', function() { -- 2.25.1