Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Bug 1065520 - [Calendar][Week View] Events still display in W…
Browse files Browse the repository at this point in the history
…eek view after they are deleted from another View"

This reverts commit cdd1727.
  • Loading branch information
KevinGrandon committed Oct 8, 2014
1 parent 217f6e7 commit 4c57307
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
10 changes: 7 additions & 3 deletions apps/calendar/js/day_observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ exports.on = function(date, callback) {
exports.DISPATCH_DELAY
);
exports.timeController.observeTime(Calc.spanOfDay(date), dispatch);
// we need to trigger callbacks to re-render the views if needed,
// cachedRecords is only built after first dispatch
dispatch();

// if there is some busytime cached on the time controller we dispatch
// an update to all the listeners
var busytimes = getBusytimes(date);
if (busytimes.length) {
dispatch();
}
} else if (dayId in cachedRecords) {
// if it is not the first listener and we have some records in memory we
// should also call the callback
Expand Down
23 changes: 0 additions & 23 deletions apps/calendar/test/marionette/week_view_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,29 +306,6 @@ marionette('week view', function() {
});
});

test('delete', function() {
app.createEvent({
title: 'Foo',
location: 'Bar'
});
client.waitFor(function() {
return app.week.events.length === 1;
}, { timeout: 2000 });

app.openMonthView();
app.monthDay.events[0].click();
app.readEvent.waitForDisplay();
app.readEvent.edit();
app.editEvent.waitForDisplay();
app.editEvent.delete();
app.month.waitForDisplay();
app.openWeekView();

client.waitFor(function() {
return app.week.events.length === 0;
}, { timeout: 2000 });
});

function pad(n) {
return n < 10 ? '0' + n : String(n);
}
Expand Down
13 changes: 7 additions & 6 deletions apps/calendar/test/unit/day_observer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ suite('day_observer', function() {
setTimeout(function() {
callback(null, busytimes.map((busy) => _records.get(busy)));
});
this.called = true;
};

subject.timeController = timeController;
Expand Down Expand Up @@ -120,15 +121,15 @@ suite('day_observer', function() {
});

test('not cached', function(done) {
// we should call the handler even if no records because events might be
// deleted while the view is not active. that way we use the same code
// path for all cases (first render and updates)
timeController.cacheBusytime(busyToday1);
subject.on(yesterday, function(records) {
assert.deepEqual(records, [], 'no records');
done();
subject.on(yesterday, function() {
done(new Error('this should not execute!!!'));
});
clock.tick(delay);
assert.ok(
!timeController.findAssociated.called, 'don\'t call findAssociated'
);
done();
});

test('add more', function(done) {
Expand Down

0 comments on commit 4c57307

Please sign in to comment.