forceEventDuration.js
1.45 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
describe('forceEventDuration', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-05-01',
defaultView: 'month'
};
});
describe('when turned off', function() {
beforeEach(function() {
options.forceEventDuration = false;
});
it('allows a null end date for all-day and timed events', function() {
options.events = [
{
id: '1',
start: '2014-05-10'
},
{
id: '2',
start: '2014-05-10T14:00:00'
}
];
$('#cal').fullCalendar(options);
var events = $('#cal').fullCalendar('clientEvents');
expect(events[0].end).toBeNull();
expect(events[1].end).toBeNull();
});
});
describe('when turned on', function() {
beforeEach(function() {
options.forceEventDuration = true;
});
it('allows a null end date for all-day and timed events', function() {
options.events = [
{
id: '1',
start: '2014-05-10'
},
{
id: '2',
start: '2014-05-10T14:00:00'
}
];
$('#cal').fullCalendar(options);
var events = $('#cal').fullCalendar('clientEvents');
expect(events[0].id).toEqual('1');
expect(moment.isMoment(events[0].end)).toEqual(true);
expect(events[1].id).toEqual('2');
expect(moment.isMoment(events[1].end)).toEqual(true);
});
});
// NOTE: the actual verification of the correct calculation of the end
// (using defaultTimedEventDuration and defaultAllDayEventDuration)
// is done in those test files.
});