crmMailingRadioDateSpec.js - Fix handling of January dates
authorCiviCRM <info@civicrm.org>
Fri, 1 Jan 2016 22:25:52 +0000 (14:25 -0800)
committerCiviCRM <info@civicrm.org>
Fri, 1 Jan 2016 22:25:52 +0000 (14:25 -0800)
tests/karma/unit/crmMailingRadioDateSpec.js

index 71ba908097d3afc7b67a0dade0583d8ada1d059b..f3628b5141b3f4d68ba8a56ddc39e8bad59f0e99 100644 (file)
@@ -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);
     });