This repository was archived by the owner on Sep 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,12 @@ angular.module('ui.calendar', [])
284
284
} ;
285
285
286
286
eventsWatcher . onChanged = function ( event ) {
287
- event . _start = jQuery . fullCalendar . moment ( event . start ) ;
288
- event . _end = jQuery . fullCalendar . moment ( event . end ) ;
289
- calendar . fullCalendar ( 'updateEvent' , event ) ;
287
+ var clientEvents = calendar . fullCalendar ( 'clientEvents' , event . _id ) ;
288
+ for ( var i = 0 ; i < clientEvents . length ; i ++ ) {
289
+ var clientEvent = clientEvents [ i ] ;
290
+ clientEvent = angular . extend ( clientEvent , event ) ;
291
+ calendar . fullCalendar ( 'updateEvent' , clientEvent ) ;
292
+ }
290
293
} ;
291
294
292
295
eventSourcesWatcher . subscribe ( scope ) ;
Original file line number Diff line number Diff line change @@ -172,12 +172,20 @@ describe('uiCalendar', function () {
172
172
} ) ;
173
173
174
174
it ( 'should make sure that if we just change the title of the event that it updates itself' , function ( ) {
175
+ var originalEvent = angular . copy ( scope . events [ 0 ] ) ;
176
+ $ . fn . fullCalendar . andCallFake ( function ( method ) {
177
+ if ( method === 'clientEvents' ) {
178
+ return [ originalEvent ] ;
179
+ }
180
+ } ) ;
175
181
scope . events [ 0 ] . title = 'change title' ;
176
182
scope . $apply ( ) ;
177
183
var fullCalendarParam = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] ;
178
184
var fullCalendarParam1 = $ . fn . fullCalendar . mostRecentCall . args [ 1 ] ;
179
185
expect ( fullCalendarParam ) . toEqual ( 'updateEvent' ) ;
180
- expect ( fullCalendarParam1 ) . toEqual ( scope . events [ 0 ] ) ;
186
+ expect ( fullCalendarParam1 ) . toEqual ( originalEvent ) ;
187
+ // fullCalendar 'updateEvent' need an original Event Object
188
+ expect ( fullCalendarParam1 ) . toBe ( originalEvent ) ;
181
189
} ) ;
182
190
183
191
it ( 'should make sure that if the calendars options change then the fullcalendar method is called with the new options' , function ( ) {
You can’t perform that action at this time.
0 commit comments