mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-08-15 12:25:20 +08:00
prevent massive memory leaks when automated tests run
This commit is contained in:
@@ -10,12 +10,17 @@ describe('eventDestroy', function() {
|
||||
});
|
||||
|
||||
function testSingleEvent(singleEventData, done) {
|
||||
var callCnt = 0;
|
||||
|
||||
expect(singleEventData.id).toBeTruthy();
|
||||
options.events = [ singleEventData ];
|
||||
options.eventDestroy = function(event, element) {
|
||||
expect(event.id).toBe(singleEventData.id);
|
||||
done();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -159,3 +159,9 @@ beforeEach(function() {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Destroy the calendar afterwards, to prevent memory leaks
|
||||
// (not the best place for this)
|
||||
afterEach(function() {
|
||||
$('#calendar,#cal').fullCalendar('destroy'); // common id's for calendars in tests
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user