Adam Shaw hace 9 años
padre
commit
403d4cafd7
Se han modificado 1 ficheros con 18 adiciones y 5 borrados
  1. 18 5
      tests/automated-better/view-dates/validRange.js

+ 18 - 5
tests/automated-better/view-dates/validRange.js

@@ -58,10 +58,9 @@ describe('validRange', function() {
 		});
 
 		describe('when validRange is a function', function() {
+			var nowInput = '2017-06-09T06:00:00';
 
-			it('receives the nowDate', function() {
-				var nowInput = '2017-06-09T06:00:00';
-
+			it('receives the nowDate, timezoneless', function() {
 				var validRangeSpy = spyOnCalendarCallback('validRange', function(date) {
 					expect(moment.isMoment(date)).toBe(true);
 					expect(date).toEqualMoment(nowInput);
@@ -74,6 +73,20 @@ describe('validRange', function() {
 				expect(validRangeSpy).toHaveBeenCalled();
 			});
 
+			/* getNow() always returns ambig zone for some reason. intentional?
+			xit('receives the nowDate, with UTC timezone', function() {
+				var validRangeSpy = spyOnCalendarCallback('validRange', function(date) {
+					expect(date).toEqualMoment(nowInput + 'Z');
+				});
+
+				initCalendar({
+					timezone: 'UTC',
+					now: nowInput
+				});
+
+				expect(validRangeSpy).toHaveBeenCalled();
+			});*/
+
 			it('can return a range object with strings', function() {
 				var validRangeSpy = spyOnCalendarCallback('validRange', function() {
 					return { start: '2017-06-06' };
@@ -100,12 +113,12 @@ describe('validRange', function() {
 
 			it('does not cause side effects when given date is mutated', function() {
 				initCalendar({
-					now: '2018-06-09T06:00:00',
+					now: nowInput,
 					validRange: function(nowDate) {
 						nowDate.add(2, 'years');
 					}
 				});
-				expect(currentCalendar.getNow().year()).toBe(2018);
+				expect(currentCalendar.getNow().year()).toBe(2017);
 			});
 		});
 	});