mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-05 13:00:44 +08:00
modified month view spec to test monthname in agendaDay and basicDay views
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user