From 4a7800d6bf4dece0b5d0f9534afabea219ed9d69 Mon Sep 17 00:00:00 2001 From: Roxin Cernica Date: Sun, 11 May 2014 10:19:34 +0300 Subject: [PATCH 1/2] added columnFormat tests --- tests/automated/columnFormat.js | 90 +++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/automated/columnFormat.js diff --git a/tests/automated/columnFormat.js b/tests/automated/columnFormat.js new file mode 100644 index 0000000..07f2678 --- /dev/null +++ b/tests/automated/columnFormat.js @@ -0,0 +1,90 @@ +describe('columnFormat', function() { + + beforeEach(function() { + affix('#cal'); + }); + + describe('when columnFormat is not set', function() { + + var viewWithFormat = [ { view: 'month', expected: 'Sun', selector: 'th.fc-day-header.fc-sun' }, + { view: 'basicWeek', expected: 'Sun 5/11', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaWeek', expected: 'Sun 5/11', selector: 'th.fc-widget-header.fc-sun' }, + { view: 'basicDay', expected: 'Sunday', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaDay', expected: 'Sunday', selector: 'th.fc-widget-header.fc-sun' } ]; + + beforeEach(function() { + $('#cal').fullCalendar({ + timezone: 'local' + }); + }); + + it('should have default values', function() { + var cal = $('#cal'); + + for (var i = 0; i < viewWithFormat.length; i++) { + var crtView = viewWithFormat[i]; + cal.fullCalendar('changeView', crtView.view); + expect(cal.find(crtView.selector).text()).toBe(crtView.expected); + }; + }); + }); + + describe('when columnFormat is set on a per-view basis', function() { + + var viewWithFormat = [ { view: 'month', expected: 'Sunday', selector: 'th.fc-day-header.fc-sun' }, + { view: 'basicWeek', expected: 'Sunday 11 - 5', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaWeek', expected: 'Sunday 11 , 5', selector: 'th.fc-widget-header.fc-sun' }, + { view: 'basicDay', expected: 'Sunday 11 | 5', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaDay', expected: 'Sunday 5/11', selector: 'th.fc-widget-header.fc-sun' } ]; + + beforeEach(function() { + $('#cal').fullCalendar({ + timezone: 'local', + columnFormat: { + month: 'dddd', + agendaDay: 'dddd M/D', + agendaWeek: 'dddd D , M', + basicDay: 'dddd D | M', + basicWeek: 'dddd D - M', + } + }); + }); + + it('should have the correct values', function() { + var cal = $('#cal'); + + for (var i = 0; i < viewWithFormat.length; i++) { + var crtView = viewWithFormat[i]; + cal.fullCalendar('changeView', crtView.view); + expect(cal.find(crtView.selector).text()).toBe(crtView.expected); + }; + }); + }); + + + describe('when lang is Fr', function() { + + var viewWithFormat = [ { view: 'month', expected: 'dim.', selector: 'th.fc-day-header.fc-sun' }, + { view: 'basicWeek', expected: 'dim. 11/05', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaWeek', expected: 'dim. 11/05', selector: 'th.fc-widget-header.fc-sun' }, + { view: 'basicDay', expected: 'dimanche', selector: 'th.fc-day-header.fc-sun' }, + { view: 'agendaDay', expected: 'dimanche', selector: 'th.fc-widget-header.fc-sun' } ]; + + beforeEach(function() { + $('#cal').fullCalendar({ + timezone: 'local', + lang: 'fr' + }); + }); + + it('should have the translated dates', function() { + var cal = $('#cal'); + + for (var i = 0; i < viewWithFormat.length; i++) { + var crtView = viewWithFormat[i]; + cal.fullCalendar('changeView', crtView.view); + expect(cal.find(crtView.selector).text()).toBe(crtView.expected); + }; + }); + }); +}); From 2a4067e6a589e252afc2e903175a55420f329067 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Wed, 21 May 2014 11:31:17 -0700 Subject: [PATCH 2/2] changed columnFormat tests to use hardcoded current date --- tests/automated/columnFormat.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/automated/columnFormat.js b/tests/automated/columnFormat.js index 07f2678..af4c017 100644 --- a/tests/automated/columnFormat.js +++ b/tests/automated/columnFormat.js @@ -14,7 +14,7 @@ describe('columnFormat', function() { beforeEach(function() { $('#cal').fullCalendar({ - timezone: 'local' + defaultDate: '2014-05-11' }); }); @@ -39,7 +39,7 @@ describe('columnFormat', function() { beforeEach(function() { $('#cal').fullCalendar({ - timezone: 'local', + defaultDate: '2014-05-11', columnFormat: { month: 'dddd', agendaDay: 'dddd M/D', @@ -72,7 +72,7 @@ describe('columnFormat', function() { beforeEach(function() { $('#cal').fullCalendar({ - timezone: 'local', + defaultDate: '2014-05-11', lang: 'fr' }); });