diff --git a/tests/automated/monthNames.js b/tests/automated/monthNames.js index 96b0859..f32de5c 100644 --- a/tests/automated/monthNames.js +++ b/tests/automated/monthNames.js @@ -15,79 +15,86 @@ describe('month name', function() { moment.lang('en'); // reset moment's global language }); - describe('when view is month', function() { - beforeEach(function() { - settings.defaultView = 'month'; - }); - - describe('when lang is default', function() { + ['month', 'agendaDay', 'basicDay'].forEach(function(viewClass, index, viewClasses) { + describe('when view is ' + viewClass, function() { beforeEach(function() { - settings.lang = 'en'; - moment.lang('en') + settings.defaultView = viewClass; }); - - moment.months().forEach(function(month, index, months) { - it('should be ' + months[index], function(done) { - settings.now = moment(referenceDate).add('months', index); - settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(moment.months()[index]); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); - - languages.forEach(function(language, index, languages) { - describe('when lang is ' + language, function() { + + describe('when lang is default', function() { beforeEach(function() { - settings.lang = language; - moment.lang(language) + settings.lang = 'en'; + moment.lang('en') }); - + moment.months().forEach(function(month, index, months) { - it('should be the translated name for ' + months[index], function(done) { + it('should be ' + months[index], function(done) { settings.now = moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { expect($('.fc-header-title')[0]).toContainText(moment.months()[index]); done(); }; + + $('#cal').fullCalendar(settings); + }); + }); + }); + + languages.forEach(function(language, index, languages) { + describe('when lang is ' + language, function() { + beforeEach(function() { + settings.lang = language; + 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); + settings.eventAfterAllRender = function() { + if(viewClass == 'month') { + expect($('.fc-header-title')[0]).toContainText(moment.months()[index]); + } else { + expect($('.fc-header-title')[0]).toHaveText(settings.now.format('LL')); + } + done(); + }; + + $('#cal').fullCalendar(settings); + }); + }); + }); + }); + + describe('when names are specified', function() { + var months = [ + 'I', + 'II', + 'III', + 'IV', + 'V', + 'VI', + 'VII', + 'IIX', + 'IX', + 'X', + 'XI', + '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); + settings.monthNames = months; + settings.eventAfterAllRender = function() { + expect($('.fc-header-title')[0]).toContainText(month); + done(); + }; $('#cal').fullCalendar(settings); }); }); }); }); - - describe('when names are specified', function() { - var months = [ - 'I', - 'II', - 'III', - 'IV', - 'V', - 'VI', - 'VII', - 'IIX', - 'IX', - 'X', - 'XI', - '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); - settings.monthNames = months; - settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(month); - done(); - }; - - $('#cal').fullCalendar(settings); - }); - }); - }); }); + });