Explorar el Código

change tests about eventDrop/eventResize

Adam Shaw hace 7 años
padre
commit
c98cb3fff9

+ 1 - 1
tests/automated/event-drag/EventDragUtils.js

@@ -21,7 +21,7 @@ export function drag(rect0, rect1, debug) {
     debug: debug
     debug: debug
   })
   })
 
 
-  currentCalendar.on('eventMutation', function(arg) {
+  currentCalendar.on('eventDrop', function(arg) {
     deferred.resolve(arg)
     deferred.resolve(arg)
   })
   })
 
 

+ 4 - 4
tests/automated/event-drag/repeating.js

@@ -46,7 +46,7 @@ describe('event dragging on repeating events', function() {
           ).toBe(1)
           ).toBe(1)
         }, 0)
         }, 0)
       },
       },
-      eventMutation: function() {
+      eventDrop: function() {
         setTimeout(function() {
         setTimeout(function() {
           done()
           done()
         }, 10)
         }, 10)
@@ -55,7 +55,7 @@ describe('event dragging on repeating events', function() {
 
 
     $('.fc-event:first').simulate('drag', {
     $('.fc-event:first').simulate('drag', {
       dx: 100,
       dx: 100,
-      duration: 100 // ample time for separate eventDragStart/eventMutation
+      duration: 100 // ample time for separate eventDragStart/eventDrop
     })
     })
   })
   })
 
 
@@ -82,7 +82,7 @@ describe('event dragging on repeating events', function() {
           ).toBe(2) // the dragging event AND the other regular event
           ).toBe(2) // the dragging event AND the other regular event
         }, 0)
         }, 0)
       },
       },
-      eventMutation: function() {
+      eventDrop: function() {
         setTimeout(function() {
         setTimeout(function() {
           done()
           done()
         }, 10)
         }, 10)
@@ -91,7 +91,7 @@ describe('event dragging on repeating events', function() {
 
 
     $('.fc-event:first').simulate('drag', {
     $('.fc-event:first').simulate('drag', {
       dx: 100,
       dx: 100,
-      duration: 100 // ample time for separate eventDragStart/eventMutation
+      duration: 100 // ample time for separate eventDragStart/eventDrop
     })
     })
   })
   })
 
 

+ 1 - 1
tests/automated/event-resize/EventResizeUtils.js

@@ -27,7 +27,7 @@ export function resize(rect0, rect1, debug) {
     debug: debug
     debug: debug
   })
   })
 
 
-  currentCalendar.on('eventMutation', function(arg) {
+  currentCalendar.on('eventResize', function(arg) {
     deferred.resolve(arg)
     deferred.resolve(arg)
   })
   })
 
 

+ 10 - 14
tests/automated/legacy/event-dnd.js

@@ -45,8 +45,7 @@ describe('eventDrop', function() {
               },
               },
               function(arg) {
               function(arg) {
                 var delta = FullCalendar.createDuration({ day: 9 })
                 var delta = FullCalendar.createDuration({ day: 9 })
-                expect(arg.mutation.startDelta).toEqual(delta)
-                expect(arg.mutation.endDelta).toEqual(delta)
+                expect(arg.delta).toEqual(delta)
 
 
                 expect(arg.event.start).toEqualDate('2014-06-20')
                 expect(arg.event.start).toEqualDate('2014-06-20')
                 expect(arg.event.end).toBeNull()
                 expect(arg.event.end).toBeNull()
@@ -82,8 +81,7 @@ describe('eventDrop', function() {
           },
           },
           function(arg) {
           function(arg) {
             var delta = FullCalendar.createDuration({ day: 5 })
             var delta = FullCalendar.createDuration({ day: 5 })
-            expect(arg.mutation.startDelta).toEqual(delta)
-            expect(arg.mutation.endDelta).toEqual(delta)
+            expect(arg.delta).toEqual(delta)
 
 
             expect(arg.event.start).toEqualDate('2014-06-16T06:00:00Z')
             expect(arg.event.start).toEqualDate('2014-06-16T06:00:00Z')
             expect(arg.event.end).toBeNull()
             expect(arg.event.end).toBeNull()
@@ -176,8 +174,7 @@ describe('eventDrop', function() {
               },
               },
               function(arg) {
               function(arg) {
                 var delta = FullCalendar.createDuration({ day: 1, hour: 1, minute: 30 })
                 var delta = FullCalendar.createDuration({ day: 1, hour: 1, minute: 30 })
-                expect(arg.mutation.startDelta).toEqual(delta)
-                expect(arg.mutation.endDelta).toEqual(delta)
+                expect(arg.delta).toEqual(delta)
 
 
                 expect(arg.event.start).toEqualDate('2014-06-12T07:30:00Z')
                 expect(arg.event.start).toEqualDate('2014-06-12T07:30:00Z')
                 expect(arg.event.end).toBeNull()
                 expect(arg.event.end).toBeNull()
@@ -212,8 +209,7 @@ describe('eventDrop', function() {
           },
           },
           function(arg) {
           function(arg) {
             var delta = FullCalendar.createDuration({ day: 2 })
             var delta = FullCalendar.createDuration({ day: 2 })
-            expect(arg.mutation.startDelta).toEqual(delta)
-            expect(arg.mutation.endDelta).toEqual(delta)
+            expect(arg.delta).toEqual(delta)
 
 
             expect(arg.event.start).toEqualDate('2014-06-13')
             expect(arg.event.start).toEqualDate('2014-06-13')
             expect(arg.event.end).toBeNull()
             expect(arg.event.end).toBeNull()
@@ -251,8 +247,7 @@ describe('eventDrop', function() {
           },
           },
           function(arg) {
           function(arg) {
             let delta = FullCalendar.createDuration({ day: -1, hour: 1 })
             let delta = FullCalendar.createDuration({ day: -1, hour: 1 })
-            expect(arg.mutation.startDelta).toEqual(delta)
-            expect(arg.mutation.endDelta).toEqual(delta)
+            expect(arg.delta).toEqual(delta)
 
 
             expect(arg.event.start).toEqualDate('2014-06-10T01:00:00Z')
             expect(arg.event.start).toEqualDate('2014-06-10T01:00:00Z')
             expect(arg.event.end).toBeNull()
             expect(arg.event.end).toBeNull()
@@ -305,8 +300,7 @@ describe('eventDrop', function() {
           },
           },
           function(arg) {
           function(arg) {
             var delta = FullCalendar.createDuration({ day: -1 })
             var delta = FullCalendar.createDuration({ day: -1 })
-            expect(arg.mutation.startDelta).toEqual(delta)
-            expect(arg.mutation.endDelta).toEqual(delta)
+            expect(arg.delta).toEqual(delta)
 
 
             expect(arg.event.start).toEqualDate('2014-06-10')
             expect(arg.event.start).toEqualDate('2014-06-10')
             expect(arg.event.end).toBeNull()
             expect(arg.event.end).toBeNull()
@@ -414,10 +408,12 @@ describe('eventDrop', function() {
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.view).toBe('object')
       expect(typeof arg.view).toBe('object')
     }
     }
-    options.eventMutation = function(arg) {
+    options.eventDrop = function(arg) {
       expect(options.eventDragStop).toHaveBeenCalled()
       expect(options.eventDragStop).toHaveBeenCalled()
 
 
-      expect(typeof arg.mutation).toBe('object')
+      expect(arg.el instanceof Element).toBe(true)
+      expect(arg.el).toHaveClass('fc-event')
+      expect(typeof arg.delta).toBe('object')
       expect(typeof arg.revert).toBe('function')
       expect(typeof arg.revert).toBe('function')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.view).toBe('object')
       expect(typeof arg.view).toBe('object')

+ 13 - 10
tests/automated/legacy/event-resize.js

@@ -27,7 +27,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ day: 5 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ day: 5 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11')
             expect(arg.event.start).toEqualDate('2014-06-11')
             expect(arg.event.end).toEqualDate('2014-06-17')
             expect(arg.event.end).toEqualDate('2014-06-17')
@@ -76,7 +76,7 @@ describe('eventResize', function() {
                 })
                 })
               },
               },
               function(arg) {
               function(arg) {
-                expect(arg.delta).toEqual(FullCalendar.createDuration({ day: 5 }))
+                expect(arg.endDelta).toEqual(FullCalendar.createDuration({ day: 5 }))
 
 
                 expect(arg.event.start).toEqualDate('2014-06-11')
                 expect(arg.event.start).toEqualDate('2014-06-11')
                 expect(arg.event.end).toEqualDate('2014-06-17')
                 expect(arg.event.end).toEqualDate('2014-06-17')
@@ -133,7 +133,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ day: 2 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ day: 2 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11')
             expect(arg.event.start).toEqualDate('2014-06-11')
             expect(arg.event.end).toEqualDate('2014-06-14')
             expect(arg.event.end).toEqualDate('2014-06-14')
@@ -171,7 +171,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00Z')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00Z')
@@ -207,7 +207,7 @@ describe('eventResize', function() {
             }, 0)
             }, 0)
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00Z')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00Z')
@@ -236,7 +236,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ day: 1, hour: 2, minute: 30 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ day: 1, hour: 2, minute: 30 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.end).toEqualDate('2014-06-12T09:30:00Z')
             expect(arg.event.end).toEqualDate('2014-06-12T09:30:00Z')
@@ -264,7 +264,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00') // local
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00') // local
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00') // local
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00') // local
@@ -292,7 +292,7 @@ describe('eventResize', function() {
             })
             })
           },
           },
           function(arg) {
           function(arg) {
-            expect(arg.delta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
+            expect(arg.endDelta).toEqual(FullCalendar.createDuration({ hour: 2, minute: 30 }))
 
 
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00+00:00')
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00+00:00')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00+00:00')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00+00:00')
@@ -474,11 +474,14 @@ describe('eventResize', function() {
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.view).toBe('object')
       expect(typeof arg.view).toBe('object')
     }
     }
-    options.eventMutation = function(arg) {
+    options.eventResize = function(arg) {
       expect(options.eventResizeStop).toHaveBeenCalled()
       expect(options.eventResizeStop).toHaveBeenCalled()
 
 
+      expect(arg.el instanceof Element).toBe(true)
+      expect(arg.el).toHaveClass('fc-event')
       expect(typeof arg.event).toBe('object')
       expect(typeof arg.event).toBe('object')
-      expect(typeof arg.mutation).toBe('object')
+      expect(typeof arg.startDelta).toBe('object')
+      expect(typeof arg.endDelta).toBe('object')
       expect(typeof arg.revert).toBe('function')
       expect(typeof arg.revert).toBe('function')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.jsEvent).toBe('object')
       expect(typeof arg.view).toBe('object')
       expect(typeof arg.view).toBe('object')

+ 3 - 3
tests/automated/legacy/eventLimit-popover.js

@@ -276,7 +276,7 @@ describe('eventLimit popover', function() {
       it('should have the new day and remain all-day', function(done) {
       it('should have the new day and remain all-day', function(done) {
 
 
         initCalendar({
         initCalendar({
-          eventMutation: function(arg) {
+          eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-28')
             expect(arg.event.start).toEqualDate('2014-07-28')
             expect(arg.event.isAllDay).toBe(true)
             expect(arg.event.isAllDay).toBe(true)
             done()
             done()
@@ -305,7 +305,7 @@ describe('eventLimit popover', function() {
 
 
         initCalendar({
         initCalendar({
           events: testEvents,
           events: testEvents,
-          eventMutation: function(arg) {
+          eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-28T13:00:00Z')
             expect(arg.event.start).toEqualDate('2014-07-28T13:00:00Z')
             expect(arg.event.isAllDay).toBe(false)
             expect(arg.event.isAllDay).toBe(false)
             done()
             done()
@@ -329,7 +329,7 @@ describe('eventLimit popover', function() {
         initCalendar({
         initCalendar({
           defaultView: 'agendaWeek',
           defaultView: 'agendaWeek',
           scrollTime: '00:00:00',
           scrollTime: '00:00:00',
-          eventMutation: function(arg) {
+          eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-30T03:00:00Z')
             expect(arg.event.start).toEqualDate('2014-07-30T03:00:00Z')
             expect(arg.event.isAllDay).toBe(false)
             expect(arg.event.isAllDay).toBe(false)
             done()
             done()