eventDestroy.js
1.25 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
describe('eventDestroy', function() {
var options;
beforeEach(function() {
affix('#cal');
options = {
defaultDate: '2014-08-01'
};
});
function testSingleEvent(singleEventData, done) {
var callCnt = 0;
expect(singleEventData.id).toBeTruthy();
options.events = [ singleEventData ];
options.eventDestroy = function(event, element) {
if (callCnt++ === 0) { // only care about the first call. gets called again when calendar is destroyed
expect(event.id).toBe(singleEventData.id);
done();
}
};
$('#cal').fullCalendar(options);
$('#cal').fullCalendar('removeEvents', singleEventData.id);
}
describe('when in month view', function() { // for issue 2017
beforeEach(function() {
options.defaultView = 'month';
});
it('gets called with removeEvents method', function(done) {
testSingleEvent({
id: 1,
title: 'event1',
date: '2014-08-02'
}, done);
});
});
describe('when in agendaWeek view', function() { // for issue 2017
beforeEach(function() {
options.defaultView = 'agendaWeek';
options.scrollTime = '00:00:00';
});
it('gets called with removeEvents method', function(done) {
testSingleEvent({
id: 1,
title: 'event1',
date: '2014-08-02T02:00:00'
}, done);
});
});
});