mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-09 12:00:38 +08:00
switch around where some of the tests live
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
|
||||
describe('agenda view rendering', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when isRTL is false', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
isRTL: false
|
||||
});
|
||||
});
|
||||
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $('#cal').find('.fc-agenda-days th');
|
||||
expect(fc[0]).toHaveClass('fc-agenda-axis');
|
||||
expect(fc[1]).toHaveClass('fc-sun');
|
||||
expect(fc[2]).toHaveClass('fc-mon');
|
||||
expect(fc[3]).toHaveClass('fc-tue');
|
||||
expect(fc[4]).toHaveClass('fc-wed');
|
||||
expect(fc[5]).toHaveClass('fc-thu');
|
||||
expect(fc[6]).toHaveClass('fc-fri');
|
||||
expect(fc[7]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when isRTL is true', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
isRTL: true
|
||||
});
|
||||
});
|
||||
|
||||
it('should have have days ordered sat to sun', function() {
|
||||
var fc = $('#cal').find('.fc-agenda-days th');
|
||||
expect(fc[0]).toHaveClass('fc-agenda-axis');
|
||||
expect(fc[1]).toHaveClass('fc-sat');
|
||||
expect(fc[2]).toHaveClass('fc-fri');
|
||||
expect(fc[3]).toHaveClass('fc-thu');
|
||||
expect(fc[4]).toHaveClass('fc-wed');
|
||||
expect(fc[5]).toHaveClass('fc-tue');
|
||||
expect(fc[6]).toHaveClass('fc-mon');
|
||||
expect(fc[7]).toHaveClass('fc-sun');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
describe('basic view rendering', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when isRTL is false', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'month',
|
||||
isRTL: false
|
||||
});
|
||||
});
|
||||
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $('#cal').find('.fc-day-header');
|
||||
expect(fc[0]).toHaveClass('fc-sun');
|
||||
expect(fc[1]).toHaveClass('fc-mon');
|
||||
expect(fc[2]).toHaveClass('fc-tue');
|
||||
expect(fc[3]).toHaveClass('fc-wed');
|
||||
expect(fc[4]).toHaveClass('fc-thu');
|
||||
expect(fc[5]).toHaveClass('fc-fri');
|
||||
expect(fc[6]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when isRTL is true', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'month',
|
||||
isRTL: true
|
||||
});
|
||||
});
|
||||
|
||||
it('should have have days ordered sat to sun', function() {
|
||||
var fc = $('#cal').find('.fc-day-header');
|
||||
expect(fc[0]).toHaveClass('fc-sat');
|
||||
expect(fc[1]).toHaveClass('fc-fri');
|
||||
expect(fc[2]).toHaveClass('fc-thu');
|
||||
expect(fc[3]).toHaveClass('fc-wed');
|
||||
expect(fc[4]).toHaveClass('fc-tue');
|
||||
expect(fc[5]).toHaveClass('fc-mon');
|
||||
expect(fc[6]).toHaveClass('fc-sun');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
describe('firstDay', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when first day is set to mon and isRTL is true', function() {
|
||||
beforeEach(function() {
|
||||
var options = {
|
||||
firstDay: 2,
|
||||
isRTL: true
|
||||
};
|
||||
$('#cal').fullCalendar(options);
|
||||
});
|
||||
it('should put days mon, sun, sat ...', function() {
|
||||
var daysOfWeek = $('.fc-day-header');
|
||||
expect(daysOfWeek[0]).toHaveClass('fc-mon');
|
||||
expect(daysOfWeek[1]).toHaveClass('fc-sun');
|
||||
expect(daysOfWeek[2]).toHaveClass('fc-sat');
|
||||
expect(daysOfWeek[3]).toHaveClass('fc-fri');
|
||||
expect(daysOfWeek[4]).toHaveClass('fc-thu');
|
||||
expect(daysOfWeek[5]).toHaveClass('fc-wed');
|
||||
expect(daysOfWeek[6]).toHaveClass('fc-tue');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,141 +0,0 @@
|
||||
|
||||
describe('weekNumbers-defaultView', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when using basicWeek', function() {
|
||||
describe('with default weekNumbers ', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is header
|
||||
// 1 row is actual week number
|
||||
expect(weekNumbersCount).toEqual(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using basicDay', function() {
|
||||
describe('with default weekNumbers', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicDay'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicDay',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicDay',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is header
|
||||
// 1 row is actual week number
|
||||
expect(weekNumbersCount).toEqual(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using agendaWeek', function() {
|
||||
describe('with default weekNumbers', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is axis
|
||||
expect(weekNumbersCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using agendaDay', function() {
|
||||
describe('with default weekNumbers', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaDay'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaDay',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaDay',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is axis
|
||||
expect(weekNumbersCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
describe('fullCalendar constructor', function() {
|
||||
describe('constructor', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#calendar');
|
||||
@@ -38,35 +38,5 @@ describe('fullCalendar constructor', function() {
|
||||
expect(count).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
// can't do event dragging yet.
|
||||
// need to work out how fullCalendar is intercepting events.
|
||||
xdescribe('when event is dragged from one cell to another', function() {
|
||||
it('should move to the new cell', function() {
|
||||
var eventName = 'xyzAllDayEvent';
|
||||
$('#calendar').fullCalendar({
|
||||
editable: true
|
||||
});
|
||||
$('#calendar').fullCalendar('addEventSource', {
|
||||
events: [
|
||||
{
|
||||
title: eventName,
|
||||
start: new Date()
|
||||
}
|
||||
]
|
||||
});
|
||||
var el = $('div .fc-event');
|
||||
var offsetBefore = el.offset();
|
||||
dump(offsetBefore);
|
||||
var options = {
|
||||
dx: 200,
|
||||
dy: 0,
|
||||
moves: 10,
|
||||
handle: 'corner'
|
||||
};
|
||||
el.simulate('drag', options);
|
||||
dump(el.offset());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
// can't do event dragging yet.
|
||||
// need to work out how fullCalendar is intercepting events.
|
||||
xdescribe('when event is dragged from one cell to another', function() {
|
||||
it('should move to the new cell', function() {
|
||||
var eventName = 'xyzAllDayEvent';
|
||||
$('#calendar').fullCalendar({
|
||||
editable: true
|
||||
});
|
||||
$('#calendar').fullCalendar('addEventSource', {
|
||||
events: [
|
||||
{
|
||||
title: eventName,
|
||||
start: new Date()
|
||||
}
|
||||
]
|
||||
});
|
||||
var el = $('div .fc-event');
|
||||
var offsetBefore = el.offset();
|
||||
dump(offsetBefore);
|
||||
var options = {
|
||||
dx: 200,
|
||||
dy: 0,
|
||||
moves: 10,
|
||||
handle: 'corner'
|
||||
};
|
||||
el.simulate('drag', options);
|
||||
dump(el.offset());
|
||||
});
|
||||
});
|
||||
@@ -162,4 +162,24 @@ describe('First Day', function() {
|
||||
expect($('.fc-day-header')[0]).toHaveClass('fc-thu');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when first day is set to Tuesday and isRTL is true', function() {
|
||||
beforeEach(function() {
|
||||
var options = {
|
||||
firstDay: 2,
|
||||
isRTL: true
|
||||
};
|
||||
$('#cal').fullCalendar(options);
|
||||
});
|
||||
it('should put days mon, sun, sat ...', function() {
|
||||
var daysOfWeek = $('.fc-day-header');
|
||||
expect(daysOfWeek[0]).toHaveClass('fc-mon');
|
||||
expect(daysOfWeek[1]).toHaveClass('fc-sun');
|
||||
expect(daysOfWeek[2]).toHaveClass('fc-sat');
|
||||
expect(daysOfWeek[3]).toHaveClass('fc-fri');
|
||||
expect(daysOfWeek[4]).toHaveClass('fc-thu');
|
||||
expect(daysOfWeek[5]).toHaveClass('fc-wed');
|
||||
expect(daysOfWeek[6]).toHaveClass('fc-tue');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
describe('when header options set with next|prev|prevYear|nextYear|today', function() {
|
||||
describe('header navigation', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#calendar');
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
describe('header testing', function() {
|
||||
describe('header rendering', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#calendar');
|
||||
@@ -76,4 +76,34 @@ describe('header testing', function() {
|
||||
expect(headerTableCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('renders left and right literally', function() {
|
||||
[ true, false ].forEach(function(isRTL) {
|
||||
describe('when isRTL is ' + isRTL, function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev',
|
||||
center: 'today',
|
||||
right: 'next'
|
||||
},
|
||||
isRTL: isRTL
|
||||
});
|
||||
});
|
||||
it('should have prev in left', function() {
|
||||
var fcHeaderLeft = $('#calendar').find('.fc-header-left')[0];
|
||||
expect(fcHeaderLeft).toContainElement('.fc-button-prev');
|
||||
});
|
||||
it('should have today in center', function() {
|
||||
var fcHeaderCenter = $('#calendar').find('.fc-header-center')[0];
|
||||
expect(fcHeaderCenter).toContainElement('.fc-button-today');
|
||||
});
|
||||
it('should have next in right', function() {
|
||||
var fcHeaderRight = $('#calendar').find('.fc-header-right')[0];
|
||||
expect(fcHeaderRight).toContainElement('.fc-button-next');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,231 +0,0 @@
|
||||
|
||||
describe('isRTL tests', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when setting l:prev c:today r:next settings with isRTL default', function() {
|
||||
beforeEach(function() {
|
||||
var options = {
|
||||
header: {
|
||||
left: 'prev',
|
||||
center: 'today',
|
||||
right: 'next'
|
||||
}
|
||||
};
|
||||
$('#cal').fullCalendar(options);
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have prev in left', function() {
|
||||
var fcHeaderLeft = $(cal).find('.fc-header-left')[0];
|
||||
expect(fcHeaderLeft).toContainElement('.fc-button-prev');
|
||||
});
|
||||
it('should have today in center', function() {
|
||||
var fcHeaderCenter = $(cal).find('.fc-header-center')[0];
|
||||
expect(fcHeaderCenter).toContainElement('.fc-button-today');
|
||||
});
|
||||
it('should have next in right', function() {
|
||||
var fcHeaderRight = $(cal).find('.fc-header-right')[0];
|
||||
expect(fcHeaderRight).toContainElement('.fc-button-next');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when setting l:prev c:today r:next settings with isRTL false', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
header: {
|
||||
left: 'prev',
|
||||
center: 'today',
|
||||
right: 'next'
|
||||
},
|
||||
isRTL: false
|
||||
});
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have prev in left', function() {
|
||||
var fcHeaderLeft = $(cal).find('.fc-header-left')[0];
|
||||
expect(fcHeaderLeft).toContainElement('.fc-button-prev');
|
||||
});
|
||||
it('should have today in center', function() {
|
||||
var fcHeaderCenter = $(cal).find('.fc-header-center')[0];
|
||||
expect(fcHeaderCenter).toContainElement('.fc-button-today');
|
||||
});
|
||||
it('should have next in right', function() {
|
||||
var fcHeaderRight = $(cal).find('.fc-header-right')[0];
|
||||
expect(fcHeaderRight).toContainElement('.fc-button-next');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when setting l:prev c:today r:next settings with isRTL true', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
header: {
|
||||
left: 'prev',
|
||||
center: 'today',
|
||||
right: 'next'
|
||||
},
|
||||
isRTL: true
|
||||
});
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have prev in left', function() {
|
||||
var fcHeaderLeft = $(cal).find('.fc-header-left')[0];
|
||||
expect(fcHeaderLeft).toContainElement('.fc-button-prev');
|
||||
});
|
||||
it('should have today in center', function() {
|
||||
var fcHeaderCenter = $(cal).find('.fc-header-center')[0];
|
||||
expect(fcHeaderCenter).toContainElement('.fc-button-today');
|
||||
});
|
||||
it('should have next in right', function() {
|
||||
var fcHeaderRight = $(cal).find('.fc-header-right')[0];
|
||||
expect(fcHeaderRight).toContainElement('.fc-button-next');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using default view (month)', function() {
|
||||
|
||||
describe('using default isRTL', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar();
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $(cal).find('.fc-day-header');
|
||||
expect(fc[0]).toHaveClass('fc-sun');
|
||||
expect(fc[1]).toHaveClass('fc-mon');
|
||||
expect(fc[2]).toHaveClass('fc-tue');
|
||||
expect(fc[3]).toHaveClass('fc-wed');
|
||||
expect(fc[4]).toHaveClass('fc-thu');
|
||||
expect(fc[5]).toHaveClass('fc-fri');
|
||||
expect(fc[6]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('using default isRTL is set to false', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
isRTL: false
|
||||
});
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $(cal).find('.fc-day-header');
|
||||
expect(fc[0]).toHaveClass('fc-sun');
|
||||
expect(fc[1]).toHaveClass('fc-mon');
|
||||
expect(fc[2]).toHaveClass('fc-tue');
|
||||
expect(fc[3]).toHaveClass('fc-wed');
|
||||
expect(fc[4]).toHaveClass('fc-thu');
|
||||
expect(fc[5]).toHaveClass('fc-fri');
|
||||
expect(fc[6]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('using default isRTL is set to false', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
isRTL: true
|
||||
});
|
||||
var cal = $('#cal');
|
||||
});
|
||||
it('should have have days ordered back sat to sun', function() {
|
||||
var fc = $(cal).find('.fc-day-header');
|
||||
expect(fc[6]).toHaveClass('fc-sun');
|
||||
expect(fc[5]).toHaveClass('fc-mon');
|
||||
expect(fc[4]).toHaveClass('fc-tue');
|
||||
expect(fc[3]).toHaveClass('fc-wed');
|
||||
expect(fc[2]).toHaveClass('fc-thu');
|
||||
expect(fc[1]).toHaveClass('fc-fri');
|
||||
expect(fc[0]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using agendaWeek view', function() {
|
||||
|
||||
describe('when using default isRTL', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek'
|
||||
});
|
||||
});
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $(cal).find('.fc-agenda-days th');
|
||||
expect(fc[0]).toHaveClass('fc-agenda-axis');
|
||||
expect(fc[1]).toHaveClass('fc-sun');
|
||||
expect(fc[2]).toHaveClass('fc-mon');
|
||||
expect(fc[3]).toHaveClass('fc-tue');
|
||||
expect(fc[4]).toHaveClass('fc-wed');
|
||||
expect(fc[5]).toHaveClass('fc-thu');
|
||||
expect(fc[6]).toHaveClass('fc-fri');
|
||||
expect(fc[7]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using isRTL false', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
isRTL: false
|
||||
});
|
||||
});
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $(cal).find('.fc-agenda-days th');
|
||||
expect(fc[0]).toHaveClass('fc-agenda-axis');
|
||||
expect(fc[1]).toHaveClass('fc-sun');
|
||||
expect(fc[2]).toHaveClass('fc-mon');
|
||||
expect(fc[3]).toHaveClass('fc-tue');
|
||||
expect(fc[4]).toHaveClass('fc-wed');
|
||||
expect(fc[5]).toHaveClass('fc-thu');
|
||||
expect(fc[6]).toHaveClass('fc-fri');
|
||||
expect(fc[7]).toHaveClass('fc-sat');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using isRTL true', function() {
|
||||
beforeEach(function() {
|
||||
var options = {};
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
isRTL: true
|
||||
});
|
||||
});
|
||||
it('should have have days ordered sun to sat', function() {
|
||||
var fc = $(cal).find('.fc-agenda-days th');
|
||||
expect(fc[0]).toHaveClass('fc-agenda-axis');
|
||||
expect(fc[1]).toHaveClass('fc-sat');
|
||||
expect(fc[2]).toHaveClass('fc-fri');
|
||||
expect(fc[3]).toHaveClass('fc-thu');
|
||||
expect(fc[4]).toHaveClass('fc-wed');
|
||||
expect(fc[5]).toHaveClass('fc-tue');
|
||||
expect(fc[6]).toHaveClass('fc-mon');
|
||||
expect(fc[7]).toHaveClass('fc-sun');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('when using agendaWeek view', function() {
|
||||
describe('and switching from isRTL false to true', function() {
|
||||
beforeEach(function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
isRTL: false
|
||||
});
|
||||
});
|
||||
it('should result in sunday moving from first to last day', function() {
|
||||
var fcDaysBefore = $(cal).find('.fc-agenda-days th');
|
||||
$('#cal').fullCalendar('isRTL', 'true');
|
||||
var fcDaysAfter = $(cal).find('.fc-agenda-days th');
|
||||
expect(fcDaysBefore[1]).toHaveClass('fc-sun');
|
||||
expect(fcDaysAfter[7]).toHaveCalss('fc-sun');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
describe('updateEvent', function() {
|
||||
|
||||
;
|
||||
|
||||
});
|
||||
+103
-20
@@ -5,34 +5,117 @@ describe('weekNumbers', function() {
|
||||
affix('#cal');
|
||||
});
|
||||
|
||||
describe('when using default weekNumbers in default view', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar();
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
describe('when using month view', function() {
|
||||
|
||||
describe('when using default weekNumbers', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'month'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when setting weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'month',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when setting weekNumbers to true', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'month',
|
||||
weekNumbers: true,
|
||||
weekMode: 'fixed' // will make 6 rows
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 is the header row, the other 6 are the rows
|
||||
expect(weekNumbersCount).toEqual(7);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when setting weekNumbers to false in default view', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
weekNumbers: false
|
||||
describe('when using basicWeek view', function() {
|
||||
|
||||
describe('with default weekNumbers ', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'basicWeek',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is header
|
||||
// 1 row is actual week number
|
||||
expect(weekNumbersCount).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when setting weekNumbers to true in default view', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
weekNumbers: true
|
||||
describe('when using an agenda view', function() {
|
||||
|
||||
describe('with default weekNumbers', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek'
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
$('#cal').fullCalendar('gotoDate', 2013, 10);
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is header
|
||||
// 6 rows are week numbers
|
||||
expect(weekNumbersCount).toEqual(7);
|
||||
});
|
||||
|
||||
describe('with weekNumbers to false', function() {
|
||||
it('should not display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
weekNumbers: false
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
expect(weekNumbersCount).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with weekNumbers to true', function() {
|
||||
it('should display weekNumbers', function() {
|
||||
$('#cal').fullCalendar({
|
||||
defaultView: 'agendaWeek',
|
||||
weekNumbers: true
|
||||
});
|
||||
var weekNumbersCount = $('.fc-week-number').length;
|
||||
// 1 row is axis
|
||||
expect(weekNumbersCount).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user