From d8750fbe9f61c533dda93360d60af9177bf81bcc Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Thu, 29 May 2014 14:45:47 -0700 Subject: [PATCH] minor tweaks to monthNames test --- tests/automated/monthNames.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/automated/monthNames.js b/tests/automated/monthNames.js index 1f23669..e87eba4 100644 --- a/tests/automated/monthNames.js +++ b/tests/automated/monthNames.js @@ -1,12 +1,12 @@ describe('month name', function() { var settings = {}; - var referenceDate = '2014-01-01 06:00'; // The day the world is hung-over + var referenceDate = '2014-01-01'; // The day the world is hung-over var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]; beforeEach(function() { affix('#cal'); settings = { - now: moment(referenceDate).toISOString() + defaultDate: referenceDate }; }); @@ -27,10 +27,10 @@ describe('month name', function() { }); moment.months().forEach(function(month, index, months) { - it('should be ' + months[index], function(done) { - settings.now = moment(referenceDate).add('months', index); + it('should be ' + month, function(done) { + settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(moment.months()[index]); + expect($('.fc-header-title')[0]).toContainText(month); done(); }; @@ -46,15 +46,18 @@ describe('month name', function() { moment.lang(language); }); - moment.months().forEach(function(month, index, months) { - it('should be the translated name for ' + months[index], function(done) { - settings.now = moment(referenceDate).add('months', index); + moment.months().forEach(function(month, index, months) { // `month` will always be English + it('should be the translated name for ' + month, function(done) { + var langMonths = moment.months(); + var langMonth = langMonths[index]; + + settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { if (viewClass == 'month') { // with month view check for occurence of the monthname in the title - expect($('.fc-header-title')[0]).toContainText(moment.months()[index]); + expect($('.fc-header-title')[0]).toContainText(langMonth); } else { // with day views ensure that title contains the properly formatted phrase - expect($('.fc-header-title')[0]).toHaveText(settings.now.format('LL')); + expect($('.fc-header-title')[0]).toHaveText(settings.defaultDate.format('LL')); } done(); }; @@ -81,9 +84,9 @@ describe('month name', function() { 'XII' ]; - months.forEach(function(month, index, months) { - it('should be the translated name for ' + months[index], function(done) { - settings.now = moment(referenceDate).add('months', index); + months.forEach(function(month, index, months) { // `month` is our custom month name + it('should be the translated name for ' + month, function(done) { + settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.monthNames = months; settings.eventAfterAllRender = function() { expect($('.fc-header-title')[0]).toContainText(month);