mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-06-28 16:20:30 +08:00
58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
|
|
describe('events as an array', function() {
|
|
|
|
var options;
|
|
var eventArray;
|
|
|
|
beforeEach(function() {
|
|
affix('#cal');
|
|
options = {
|
|
defaultView: 'month',
|
|
defaultDate: '2014-05-01'
|
|
};
|
|
eventArray = [
|
|
{
|
|
title: 'my event',
|
|
start: '2014-05-21'
|
|
}
|
|
];
|
|
});
|
|
|
|
it('accepts an event using basic form', function(done) {
|
|
options.events = eventArray;
|
|
options.eventRender = function(eventObj, eventElm) {
|
|
expect(eventObj.title).toEqual('my event');
|
|
done();
|
|
};
|
|
$('#cal').fullCalendar(options);
|
|
});
|
|
|
|
it('accepts an event using extended form', function(done) {
|
|
options.eventSources = [
|
|
{
|
|
className: 'customeventclass',
|
|
events: eventArray
|
|
}
|
|
];
|
|
options.eventRender = function(eventObj, eventElm) {
|
|
expect(eventObj.title).toEqual('my event');
|
|
expect(eventElm).toHaveClass('customeventclass');
|
|
done();
|
|
};
|
|
$('#cal').fullCalendar(options);
|
|
});
|
|
|
|
it('doesn\'t mutate the original array', function(done) {
|
|
var origArray = eventArray;
|
|
var origEvent = eventArray[0];
|
|
options.events = eventArray;
|
|
options.eventRender = function(eventObj, eventElm) {
|
|
expect(origArray).toEqual(eventArray);
|
|
expect(origEvent).toEqual(eventArray[0]);
|
|
done();
|
|
};
|
|
$('#cal').fullCalendar(options);
|
|
});
|
|
|
|
});
|