From fc5d68806440f3e96e09ec227b47e8fdf1fa2da8 Mon Sep 17 00:00:00 2001 From: David Asabina Date: Thu, 22 May 2014 20:42:35 +0200 Subject: [PATCH] Testing default, non-default and user-specified short daynames --- demos/default.html | 1 + tests/automated/dayNamesShort.js | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 tests/automated/dayNamesShort.js diff --git a/demos/default.html b/demos/default.html index 9d6eb7c..79b38fc 100644 --- a/demos/default.html +++ b/demos/default.html @@ -15,6 +15,7 @@ $('#calendar').fullCalendar({ defaultDate: '2014-01-12', editable: true, + weekends: false, events: [ { title: 'All Day Event', diff --git a/tests/automated/dayNamesShort.js b/tests/automated/dayNamesShort.js new file mode 100644 index 0000000..4c5451f --- /dev/null +++ b/tests/automated/dayNamesShort.js @@ -0,0 +1,61 @@ +describe('day names', function() { + var settings = {}; + + beforeEach(function() { + affix('#cal'); + settings = { + } + }); + + //describe('when view is basic'); + //describe('when view is agenda'); + describe('when view is month', function() { + describe('when lang is default', function() { + beforeEach(function() { + moment.lang(); + }); + + it('should be in the default language and order', function() { + $('#cal').fullCalendar(settings); + var weekdays = moment.weekdaysShort(); + + $('.fc-day-header').each(function(index, item) { + expect(item).toHaveText(weekdays[index]); + }); + }); + }); + + describe('when lang is not default', function() { + var languages = [ 'es', 'fr', 'de', 'zh-cn', 'es' ]; + + $.each(languages, function(index, language) { + it('should be in the selected language and corresponding order', function() { + settings.lang = language; + $('#cal').fullCalendar(settings); + + moment.lang(language); + var dow = moment.langData(language)._week.dow + var weekdays = moment.weekdaysShort(); + + $('.fc-day-header').each(function(index, item) { + expect(item).toContainText(weekdays[(index + dow) % 7]); + }); + }); + }); + }); + + describe('when specified', function() { + it('should contain the specified names in the given order', function() { + var days = [ + 'Hovjaj', 'maSjaj', 'veSjaj', 'mechjaj', 'parmaqjaj', 'HoSjaj' + ] + settings.dayNamesShort = days; + $('#cal').fullCalendar(settings); + + $('.fc-day-header').each(function(index, item) { + expect(item).toContainText(days[index]); + }); + }); + }); + }); +});