Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit ab2e62f

Browse files
committed
fix(calendar.js): dont call rerenderEvents when we change event sources
Signed-off-by: Josh Kurz <josh.kurz@turner.com>
1 parent eef6f9a commit ab2e62f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/calendar.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ angular.module('ui.calendar', [])
253253
scope.init();
254254
eventSourcesWatcher.subscribe(scope);
255255
eventsWatcher.subscribe(scope, function(newTokens, oldTokens) {
256-
if (sourcesChanged) {
257-
// Rerender the whole thing if a new event source was added/removed
258-
scope.calendar.fullCalendar('rerenderEvents');
256+
if (sourcesChanged === true) {
259257
sourcesChanged = false;
260258
// prevent incremental updates in this case
261259
return false;

test/calendar.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('uiCalendar', function () {
134134
scope.$apply();
135135
//eventSources should auto update inside the calendar.
136136
var fullCalendarParam = $.fn.fullCalendar.mostRecentCall.args[0];
137-
expect(fullCalendarParam).toEqual('rerenderEvents');
137+
expect(fullCalendarParam).toEqual('addEventSource');
138138
});
139139
/* Test to see if calendar is updating when an eventSource replaces another with an equal length. */
140140
it('updates the calendar if an eventSource has same length as prior eventSource', function () {
@@ -144,23 +144,23 @@ describe('uiCalendar', function () {
144144
//eventSources should update inside the calendar
145145
var callCount = $.fn.fullCalendar.callCount;
146146
var fullCalendarParam = $.fn.fullCalendar.mostRecentCall.args[0];
147-
expect(fullCalendarParam).toEqual('rerenderEvents');
147+
expect(fullCalendarParam).toEqual('addEventSource');
148148
//fullcalendar has called 3 of its own events at this time. Remove, Add, and Rerender
149-
expect(callCount).toEqual(4);
149+
expect(callCount).toEqual(3);
150150
//remove an event to prove autobinding still works
151151
scope.remove(scope.events,0);
152152
scope.$apply();
153153
fullCalendarParam = $.fn.fullCalendar.mostRecentCall.args[0];
154154
callCount = $.fn.fullCalendar.callCount;
155155
expect(fullCalendarParam).toEqual('removeEvents');
156-
expect(callCount).toEqual(5);
156+
expect(callCount).toEqual(4);
157157
});
158158

159159
it('make sure the calendar can work with extended event sources', function () {
160160
scope.eventSources.push(scope.calEventsExt);
161161
scope.$apply();
162162
var fullCalendarParam = $.fn.fullCalendar.mostRecentCall.args[0];
163-
expect(fullCalendarParam).toEqual('rerenderEvents');
163+
expect(fullCalendarParam).toEqual('addEventSource');
164164
});
165165

166166
it('make sure that if we just change the title of the event that it updates itself', function () {

0 commit comments

Comments
 (0)