defaultTimedEventDuration.js
3.08 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
describe('defaultTimedEventDuration', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-05-01',
defaultView: 'month'
};
});
describe('when forceEventDuration is on', function() {
beforeEach(function() {
options.forceEventDuration = true;
});
it('correctly calculates an unspecified end when using a Duration object input', function() {
options.defaultTimedEventDuration = { hours: 2, minutes: 30 };
options.events = [
{
allDay: false,
start: '2014-05-05T04:00:00'
}
];
$('#cal').fullCalendar(options);
var event = $('#cal').fullCalendar('clientEvents')[0];
expect(event.end).toEqualMoment('2014-05-05T06:30:00');
});
it('correctly calculates an unspecified end when using a string Duration input', function() {
options.defaultTimedEventDuration = '03:15:00';
options.events = [
{
allDay: false,
start: '2014-05-05T04:00:00'
}
];
$('#cal').fullCalendar(options);
var event = $('#cal').fullCalendar('clientEvents')[0];
expect(event.end).toEqualMoment('2014-05-05T07:15:00');
});
});
describe('when forceEventDuration is off', function() {
beforeEach(function() {
options.forceEventDuration = false;
});
describe('with agendaWeek view', function() {
beforeEach(function() {
options.defaultView = 'agendaWeek';
});
it('renders a timed event with no `end` to appear to have the default duration', function(done) {
options.defaultTimedEventDuration = '01:15:00';
options.events = [
{
// a control. so we know how tall it should be
title: 'control event',
allDay: false,
start: '2014-05-01T04:00:00',
end: '2014-05-01T05:15:00'
},
{
// one day after the control. no specified end
title: 'test event',
allDay: false,
start: '2014-05-02T04:00:00'
}
];
options.eventAfterAllRender = function() {
var eventElms = $('#cal .fc-event');
var height0 = eventElms.eq(0).outerHeight();
var height1 = eventElms.eq(1).outerHeight();
expect(height0).toEqual(height1);
done();
};
$('#cal').fullCalendar(options);
});
});
describe('with basicWeek view', function() {
beforeEach(function() {
options.defaultView = 'basicWeek';
});
it('renders a timed event with no `end` to appear to have the default duration', function(done) {
options.defaultTimedEventDuration = { days: 2 };
options.events = [
{
// a control. so we know how wide it should be
title: 'control event',
allDay: false,
start: '2014-04-28T04:00:00',
end: '2014-04-30T00:00:00'
},
{
// one day after the control. no specified end
title: 'test event',
allDay: false,
start: '2014-04-28T04:00:00'
}
];
options.eventAfterAllRender = function() {
var eventElms = $('#cal .fc-event');
var width0 = eventElms.eq(0).outerWidth();
var width1 = eventElms.eq(1).outerWidth();
expect(width0).toEqual(width1);
done();
};
$('#cal').fullCalendar(options);
});
});
});
});