Преглед изворни кода

eventMouseover/eventMouseout -> eventMouseEnter/eventMouseLeave

Adam Shaw пре 7 година
родитељ
комит
0f9b1cb245

+ 3 - 3
src/interactions/EventHovering.ts

@@ -31,7 +31,7 @@ export default class EventHovering {
     this.component.emitter.off('eventElRemove', this.handleEventElRemove)
     this.component.emitter.off('eventElRemove', this.handleEventElRemove)
   }
   }
 
 
-  // for simulating an eventMouseout when the event el is destroyed while mouse is over it
+  // for simulating an eventMouseLeave when the event el is destroyed while mouse is over it
   handleEventElRemove = (el: HTMLElement) => {
   handleEventElRemove = (el: HTMLElement) => {
     if (el === this.currentSegEl) {
     if (el === this.currentSegEl) {
       this.handleSegLeave(null, this.currentSegEl)
       this.handleSegLeave(null, this.currentSegEl)
@@ -42,7 +42,7 @@ export default class EventHovering {
     if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper
     if (getElSeg(segEl)) { // TODO: better way to make sure not hovering over more+ link or its wrapper
       segEl.classList.add('fc-allow-mouse-resize')
       segEl.classList.add('fc-allow-mouse-resize')
       this.currentSegEl = segEl
       this.currentSegEl = segEl
-      this.triggerEvent('eventMouseover', ev, segEl)
+      this.triggerEvent('eventMouseEnter', ev, segEl)
     }
     }
   }
   }
 
 
@@ -50,7 +50,7 @@ export default class EventHovering {
     if (this.currentSegEl) {
     if (this.currentSegEl) {
       segEl.classList.remove('fc-allow-mouse-resize')
       segEl.classList.remove('fc-allow-mouse-resize')
       this.currentSegEl = null
       this.currentSegEl = null
-      this.triggerEvent('eventMouseout', ev, segEl)
+      this.triggerEvent('eventMouseLeave', ev, segEl)
     }
     }
   }
   }
 
 

+ 2 - 2
src/types/input-types.ts

@@ -179,8 +179,8 @@ export interface OptionsInputBase {
   windowResize?(view: View): void
   windowResize?(view: View): void
   dateClick?(arg: { date: Date, isAllDay: boolean, resource: any, el: HTMLElement, jsEvent: MouseEvent, view: View }): void // resource for Scheduler
   dateClick?(arg: { date: Date, isAllDay: boolean, resource: any, el: HTMLElement, jsEvent: MouseEvent, view: View }): void // resource for Scheduler
   eventClick?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): boolean | void
   eventClick?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): boolean | void
-  eventMouseover?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void
-  eventMouseout?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void
+  eventMouseEnter?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void
+  eventMouseLeave?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void
   select?(arg: { start: Date, end: Date, isAllDay: boolean, resource: any, jsEvent: MouseEvent, view: View }): void // resource for Scheduler
   select?(arg: { start: Date, end: Date, isAllDay: boolean, resource: any, jsEvent: MouseEvent, view: View }): void // resource for Scheduler
   unselect?(arg: { view: View, jsEvent: Event }): void
   unselect?(arg: { view: View, jsEvent: Event }): void
   eventDataTransform?(eventData: any): EventInput
   eventDataTransform?(eventData: any): EventInput

+ 8 - 8
tests/automated/legacy/event-dnd.js

@@ -98,8 +98,8 @@ describe('eventDrop', function() {
       })
       })
     })
     })
 
 
-    // TODO: tests for eventMouseover/eventMouseout firing correctly when no dragging
-    it('should not fire any eventMouseover/eventMouseout events while dragging', function(done) { // issue 1297
+    // TODO: tests for eventMouseEnter/eventMouseLeave firing correctly when no dragging
+    it('should not fire any eventMouseEnter/eventMouseLeave events while dragging', function(done) { // issue 1297
       options.events = [
       options.events = [
         {
         {
           title: 'all-day event',
           title: 'all-day event',
@@ -114,10 +114,10 @@ describe('eventDrop', function() {
           className: 'event2'
           className: 'event2'
         }
         }
       ]
       ]
-      options.eventMouseover = function() { }
-      options.eventMouseout = function() { }
-      spyOn(options, 'eventMouseover')
-      spyOn(options, 'eventMouseout')
+      options.eventMouseEnter = function() { }
+      options.eventMouseLeave = function() { }
+      spyOn(options, 'eventMouseEnter')
+      spyOn(options, 'eventMouseLeave')
 
 
       init(
       init(
         function() {
         function() {
@@ -136,8 +136,8 @@ describe('eventDrop', function() {
           }, 500)
           }, 500)
         },
         },
         function(arg) {
         function(arg) {
-          expect(options.eventMouseover).not.toHaveBeenCalled()
-          expect(options.eventMouseout).not.toHaveBeenCalled()
+          expect(options.eventMouseEnter).not.toHaveBeenCalled()
+          expect(options.eventMouseLeave).not.toHaveBeenCalled()
           done()
           done()
         }
         }
       )
       )

+ 6 - 6
tests/automated/legacy/eventMouseover.js → tests/automated/legacy/eventMouseEnter.js

@@ -1,4 +1,4 @@
-describe('eventMouseover', function() {
+describe('eventMouseEnter', function() {
 
 
   pushOptions({
   pushOptions({
     defaultDate: '2014-08-01',
     defaultDate: '2014-08-01',
@@ -12,9 +12,9 @@ describe('eventMouseover', function() {
         defaultView: viewName
         defaultView: viewName
       })
       })
 
 
-      it('will trigger a eventMouseout when updating an event', function(done) {
+      it('will trigger a eventMouseLeave when updating an event', function(done) {
 
 
-        spyOnCalendarCallback('eventMouseout', function(arg) {
+        spyOnCalendarCallback('eventMouseLeave', function(arg) {
           expect(typeof arg.event).toBe('object')
           expect(typeof arg.event).toBe('object')
           expect(typeof arg.jsEvent).toBe('object')
           expect(typeof arg.jsEvent).toBe('object')
           done()
           done()
@@ -26,7 +26,7 @@ describe('eventMouseover', function() {
             start: '2014-08-02T01:00:00',
             start: '2014-08-02T01:00:00',
             className: 'event'
             className: 'event'
           } ],
           } ],
-          eventMouseover: function(arg) {
+          eventMouseEnter: function(arg) {
             expect(typeof arg.event).toBe('object')
             expect(typeof arg.event).toBe('object')
             expect(typeof arg.jsEvent).toBe('object')
             expect(typeof arg.jsEvent).toBe('object')
             arg.event.setProp('title', 'YO')
             arg.event.setProp('title', 'YO')
@@ -48,11 +48,11 @@ describe('eventMouseover', function() {
         rendering: 'background',
         rendering: 'background',
         className: 'event'
         className: 'event'
       } ],
       } ],
-      eventMouseover(arg) {
+      eventMouseEnter(arg) {
         expect(arg.event.rendering).toBe('background')
         expect(arg.event.rendering).toBe('background')
         mouseoverCalled = true
         mouseoverCalled = true
       },
       },
-      eventMouseout() {
+      eventMouseLeave() {
         expect(mouseoverCalled).toBe(true)
         expect(mouseoverCalled).toBe(true)
         done()
         done()
       }
       }

+ 4 - 4
tests/manual/list-view.html

@@ -97,11 +97,11 @@
           window.open(event.url);
           window.open(event.url);
         }
         }
       },
       },
-      eventMouseover: function(event) {
-        console.log('eventMouseover', event.title);
+      eventMouseEnter: function(arg) {
+        console.log('eventMouseEnter', arg.event.title);
       },
       },
-      eventMouseout: function(event) {
-        console.log('    eventMouseout', event.title);
+      eventMouseLeave: function(arg) {
+        console.log('eventMouseLeave', arg.event.title);
       }
       }
     });
     });