From 800400172a4c3301250a2034a8db3bc92db31ea4 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Tue, 27 May 2014 14:36:35 -0700 Subject: [PATCH] scrollTime tests --- tests/automated/scrollTime.js | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/automated/scrollTime.js diff --git a/tests/automated/scrollTime.js b/tests/automated/scrollTime.js new file mode 100644 index 0000000..cbd069d --- /dev/null +++ b/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); + }); + +}); \ No newline at end of file