Explorar o código

test for segment timezone text

Adam Shaw %!s(int64=8) %!d(string=hai) anos
pai
achega
49ee5fd03d

+ 7 - 0
tests/event-render/TimeGridEventRenderUtils.js

@@ -2,6 +2,13 @@
 var TimeGridEventRenderUtils = {
 
 
+	getTimeTexts: function() {
+		return $('.fc-event').map(function(i, eventEl) {
+			return $(eventEl).find('.fc-time').text();
+		}).get();
+	},
+
+
 	/*
 	Returns a boolean.
 	TODO: check isStart/isEnd.

+ 31 - 0
tests/event-render/timeText.js

@@ -0,0 +1,31 @@
+
+describe('the time text on events', function() {
+
+	describe('in agendaWeek', function() {
+		pushOptions({
+			defaultView: 'agendaWeek',
+			defaultDate: '2017-07-03',
+			scrollTime: '00:00'
+		});
+
+		it('renders segs with correct local timezone', function() {
+			initCalendar({
+				timezone: 'local',
+				timeFormat: 'h:mm Z',
+				events: [
+					{ start: '2017-07-03T23:00:00', end: '2017-07-04T13:00:00' }
+				]
+			});
+
+			expect(
+				TimeGridEventRenderUtils.getTimeTexts()
+			).toEqual([
+				moment('2017-07-03T23:00:00').format('h:mm Z') + ' - ' +
+				moment('2017-07-04T00:00:00').format('h:mm Z'),
+				moment('2017-07-04T00:00:00').format('h:mm Z') + ' - ' +
+				moment('2017-07-04T13:00:00').format('h:mm Z'),
+			]);
+		})
+	});
+
+});