mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-06-28 16:20:30 +08:00
87 lines
2.1 KiB
JavaScript
87 lines
2.1 KiB
JavaScript
|
|
describe('constructor', function() {
|
|
|
|
beforeEach(function() {
|
|
affix('#calendar');
|
|
});
|
|
|
|
it('should return a jQuery object for chaining', function() {
|
|
var res = $('#calendar').fullCalendar();
|
|
expect(res instanceof jQuery).toBe(true);
|
|
});
|
|
|
|
it('should not modify the options object', function() {
|
|
var options = {
|
|
defaultView: 'agendaWeek',
|
|
scrollTime: '09:00:00',
|
|
slotDuration: { minutes: 45 }
|
|
};
|
|
var optionsCopy = $.extend({}, options, true);
|
|
$('#calendar').fullCalendar(options);
|
|
expect(options).toEqual(optionsCopy);
|
|
});
|
|
|
|
it('should not modify the events array', function() {
|
|
var options = {
|
|
defaultView: 'month',
|
|
defaultDate: '2014-05-27',
|
|
events: [
|
|
{
|
|
title: 'mytitle',
|
|
start: '2014-05-27'
|
|
}
|
|
]
|
|
};
|
|
var optionsCopy = $.extend(true, {}, options); // recursive copy
|
|
$('#calendar').fullCalendar(options);
|
|
expect(options).toEqual(optionsCopy);
|
|
});
|
|
|
|
it('should not modify the eventSources array', function() {
|
|
var options = {
|
|
defaultView: 'month',
|
|
defaultDate: '2014-05-27',
|
|
eventSources: [
|
|
{ events: [
|
|
{
|
|
title: 'mytitle',
|
|
start: '2014-05-27'
|
|
}
|
|
] }
|
|
]
|
|
};
|
|
var optionsCopy = $.extend(true, {}, options); // recursive copy
|
|
$('#calendar').fullCalendar(options);
|
|
expect(options).toEqual(optionsCopy);
|
|
});
|
|
|
|
describe('when called on a div', function() {
|
|
|
|
beforeEach(function() {
|
|
$('#calendar').fullCalendar();
|
|
});
|
|
|
|
it('should contain a table fc-header', function() {
|
|
var header = $('#calendar > table.fc-header');
|
|
expect(header[0]).not.toBeUndefined();
|
|
});
|
|
|
|
it('should contain a div fc-content', function() {
|
|
var content = ($('#calendar > div.fc-content'));
|
|
expect(content[0]).not.toBeUndefined();
|
|
});
|
|
|
|
it('should only contain 2 elements', function() {
|
|
var calenderNodeCount = $('#calendar >').length;
|
|
expect(calenderNodeCount).toEqual(2);
|
|
});
|
|
|
|
describe('and then called again', function() {
|
|
it('should still only have a single set of calendar [header,content]', function() {
|
|
$('#calendar').fullCalendar();
|
|
var count = $('#calendar >').length;
|
|
expect(count).toEqual(2);
|
|
});
|
|
});
|
|
});
|
|
}); |