瀏覽代碼

scrollTime tests

Adam Shaw 11 年之前
父節點
當前提交
800400172a
共有 1 個文件被更改,包括 38 次插入0 次删除
  1. 38 0
      tests/automated/scrollTime.js

+ 38 - 0
tests/automated/scrollTime.js

@@ -0,0 +1,38 @@
+describe('scrollTime', function() {
+
+	var options;
+
+	beforeEach(function() {
+		affix('#cal');
+		options = {
+			defaultView: 'agendaWeek'
+		};
+	});
+
+	it('accepts a string Duration', function() {
+		options.scrollTime = '02:00:00';
+		$('#cal').fullCalendar(options);
+		var slotCell = $('.fc-slot4 td'); // 2am slot
+		var slotTop = slotCell.position().top;
+		var scrollContainer = $('.fc-agenda-slots').parent().parent();
+		var scrollTop = scrollContainer.scrollTop();
+		var diff = Math.abs(slotTop - scrollTop);
+		expect(slotTop).toBeGreaterThan(0);
+		expect(scrollTop).toBeGreaterThan(0);
+		expect(diff).toBeLessThan(3);
+	});
+
+	it('accepts a Duration object', function() {
+		options.scrollTime = { hours: 2 };
+		$('#cal').fullCalendar(options);
+		var slotCell = $('.fc-slot4 td'); // 2am slot
+		var slotTop = slotCell.position().top;
+		var scrollContainer = $('.fc-agenda-slots').parent().parent();
+		var scrollTop = scrollContainer.scrollTop();
+		var diff = Math.abs(slotTop - scrollTop);
+		expect(slotTop).toBeGreaterThan(0);
+		expect(scrollTop).toBeGreaterThan(0);
+		expect(diff).toBeLessThan(3);
+	});
+
+});