From bb3476be8d42a0e9edc8f29aa79ccbb51dd7b542 Mon Sep 17 00:00:00 2001 From: CiviCRM Date: Fri, 1 Jan 2016 14:25:52 -0800 Subject: [PATCH] crmMailingRadioDateSpec.js - Fix handling of January dates --- tests/karma/unit/crmMailingRadioDateSpec.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/karma/unit/crmMailingRadioDateSpec.js b/tests/karma/unit/crmMailingRadioDateSpec.js index 71ba908097..f3628b5141 100644 --- a/tests/karma/unit/crmMailingRadioDateSpec.js +++ b/tests/karma/unit/crmMailingRadioDateSpec.js @@ -87,7 +87,7 @@ describe('crmMailingRadioDate', function() { expect(element.find('.crm-form-time').timeEntry('getTime').getMinutes()).toBe(3); var now = new Date(); - var month = '' + now.getMonth(); + var month = '' + (now.getMonth() + 1); var year = (now.getFullYear() + 1); if (month.length < 2) month = '0' + month; var day = "01"; @@ -97,13 +97,14 @@ describe('crmMailingRadioDate', function() { var time = [hours, minutes, "00"].join(':'); var currentDate = datenow + ' ' + time; 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-form-date').datepicker('getDate').toDateString()).toEqual(ndate.toDateString()); + expect(element.find('.crm-form-date').datepicker('getDate').getUTCDate()).toEqual(ndate.getUTCDate()); expect(element.find('.crm-hidden-date').val()).toEqual(currentDate); }); -- 2.25.1