From 4980e14611a03211fa0cf8ba881adb5deeee8b44 Mon Sep 17 00:00:00 2001 From: David Asabina Date: Wed, 28 May 2014 09:48:01 +0200 Subject: [PATCH] Basic setup for monthNames tests --- tests/automated/monthNames.js | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/automated/monthNames.js diff --git a/tests/automated/monthNames.js b/tests/automated/monthNames.js new file mode 100644 index 0000000..629c91b --- /dev/null +++ b/tests/automated/monthNames.js @@ -0,0 +1,64 @@ +describe('month name', function() { + var settings = {}; + var referenceDate = '2014-01-01 06:00'; // The day the world is hung-over + var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]; + + beforeEach(function() { + affix('#cal'); + settings = { + now: moment(referenceDate).toISOString() + }; + }); + + afterEach(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() { + beforeEach(function() { + settings.lang = 'en'; + moment.lang('en') + }); + + moment.months().forEach(function(month, index, months) { + it('should be ' + months[index], function() { + settings.now = moment(referenceDate).add('months', index); + $('#cal').fullCalendar(settings); + if(index == 0) console.log(moment.months()); + + // FIX: Selector often appears to point to a undefined object, wait for a callback to ensure all items are available in the DOM + expect($('.fc-header-title')[0]).toContainText(moment.months[index]); + }); + }); + }); + + 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() { + settings.now = moment(referenceDate).add('months', index); + $('#cal').fullCalendar(settings); + if(index == 0) console.log(moment.months()); + if(index == 0) console.log(settings.now.toISOString()); + if(index == 0) console.log($('.fc-header-title')[0].innerHTML); + + //expect($('.fc-header-title')[0]).toContainText(moment.months[index]); + }); + }); + }); + }); + + describe('when names are specified', function() {}); + + }); +});