Permalink
Browse files

Merge pull request #7325 from lightsofapollo/calendar-weekview-crash

Bug 827249 - Delete currentFrame when it is purged.
  • Loading branch information...
2 parents 2972142 + e8d6b3b commit f80478e3c7e68156c36071867ecbf9fef13329de @KevinGrandon KevinGrandon committed Jan 7, 2013
Showing with 14 additions and 0 deletions.
  1. +5 −0 apps/calendar/js/views/time_parent.js
  2. +9 −0 apps/calendar/test/unit/views/time_parent_test.js
View
5 apps/calendar/js/views/time_parent.js
@@ -209,6 +209,11 @@ Calendar.ns('Views').TimeParent = (function() {
for (; i < len; i++) {
child = this.frames.items[i - offset][1];
if (span.contains(child.timespan)) {
+ // Bug 827249 - remove current frame when its purged.
+ if (this.currentFrame === child) {
+ this.currentFrame = null;
+ }
+
child.destroy();
this.frames.items.splice(i - offset, 1);
offset += 1;
View
9 apps/calendar/test/unit/views/time_parent_test.js
@@ -329,6 +329,10 @@ suite('views/time_parent', function() {
subject.frames.set(items[key].id, items[key]);
}
+ // set current frame to a frame
+ // that will be deleted...
+ subject.currentFrame = items.contains;
+
subject.purgeFrames(purgeSpan);
});
@@ -342,6 +346,11 @@ suite('views/time_parent', function() {
assert.ok(!frames.get(items.same.id), 'removed same');
assert.ok(!frames.get(items.contains.id), 'removed contains');
+ assert.ok(
+ !subject.currentFrame,
+ 'removes current frame when it is deleted'
+ );
+
assert.isTrue(items.same.destroyed);
assert.isTrue(items.contains.destroyed);
});

0 comments on commit f80478e

Please sign in to comment.