constructor.js
2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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-toolbar', function() {
var header = $('#calendar > .fc-toolbar');
expect(header[0]).not.toBeUndefined();
});
it('should contain a div fc-view-container', function() {
var content = ($('#calendar > .fc-view-container'));
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);
});
});
});
});