prevent massive memory leaks when automated tests run

This commit is contained in:
Adam Shaw
2014-08-24 20:03:49 -07:00
parent ea95db29f4
commit 16b3c4f871
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -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);
}
+6
View File
@@ -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
});