CRM-17303 Make new test more stable by deliberately moving the day a whole day forwar...
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 19 Oct 2015 08:12:15 +0000 (08:12 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 19 Oct 2015 10:59:16 +0000 (10:59 +0000)
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

index 4ffee0cc6d7edcd9a59370264ec2142e7d48115c..16d6b2a08de7781d01fda148c8159d601e71f9d4 100644 (file)
@@ -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() {