Jelajahi Sumber

dayClick -> dateClick

Adam Shaw 7 tahun lalu
induk
melakukan
ea1e968ee0

+ 2 - 2
demos/timezones.html

@@ -44,8 +44,8 @@
       // eventRender: function(event, el) {
       // },
 
-      dayClick: function(arg) {
-        console.log('dayClick', calendar.formatIso(arg.date));
+      dateClick: function(arg) {
+        console.log('dateClick', calendar.formatIso(arg.date));
       },
       select: function(arg) {
         console.log('select', calendar.formatIso(arg.start), calendar.formatIso(arg.end));

+ 1 - 1
src/Calendar.ts

@@ -1035,7 +1035,7 @@ export default class Calendar {
 
   // TODO: receive pev?
   triggerDayClick(dateSpan: DateSpan, dayEl: HTMLElement, view: View, ev: UIEvent) {
-    this.publiclyTrigger('dayClick', [
+    this.publiclyTrigger('dateClick', [
       {
         date: this.dateEnv.toDate(dateSpan.range.start),
         isAllDay: dateSpan.isAllDay,

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

@@ -177,7 +177,7 @@ export interface OptionsInputBase {
   viewDestroy?(arg: { view: View, el: HTMLElement }): void
   dayRender?(arg: { view: View, date: Date, isAllDay: boolean, el: HTMLElement }): void
   windowResize?(view: View): void
-  dayClick?(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
   eventMouseover?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void
   eventMouseout?(arg: { el: HTMLElement, event: EventApi, jsEvent: MouseEvent, view: View }): void

+ 10 - 10
tests/automated/legacy/dayClick.js → tests/automated/legacy/dateClick.js

@@ -1,4 +1,4 @@
-describe('dayClick', function() {
+describe('dateClick', function() {
   pushOptions({
     defaultDate: '2014-05-27',
     selectable: false,
@@ -18,7 +18,7 @@ describe('dayClick', function() {
 
             it('fires correctly when clicking on a cell', function(done) {
               var options = {}
-              options.dayClick = function(arg) {
+              options.dateClick = function(arg) {
                 expect(arg.date instanceof Date).toEqual(true)
                 expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
                 expect(typeof arg.view).toEqual('object') // "
@@ -41,7 +41,7 @@ describe('dayClick', function() {
 
             it('fires correctly when clicking on an all-day slot', function(done) {
               var options = {}
-              options.dayClick = function(arg) {
+              options.dateClick = function(arg) {
                 expect(arg.date instanceof Date).toEqual(true)
                 expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
                 expect(typeof arg.view).toEqual('object') // "
@@ -65,7 +65,7 @@ describe('dayClick', function() {
               options.contentHeight = 500
               options.scrollTime = '07:00:00'
 
-              options.dayClick = function(arg) {
+              options.dateClick = function(arg) {
                 expect(arg.date instanceof Date).toEqual(true)
                 expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
                 expect(typeof arg.view).toEqual('object') // "
@@ -91,7 +91,7 @@ describe('dayClick', function() {
               options.scrollTime = '07:00:00'
               options.minTime = '02:00:00'
 
-              options.dayClick = function(arg) {
+              options.dateClick = function(arg) {
                 expect(arg.date instanceof Date).toEqual(true)
                 expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
                 expect(typeof arg.view).toEqual('object') // "
@@ -118,7 +118,7 @@ describe('dayClick', function() {
 
     it('fires correctly when simulated short drag on a cell', function(done) {
       var options = {}
-      options.dayClick = function(arg) {
+      options.dateClick = function(arg) {
         expect(arg.date instanceof Date).toEqual(true)
         expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
         expect(typeof arg.view).toEqual('object') // "
@@ -139,8 +139,8 @@ describe('dayClick', function() {
 
     it('won\'t fire if touch moves outside of date cell', function(done) {
       var options = {}
-      options.dayClick = function(arg) {}
-      spyOn(options, 'dayClick').and.callThrough()
+      options.dateClick = function(arg) {}
+      spyOn(options, 'dateClick').and.callThrough()
 
       initCalendar(options)
 
@@ -153,7 +153,7 @@ describe('dayClick', function() {
         isTouch: true,
         end: endCell,
         callback: function() {
-          expect(options.dayClick).not.toHaveBeenCalled()
+          expect(options.dateClick).not.toHaveBeenCalled()
           done()
         }
       })
@@ -161,7 +161,7 @@ describe('dayClick', function() {
 
     it('fires correctly when simulated click on a cell', function(done) {
       var options = {}
-      options.dayClick = function(arg) {
+      options.dateClick = function(arg) {
         expect(arg.date instanceof Date).toEqual(true)
         expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
         expect(typeof arg.view).toEqual('object') // "

+ 12 - 12
tests/automated/legacy/navLinks.js

@@ -12,9 +12,9 @@ describe('navLinks', function() {
         center: 'title',
         right: 'month,agendaWeek,agendaDay,listWeek' // affects which view is jumped to by default
       },
-      dayClick: function() { }
+      dateClick: function() { }
     }
-    spyOn(options, 'dayClick')
+    spyOn(options, 'dateClick')
   })
 
   describe('in month view', function() {
@@ -26,7 +26,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayGridNumberEl('2016-08-09'))
       expectDayView('agendaDay', '2016-08-09')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
 
     // https://github.com/fullcalendar/fullcalendar/issues/3869
@@ -34,7 +34,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayGridNumberEl('2016-08-09'))
       expectDayView('agendaDay', '2016-08-09')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
       currentCalendar.changeView('month')
       $.simulateMouseClick(getDayGridNumberEl('2016-08-10'))
       expectDayView('agendaDay', '2016-08-10')
@@ -45,7 +45,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayGridNumberEl('2016-08-09'))
       expectDayView('agendaDay', '2016-08-09')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
 
     it('moves to basicDay specifically', function() {
@@ -53,7 +53,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayGridNumberEl('2016-08-09'))
       expectDayView('basicDay', '2016-08-09')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
 
     it('executes a custom handler', function() {
@@ -65,7 +65,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayGridNumberEl('2016-08-09'))
       expect(options.navLinkDayClick).toHaveBeenCalled()
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
 
     describe('with weekNumbers', function() {
@@ -77,7 +77,7 @@ describe('navLinks', function() {
         initCalendar(options)
         $.simulateMouseClick(getDayGridClassicWeekLinks().eq(1))
         expectWeekView('agendaWeek', '2016-08-07')
-        expect(options.dayClick).not.toHaveBeenCalled()
+        expect(options.dateClick).not.toHaveBeenCalled()
       })
 
       it('moves to week with within-day rendering', function() {
@@ -85,7 +85,7 @@ describe('navLinks', function() {
         initCalendar(options)
         $.simulateMouseClick(getDayGridEmbeddedWeekLinks().eq(1))
         expectWeekView('agendaWeek', '2016-08-07')
-        expect(options.dayClick).not.toHaveBeenCalled()
+        expect(options.dateClick).not.toHaveBeenCalled()
       })
     })
 
@@ -104,7 +104,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getDayHeaderLink('2016-08-15'))
       expectDayView('agendaDay', '2016-08-15')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
   })
 
@@ -123,7 +123,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getListDayHeaderLink('2016-08-20'))
       expectDayView('agendaDay', '2016-08-20')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
   })
 
@@ -137,7 +137,7 @@ describe('navLinks', function() {
       initCalendar(options)
       $.simulateMouseClick(getAgendaWeekNumberLink())
       expectWeekView('agendaWeek', '2016-08-14')
-      expect(options.dayClick).not.toHaveBeenCalled()
+      expect(options.dateClick).not.toHaveBeenCalled()
     })
 
     it('does not have a clickable day header', function() {