mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-12 12:00:40 +08:00
Merge branch 'test/dayNames' of https://github.com/vidbina/fullcalendar into vidbina-test/dayNames
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
describe('day names', function() {
|
||||
var settings = {};
|
||||
var testableClasses = [
|
||||
'basicDay',
|
||||
'agendaDay'
|
||||
];
|
||||
var dayClasses = [
|
||||
'.fc-sun',
|
||||
'.fc-mon',
|
||||
'.fc-tue',
|
||||
'.fc-wed',
|
||||
'.fc-thu',
|
||||
'.fc-fri',
|
||||
'.fc-sat',
|
||||
];
|
||||
var referenceDate = '2014-05-25 06:00'; // A sunday
|
||||
var languages = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ];
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
moment.lang();
|
||||
settings = {
|
||||
now: moment(referenceDate).toISOString()
|
||||
};
|
||||
});
|
||||
|
||||
testableClasses.forEach(function(viewClass, index, viewClasses) {
|
||||
describe('when view is basicDay', function() {
|
||||
beforeEach(function() {
|
||||
settings.defaultView = 'basicDay';
|
||||
});
|
||||
|
||||
describe('when lang is default', function() {
|
||||
beforeEach(function() {
|
||||
settings.lang = 'en';
|
||||
});
|
||||
|
||||
dayClasses.forEach(function(cls, index, classes) {
|
||||
var weekdays = moment.weekdays();
|
||||
it('should be ' + weekdays[index], function() {
|
||||
settings.now = moment(referenceDate).add('days', index);
|
||||
$('#cal').fullCalendar(settings);
|
||||
|
||||
expect($('.fc-view thead ' + dayClasses[index])).toHaveText(weekdays[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$.each(languages, function(index, language) {
|
||||
describe('when lang is ' + language, function() {
|
||||
beforeEach(function() {
|
||||
moment.lang(language);
|
||||
});
|
||||
|
||||
dayClasses.forEach(function(cls, index, classes) {
|
||||
it('should be the translation for ' + moment.weekdays()[index], function() {
|
||||
settings.lang = language;
|
||||
settings.now = moment(referenceDate).add('days', index);
|
||||
$('#cal').fullCalendar(settings);
|
||||
|
||||
expect($('.fc-view thead ' + dayClasses[index])).toHaveText(moment.weekdays()[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when daynames are specified', function() {
|
||||
var weekdays = [
|
||||
'Hovjaj',
|
||||
'maSjaj',
|
||||
'veSjaj',
|
||||
'mechjaj',
|
||||
'jevjaj',
|
||||
'parmaqjaj',
|
||||
'HoSjaj'
|
||||
];
|
||||
|
||||
dayClasses.forEach(function(cls, idx, classes) {
|
||||
it('should be ' + weekdays[idx], function() {
|
||||
settings.dayNames = moment.weekdays();
|
||||
settings.now = moment(referenceDate).add('days', idx);
|
||||
|
||||
$('#cal').fullCalendar(settings);
|
||||
|
||||
expect($('.fc-view thead ' + cls)).toHaveText(moment.weekdays()[idx]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user