slotDuration.js
2.61 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
88
89
90
91
92
93
94
95
96
describe('slotDuration', function() {
var minutesInADay = 1440;
beforeEach(function() {
affix('#cal');
});
describe('when using the default settings', function() {
describe('in agendaWeek', function() {
it('should have slots 1440/30 slots', function() {
var options = {
defaultView: 'agendaWeek'
};
$('#cal').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
expect(slotCount).toEqual(Math.ceil(minutesInADay / 30));
});
});
describe('in agendaDay', function() {
it('should have slots 1440/30 slots', function() {
var options = {
defaultView: 'agendaDay'
};
$('#cal').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
expect(slotCount).toEqual(Math.ceil(minutesInADay / 30));
});
});
});
describe('when slotMinutes is set to 30', function() {
describe('in agendaWeek', function() {
it('should have slots 1440/30 slots', function() {
var options = {
defaultView: 'agendaWeek'
};
$('#cal').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
expect(slotCount).toEqual(Math.ceil(minutesInADay / 30));
});
});
describe('in agendaDay', function() {
it('should have slots 1440/30 slots', function() {
var options = {
defaultView: 'agendaDay'
};
$('#cal').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
expect(slotCount).toEqual(Math.ceil(minutesInADay / 30));
});
});
});
describe('when slotMinutes is set to a series of times', function() {
var slotMinutesList = [ 10, 12, 15, 17, 20, 30, 35, 45, 60, 62, 120, 300 ];
describe('in agendaWeek', function() {
beforeEach(function() {
affix('#cal2');
});
slotMinutesList.forEach(function(slotMinutes) {
it('should have slots 1440/x slots', function() {
var options = {
defaultView: 'agendaWeek',
slotDuration: { minutes: slotMinutes }
};
$('#cal2').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
var expected = Math.ceil(minutesInADay / slotMinutes);
expect(slotCount).toEqual(expected);
});
});
});
describe('in agendaDay', function() {
beforeEach(function() {
affix('#cal2');
});
slotMinutesList.forEach(function(slotMinutes) {
it('should have slots 1440/x slots', function() {
var options = {
defaultView: 'agendaWeek',
slotDuration: { minutes: slotMinutes }
};
$('#cal2').fullCalendar(options);
var slotCount = $('.fc-slats tr').length;
var expected = Math.ceil(minutesInADay / slotMinutes);
expect(slotCount).toEqual(expected);
});
});
});
});
});