mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-06-27 16:10:13 +08:00
Reusing specs + finding els using fc-view as reference
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
describe('short day names', function() {
|
||||
var settings = {};
|
||||
var dayClasses = [
|
||||
'.fc-sun',
|
||||
'.fc-mon',
|
||||
'.fc-tue',
|
||||
'.fc-wed',
|
||||
'.fc-thu',
|
||||
'.fc-fri',
|
||||
'.fc-sat'
|
||||
];
|
||||
var languages = [ 'es', 'fr', 'de', 'zh-cn', 'es' ];
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
@@ -7,116 +17,52 @@ describe('short day names', function() {
|
||||
}
|
||||
});
|
||||
|
||||
describe('when view is agendaWeek', function() {
|
||||
describe('when lang is default', function() {
|
||||
['month', 'agendaWeek', 'basicWeek'].forEach(function(viewClass, index, viewClasses) {
|
||||
describe('when view is ' + viewClass, function() {
|
||||
beforeEach(function() {
|
||||
moment.lang('en');
|
||||
settings.defaultView = 'agendaWeek';
|
||||
settings.defaultView = viewClass;
|
||||
});
|
||||
|
||||
it('should be in English, starting on Sunday', function() {
|
||||
$('#cal').fullCalendar(settings);
|
||||
var weekdays = moment.weekdaysShort();
|
||||
|
||||
var dayClasses = [
|
||||
'.fc-sun',
|
||||
'.fc-mon',
|
||||
'.fc-tue',
|
||||
'.fc-wed',
|
||||
'.fc-thu',
|
||||
'.fc-fri',
|
||||
'.fc-sat'
|
||||
];
|
||||
|
||||
//expect($('.fc-agenda-days thead .fc-sun')[0]).toContainText(weekdays[0]);
|
||||
$.each(dayClasses, function(index, cls) {
|
||||
(function(){
|
||||
expect($('.fc-agenda-days thead ' + cls)[0]).toContainText(weekdays[index]);
|
||||
})();
|
||||
//console.log('dealing with ' + cls);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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;
|
||||
describe('when lang is default', function() {
|
||||
it('should be in English', function() {
|
||||
moment.lang('en');
|
||||
$('#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]);
|
||||
dayClasses.forEach(function(cls, index, classes) {
|
||||
expect($('.fc-view thead ' + cls)[0]).toContainText(weekdays[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when view is month', function() {
|
||||
describe('when lang is default', function() {
|
||||
beforeEach(function() {
|
||||
moment.lang('en');
|
||||
});
|
||||
|
||||
it('should be in English, starting on Sunday', 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 lang is not default', function() {
|
||||
languages.forEach(function(language, index, languages) {
|
||||
it('should be in the selected language', function() {
|
||||
settings.lang = language;
|
||||
$('#cal').fullCalendar(settings);
|
||||
|
||||
moment.lang(language);
|
||||
var dow = moment.langData(language)._week.dow
|
||||
var weekdays = moment.weekdaysShort();
|
||||
|
||||
dayClasses.forEach(function(cls, index, classes) {
|
||||
expect($('.fc-view thead ' + cls)[0]).toContainText(weekdays[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
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]);
|
||||
dayClasses.forEach(function(cls, index, classes) {
|
||||
expect($('.fc-view thead ' + cls)[0]).toContainText(days[index]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user