Procházet zdrojové kódy

lots more changes to get tests passing. works now

Adam Shaw před 7 roky
rodič
revize
b865bd4944
40 změnil soubory, kde provedl 179 přidání a 221 odebrání
  1. 14 7
      plugins/gcal/GcalEventSource.ts
  2. 5 2
      src/agenda/TimeGrid.ts
  3. 13 5
      src/models/event/EventDateProfile.ts
  4. 1 1
      src/models/event/EventDef.ts
  5. 0 1
      src/models/event/EventInstance.ts
  6. 2 2
      tests/automated/datelib/main.js
  7. 1 1
      tests/automated/event-data/dynamic-options.js
  8. 5 5
      tests/automated/event-data/updateEvent.js
  9. 20 25
      tests/automated/event-render/TimeGridEventRenderUtils.js
  10. 2 2
      tests/automated/event-render/eventOrder.js
  11. 2 2
      tests/automated/event-render/maxTime.js
  12. 2 2
      tests/automated/event-render/minTime.js
  13. 2 2
      tests/automated/legacy/addEventSource.js
  14. 12 12
      tests/automated/legacy/allDayDefault.js
  15. 9 43
      tests/automated/legacy/custom-view-duration.js
  16. 4 4
      tests/automated/legacy/event-dnd.js
  17. 4 4
      tests/automated/legacy/event-feed-param.js
  18. 2 4
      tests/automated/legacy/event-obj.js
  19. 2 2
      tests/automated/legacy/eventDestroy.js
  20. 3 3
      tests/automated/legacy/eventLimit-popover.js
  21. 2 19
      tests/automated/legacy/events-gcal.js
  22. 21 31
      tests/automated/legacy/events-json-feed.js
  23. 2 2
      tests/automated/legacy/nowIndicator.js
  24. 1 1
      tests/automated/legacy/refetchEventSources.js
  25. 3 3
      tests/automated/legacy/refetchEvents.js
  26. 5 5
      tests/automated/legacy/removeEventSource.js
  27. 1 1
      tests/automated/legacy/removeEventSources.js
  28. 3 3
      tests/automated/legacy/selectHelper.js
  29. 2 2
      tests/automated/legacy/slotLabelFormat.js
  30. 6 6
      tests/automated/legacy/unselectAuto.js
  31. 3 3
      tests/automated/legacy/viewDestroy.js
  32. 3 3
      tests/automated/legacy/viewRender.js
  33. 1 1
      tests/automated/legacy/weekViewRender.js
  34. 11 7
      tests/automated/lib/dnd-resize-utils.js
  35. 1 1
      tests/automated/view-dates/gotoDate.js
  36. 3 0
      tests/automated/view-render/DayGridRenderUtils.js
  37. 1 1
      tests/automated/view-render/columnHeaderHtml.js
  38. 1 1
      tests/automated/view-render/columnHeaderText.js
  39. 1 1
      tests/automated/view-render/slotDuration.js
  40. 3 1
      tests/automated/view-type/changeView.js

+ 14 - 7
plugins/gcal/GcalEventSource.ts

@@ -111,25 +111,32 @@ export default class GcalEventSource extends EventSource {
   buildRequestParams(start: DateMarker, end: DateMarker, dateEnv: DateEnv) {
     let apiKey = this.googleCalendarApiKey || this.calendar.opt('googleCalendarApiKey')
     let params
+    let startStr
+    let endStr
 
     if (!apiKey) {
       this.reportError('Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/')
       return null
     }
 
-    // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
-    // from the UTC day-start to guarantee we're getting all the events
-    if (!dateEnv.canComputeOffset) {
-      start = addDays(start, -1)
-      end = addDays(end, 1)
+    if (dateEnv.canComputeOffset) {
+      // strings will naturally have offsets, which GCal needs
+      startStr = dateEnv.formatIso(start)
+      endStr = dateEnv.formatIso(end)
+    } else {
+      // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
+      // from the UTC day-start to guarantee we're getting all the events
+      // (start/end will be UTC-coerced dates, so toISOString is okay)
+      startStr = addDays(start, -1).toISOString()
+      endStr = addDays(end, 1).toISOString()
     }
 
     params = assignTo(
       this.ajaxSettings.data || {},
       {
         key: apiKey,
-        timeMin: dateEnv.formatIso(start),
-        timeMax: dateEnv.formatIso(end),
+        timeMin: startStr,
+        timeMax: endStr,
         singleEvents: true,
         maxResults: 9999
       }

+ 5 - 2
src/agenda/TimeGrid.ts

@@ -441,7 +441,7 @@ export default class TimeGrid extends InteractiveDateComponent {
         false // all-day
       )
     )
-    let top = this.computeDateTop(date, date)
+    let top = this.computeDateTop(date)
     let nodes = []
     let i
 
@@ -497,7 +497,10 @@ export default class TimeGrid extends InteractiveDateComponent {
 
   // Computes the top coordinate, relative to the bounds of the grid, of the given date.
   // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
-  computeDateTop(when: DateMarker, startOfDayDate: DateMarker) {
+  computeDateTop(when: DateMarker, startOfDayDate?: DateMarker) {
+    if (!startOfDayDate) {
+      startOfDayDate = startOfDay(when)
+    }
     return this.computeTimeTop(when.valueOf() - startOfDayDate.valueOf())
   }
 

+ 13 - 5
src/models/event/EventDateProfile.ts

@@ -44,6 +44,7 @@ export default class EventDateProfile {
     let endMarker = endMeta && endMeta.marker
     let forcedAllDay = rawProps.allDay
     let forceEventDuration = calendar.opt('forceEventDuration')
+    let isAllDay
 
     if (!startMarker) {
       return false
@@ -56,16 +57,23 @@ export default class EventDateProfile {
 
     if (forcedAllDay == null) {
       forcedAllDay = source.allDayDefault
+
       if (forcedAllDay == null) {
         forcedAllDay = calendar.opt('allDayDefault')
       }
     }
 
-    if (forcedAllDay === true) {
-      startMarker = startOfDay(startMarker)
+    if (forcedAllDay == null) {
+      isAllDay = startMeta.isTimeUnspecified && (!endMeta || endMeta.isTimeUnspecified)
+    } else {
+      isAllDay = forcedAllDay
+
+      if (forcedAllDay === true) {
+        startMarker = startOfDay(startMarker)
 
-      if (endMarker) {
-        endMarker = startOfDay(endMarker)
+        if (endMarker) {
+          endMarker = startOfDay(endMarker)
+        }
       }
     }
 
@@ -79,7 +87,7 @@ export default class EventDateProfile {
     return new EventDateProfile(
       startMarker,
       endMarker,
-      startMeta.isTimeUnspecified && (!endMeta || endMeta.isTimeUnspecified),
+      isAllDay,
       calendar,
       startMeta.forcedTimeZoneOffset,
       endMeta ? endMeta.forcedTimeZoneOffset : null

+ 1 - 1
src/models/event/EventDef.ts

@@ -167,7 +167,7 @@ export default abstract class EventDef {
     obj._id = this.uid
     obj.source = this.source
     obj.className = this.className.slice() // copy
-    obj.allDay = this.isAllDay()
+    obj.isAllDay = this.isAllDay()
 
     if (this.rawId != null) {
       obj.id = this.rawId

+ 0 - 1
src/models/event/EventInstance.ts

@@ -16,7 +16,6 @@ export default class EventInstance {
     let dateProfile = this.dateProfile
     let obj = this.def.toLegacy()
 
-    obj.isAllDay = dateProfile.isAllDay
     obj.start = dateEnv.toDate(dateProfile.unzonedRange.start)
     obj.end = dateProfile.hasEnd ?
       dateEnv.toDate(dateProfile.unzonedRange.end) :

+ 2 - 2
tests/automated/datelib/main.js

@@ -194,14 +194,14 @@ describe('datelib', function() {
         var marker = env.createMarker('2018-06-08')
         var formatter = createFormatter({ week: 'narrow' })
         var s = env.format(marker, formatter)
-        expect(s).toBe('Wk23')
+        expect(s).toBe('W23')
       })
 
       it('can output short', function() {
         var marker = env.createMarker('2018-06-08')
         var formatter = createFormatter({ week: 'short' })
         var s = env.format(marker, formatter)
-        expect(s).toBe('Wk 23')
+        expect(s).toBe('W 23')
       })
     })
 

+ 1 - 1
tests/automated/event-data/dynamic-options.js

@@ -6,7 +6,7 @@ describe('setting option dynamically', function() {
 
     initCalendar({
       defaultView: 'month',
-      events: function(start, end, timezone, callback) {
+      events: function(arg, callback) {
         fetchCnt++
         callback([])
       }

+ 5 - 5
tests/automated/event-data/updateEvent.js

@@ -96,16 +96,16 @@ describe('updateEvent', function() {
           if (allRenderCnt === 1) {
             eventObj = currentCalendar.clientEvents('2')[0]
 
-            expect(eventObj.allDay).toBe(false)
+            expect(eventObj.isAllDay).toBe(false)
 
-            eventObj.allDay = true
+            eventObj.isAllDay = true
             eventObj.start = '2017-07-14'
             eventObj.end = '2017-07-15'
             currentCalendar.updateEvent(eventObj)
 
             eventObj = currentCalendar.clientEvents('2')[0]
 
-            expect(eventObj.allDay).toBe(true)
+            expect(eventObj.isAllDay).toBe(true)
             expect(eventObj.start).toEqualDate('2017-07-14T00:00:00Z')
             expect(eventObj.end).toEqualDate('2017-07-15T00:00:00Z')
 
@@ -134,13 +134,13 @@ describe('updateEvent', function() {
 
       event = currentCalendar.clientEvents()[0]
 
-      event.allDay = false
+      event.isAllDay = false
       event.start = '2016-04-29T12:00:00' // 12 noon
       event.end = '2016-04-29T14:00:00' // 2pm
       currentCalendar.updateEvent(event)
 
       event = currentCalendar.clientEvents()[0]
-      expect(event.allDay).toBe(false)
+      expect(event.isAllDay).toBe(false)
       expect(event.start).toEqualDate('2016-04-29T12:00:00Z')
       expect(event.end).toEqualDate('2016-04-29T14:00:00Z')
     })

+ 20 - 25
tests/automated/event-render/TimeGridEventRenderUtils.js

@@ -12,8 +12,12 @@ TODO: check isStart/isEnd.
 */
 export function checkEventRendering(start, end) {
 
-  start = FullCalendar.parseMarker(start).marker
-  end = FullCalendar.parseMarker(end).marker
+  if (typeof start === 'string') {
+    start = new Date(start)
+  }
+  if (typeof end === 'string') {
+    end = new Date(end)
+  }
 
   var expectedRects = computeSpanRects(start, end)
   var eventEls = $('.fc-event') // sorted by DOM order. not good for RTL
@@ -84,12 +88,12 @@ export function computeSpanRects(start, end) {
 
       slotStart = FullCalendar.addMs(
         slotDayStart,
-        slotStruct.startTime.time
+        slotStruct.startTimeMs
       )
 
       slotEnd = FullCalendar.addMs(
         slotDayStart,
-        slotStruct.endTime.time
+        slotStruct.endTimeMs
       )
 
       if (startTop === null) { // looking for the start
@@ -156,9 +160,9 @@ function computeSlots() {
   var slots = slotEls.map(function(i, node) {
     var rect = node.getBoundingClientRect()
     return $.extend({}, rect, {
-      startTime: FullCalendar.createDuration(
+      startTimeMs: FullCalendar.createDuration(
         $(node).data('time')
-      )
+      ).time
     })
   }).get()
 
@@ -170,23 +174,20 @@ function computeSlots() {
 
   var mid = Math.floor(len / 2)
   var i = mid - 1
-  var standardMs = slots[mid + 1].startTime - slots[mid].startTime
+  var standardMs = slots[mid + 1].startTimeMs - slots[mid].startTimeMs
   var ms
   var dayOffset = 0
 
   // iterate from one-before middle to beginning
   for (i = mid - 1; i >= 0; i--) {
-    ms = slots[i + 1].startTime - slots[i].startTime
+    ms = slots[i + 1].startTimeMs - slots[i].startTimeMs
 
     // big deviation? assume moved to previous day (b/c of special minTime)
     if (Math.abs(ms - standardMs) > standardMs * 2) {
       dayOffset--
-      slots[i].endTime = FullCalendar.addDurations(
-        slots[i].startTime,
-        FullCalendar.createDuration(standardMs)
-      )
+      slots[i].endTimeMs = slots[i].startTimeMs + standardMs
     } else { // otherwise, current slot's end is next slot's beginning
-      slots[i].endTime = slots[i + 1].startTime
+      slots[i].endTimeMs = slots[i + 1].startTimeMs
     }
 
     slots[i].dayOffset = dayOffset
@@ -196,32 +197,26 @@ function computeSlots() {
 
   // iterate from middle to one-before last
   for (i = mid; i < len - 1; i++) {
-    ms = slots[i + 1].startTime - slots[i].startTime
+    ms = slots[i + 1].startTimeMs - slots[i].startTimeMs
 
     slots[i].dayOffset = dayOffset
 
     // big deviation? assume moved to next day (b/c of special maxTime)
     if (Math.abs(ms - standardMs) > standardMs * 2) {
       dayOffset++ // will apply to the next slotStruct
-      slots[i].endTime = FullCalendar.addDurations(
-        slots[i].startTime,
-        FullCalendar.createDuration(standardMs)
-      )
+      slots[i].endTimeMs = slots[i].startTimeMs + standardMs
     } else { // otherwise, current slot's end is next slot's beginning
-      slots[i].endTime = slots[i + 1].startTime
+      slots[i].endTimeMs = slots[i + 1].startTimeMs
     }
   }
 
   // assume last slot has the standard duration
-  slots[i].endTime = FullCalendar.addDurations(
-    slots[i].startTime,
-    FullCalendar.createDuration(standardMs)
-  )
+  slots[i].endTimeMs = slots[i].startTimeMs + standardMs
   slots[i].dayOffset = dayOffset
 
   // if last slot went over the day threshold
-  if (slots[i].endTime.time > 1000 * 60 * 60 * 24) {
-    slots[i].endTime.time -= 1000 * 60 * 60 * 24
+  if (slots[i].endTimeMs.time > 1000 * 60 * 60 * 24) {
+    slots[i].endTimeMs.time -= 1000 * 60 * 60 * 24
     slots[i].dayOffset++
   }
 

+ 2 - 2
tests/automated/event-render/eventOrder.js

@@ -8,8 +8,8 @@ describe('eventOrder', function() {
       { id: 'y', title: 'b', start: '2018-01-01T09:00:00', myOrder: 1 },
       { id: 'x', title: 'c', start: '2018-01-01T09:00:00', myOrder: 2 }
     ],
-    eventRender: function(eventObj, el) {
-      el.setAttribute('data-event-id', eventObj.id)
+    eventRender: function(arg) {
+      arg.el.setAttribute('data-event-id', arg.event.id)
     }
   })
 

+ 2 - 2
tests/automated/event-render/maxTime.js

@@ -18,8 +18,8 @@ describe('event rendering with maxTime', function() {
     it('renders two event elements in the correct places', function() {
       initCalendar()
       var res = checkEventRendering(
-        '2017-03-22T00:00:00',
-        '2017-03-22T02:00:00'
+        '2017-03-22T00:00:00Z',
+        '2017-03-22T02:00:00Z'
       )
       expect(res.length).toBe(2)
       expect(res.isMatch).toBe(true)

+ 2 - 2
tests/automated/event-render/minTime.js

@@ -18,8 +18,8 @@ describe('event rendering with minTime', function() {
     it('renders two event elements in the correct places', function() {
       initCalendar()
       var res = checkEventRendering(
-        '2017-03-22T22:00:00',
-        '2017-03-23T00:00:00'
+        '2017-03-22T22:00:00Z',
+        '2017-03-23T00:00:00Z'
       )
       expect(res.length).toBe(2)
       expect(res.isMatch).toBe(true)

+ 2 - 2
tests/automated/legacy/addEventSource.js

@@ -24,7 +24,7 @@ describe('addEventSource', function() {
   it('correctly adds a function source', function(done) {
     go(
       function() {
-        currentCalendar.addEventSource(function(start, end, timezone, callback) {
+        currentCalendar.addEventSource(function(arg, callback) {
           callback(eventArray)
         })
       },
@@ -53,7 +53,7 @@ describe('addEventSource', function() {
       function() {
         currentCalendar.addEventSource({
           className: 'funcsource',
-          events: function(start, end, timezone, callback) {
+          events: function(arg, callback) {
             callback(eventArray)
           }
         })

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

@@ -12,7 +12,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(false)
+      expect(eventObj.isAllDay).toEqual(false)
     })
 
     it('guesses false if T in ISO8601 end date', function() {
@@ -26,7 +26,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(false)
+      expect(eventObj.isAllDay).toEqual(false)
     })
 
     it('guesses true if ISO8601 start date with no time and unspecified end date', function() {
@@ -39,7 +39,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(true)
+      expect(eventObj.isAllDay).toEqual(true)
     })
 
     it('guesses true if ISO8601 start and end date with no times', function() {
@@ -53,7 +53,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(true)
+      expect(eventObj.isAllDay).toEqual(true)
     })
 
     it('guesses false if start is a unix timestamp (which implies it has a time)', function() {
@@ -68,7 +68,7 @@ describe('allDayDefault', function() {
       })
 
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(false)
+      expect(eventObj.isAllDay).toEqual(false)
     })
 
     it('guesses false if end is a unix timestamp (which implies it has a time)', function() {
@@ -82,7 +82,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(false)
+      expect(eventObj.isAllDay).toEqual(false)
     })
 
   })
@@ -100,7 +100,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(false)
+      expect(eventObj.isAllDay).toEqual(false)
     })
 
     it('has no effect when an event\'s allDay is specified', function() {
@@ -115,7 +115,7 @@ describe('allDayDefault', function() {
         ]
       })
       var eventObj = currentCalendar.clientEvents('1')[0]
-      expect(eventObj.allDay).toEqual(true)
+      expect(eventObj.isAllDay).toEqual(true)
     })
 
   })
@@ -139,7 +139,7 @@ describe('source.allDayDefault', function() {
       ]
     })
     var eventObj = currentCalendar.clientEvents('1')[0]
-    expect(eventObj.allDay).toEqual(false)
+    expect(eventObj.isAllDay).toEqual(false)
   })
 
   it('a true value can override the global allDayDefault', function() {
@@ -158,7 +158,7 @@ describe('source.allDayDefault', function() {
       ]
     })
     var eventObj = currentCalendar.clientEvents('1')[0]
-    expect(eventObj.allDay).toEqual(true)
+    expect(eventObj.isAllDay).toEqual(true)
   })
 
   it('a false value can override the global allDayDefault', function() {
@@ -177,7 +177,7 @@ describe('source.allDayDefault', function() {
       ]
     })
     var eventObj = currentCalendar.clientEvents('1')[0]
-    expect(eventObj.allDay).toEqual(false)
+    expect(eventObj.isAllDay).toEqual(false)
   })
 
   it('has no effect when an event\'s allDay is specified', function() {
@@ -196,7 +196,7 @@ describe('source.allDayDefault', function() {
       ]
     })
     var eventObj = currentCalendar.clientEvents('1')[0]
-    expect(eventObj.allDay).toEqual(false)
+    expect(eventObj.isAllDay).toEqual(false)
   })
 
 })

+ 9 - 43
tests/automated/legacy/custom-view-duration.js

@@ -41,7 +41,7 @@ describe('custom view', function() {
     options.views.basicFourDay = {
       type: 'basic',
       duration: { days: 4 },
-      titleFormat: '[special]'
+      titleFormat: function() { return 'special' }
     }
     options.defaultView = 'basicFourDay'
     initCalendar(options)
@@ -53,7 +53,7 @@ describe('custom view', function() {
       views: {}
     }
     options.views.basic = {
-      titleFormat: '[basictitle]'
+      titleFormat: function() { return 'basictitle' }
     }
     options.views.basicFourDay = {
       type: 'basic',
@@ -69,12 +69,12 @@ describe('custom view', function() {
       views: {}
     }
     options.views.basic = {
-      titleFormat: '[basictitle]'
+      titleFormat: function() { return 'basictitle' }
     }
     options.views.basicFourDay = {
       type: 'basic',
       duration: { days: 4 },
-      titleFormat: '[basicfourweekttitle]'
+      titleFormat: function() { return 'basicfourweekttitle' }
     }
     options.defaultView = 'basicFourDay'
     initCalendar(options)
@@ -86,7 +86,7 @@ describe('custom view', function() {
       views: {}
     }
     options.views.week = {
-      titleFormat: '[weektitle]'
+      titleFormat: function() { return 'weektitle' }
     }
     options.views.basicOneWeek = {
       type: 'basic',
@@ -102,10 +102,10 @@ describe('custom view', function() {
       views: {}
     }
     options.views.week = {
-      titleFormat: '[weektitle]'
+      titleFormat: function() { return 'weektitle' }
     }
     options.views.basic = {
-      titleFormat: '[basictitle]'
+      titleFormat: function() { return 'basictitle' }
     }
     options.views.basicOneWeek = {
       type: 'basic',
@@ -120,9 +120,9 @@ describe('custom view', function() {
     var options = {
       views: {}
     }
-    options.titleFormat = '[defaultitle]'
+    options.titleFormat = function() { return 'defaultitle' }
     options.views.week = {
-      titleFormat: '[weektitle]'
+      titleFormat: function() { return 'weektitle' }
     }
     options.views.basicTwoWeek = {
       type: 'basic',
@@ -348,40 +348,6 @@ describe('custom view', function() {
       expect($('.fc-basicFourDay-button')).toHaveText('awesome')
     })
 
-    it('falls back to humanized duration when not given', function() {
-      var options = {
-        views: {}
-      }
-      options.views.custom = {
-        type: 'basic',
-        duration: { days: 4 }
-      }
-      options.header = {
-        center: 'custom,month'
-      }
-      options.defaultView = 'custom'
-      initCalendar(options)
-      expect($('.fc-custom-button')).toHaveText('4 days')
-    })
-
-    it('falls back to humanized duration and respects locale', function() {
-      var options = {
-        views: {}
-      }
-      options.locale = 'fr'
-      options.views.custom = {
-        type: 'basic',
-        duration: { days: 4 }
-      }
-      options.header = {
-        center: 'custom,month'
-      }
-      options.defaultView = 'custom'
-      initCalendar(options)
-      expect($('.fc-custom-button')).toHaveText('4 jours')
-      expect($('.fc-month-button')).toHaveText('Mois') // test for the heck of it
-    })
-
     it('falls back to view name when view lacks metadata', function() {
       FullCalendar.views.crazy = FullCalendar.View.extend()
       var options = {

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

@@ -246,14 +246,14 @@ describe('eventDrop', function() {
 
             expect(arg.event.start).toEqualDate('2014-06-10T01:00:00Z')
             expect(arg.event.end).toBeNull()
-            expect(arg.event.allDay).toBe(false)
+            expect(arg.event.isAllDay).toBe(false)
 
             arg.revertFunc()
             var event = currentCalendar.clientEvents()[0]
 
             expect(event.start).toEqualDate('2014-06-11')
             expect(event.end).toBeNull()
-            expect(event.allDay).toBe(true)
+            expect(event.isAllDay).toBe(true)
 
             done()
           }
@@ -298,14 +298,14 @@ describe('eventDrop', function() {
 
             expect(arg.event.start).toEqualDate('2014-06-10')
             expect(arg.event.end).toBeNull()
-            expect(arg.event.allDay).toBe(true)
+            expect(arg.event.isAllDay).toBe(true)
 
             arg.revertFunc()
             var event = currentCalendar.clientEvents()[0]
 
             expect(event.start).toEqualDate('2014-06-11T01:00:00Z')
             expect(event.end).toBeNull()
-            expect(event.allDay).toBe(false)
+            expect(event.isAllDay).toBe(false)
 
             done()
           }

+ 4 - 4
tests/automated/legacy/event-feed-param.js

@@ -17,8 +17,8 @@ describe('event feed params', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        mystart: '2014-04-27',
-        myend: '2014-06-08',
+        mystart: '2014-04-27T00:00:00',
+        myend: '2014-06-08T00:00:00',
         currtz: 'America/Los_Angeles'
       })
       done()
@@ -38,8 +38,8 @@ describe('event feed params', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        feedstart: '2014-04-27',
-        feedend: '2014-06-08',
+        feedstart: '2014-04-27T00:00:00',
+        feedend: '2014-06-08T00:00:00',
         feedctz: 'America/Los_Angeles'
       })
       done()

+ 2 - 4
tests/automated/legacy/event-obj.js

@@ -100,9 +100,8 @@ describe('event object creation', function() {
       end: '2014-05-02T01:00:00-12:00',
       allDay: true
     })
-    expect(event.start.hasTime()).toEqual(false)
+    expect(event.isAllDay).toEqual(true)
     expect(event.start).toEqualDate('2014-05-01')
-    expect(event.end.hasTime()).toEqual(false)
     expect(event.end).toEqualDate('2014-05-02')
   })
 
@@ -112,9 +111,8 @@ describe('event object creation', function() {
       end: '2014-05-03',
       allDay: false
     })
-    expect(event.start.hasTime()).toEqual(true)
+    expect(event.isAllDay).toEqual(false)
     expect(event.start).toEqualDate('2014-05-01T00:00:00Z')
-    expect(event.end.hasTime()).toEqual(true)
     expect(event.end).toEqualDate('2014-05-03T00:00:00Z')
   })
 

+ 2 - 2
tests/automated/legacy/eventDestroy.js

@@ -11,9 +11,9 @@ describe('eventDestroy', function() {
 
     initCalendar({
       events: [ singleEventData ],
-      eventDestroy: function(event, element) {
+      eventDestroy: function(arg) {
         if (callCnt++ === 0) { // only care about the first call. gets called again when calendar is destroyed
-          expect(event.id).toBe(singleEventData.id)
+          expect(arg.event.id).toBe(singleEventData.id)
           done()
         }
       }

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

@@ -278,7 +278,7 @@ describe('eventLimit popover', function() {
         initCalendar({
           eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-28')
-            expect(arg.event.allDay).toBe(true)
+            expect(arg.event.isAllDay).toBe(true)
             done()
           }
         })
@@ -307,7 +307,7 @@ describe('eventLimit popover', function() {
           events: testEvents,
           eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-28T13:00:00Z')
-            expect(arg.event.allDay).toBe(false)
+            expect(arg.event.isAllDay).toBe(false)
             done()
           }
         })
@@ -331,7 +331,7 @@ describe('eventLimit popover', function() {
           scrollTime: '00:00:00',
           eventDrop: function(arg) {
             expect(arg.event.start).toEqualDate('2014-07-30T03:00:00Z')
-            expect(arg.event.allDay).toBe(false)
+            expect(arg.event.isAllDay).toBe(false)
             done()
           }
         })

+ 2 - 19
tests/automated/legacy/events-gcal.js

@@ -78,12 +78,13 @@ describe('Google Calendar plugin', function() {
     initCalendar(options)
   })
 
-  it('request/receives correctly when custom timezone', function(done) {
+  it('request/receives correctly when named timezone, defaults to not editable', function(done) {
     options.googleCalendarApiKey = API_KEY
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.timezone = 'America/New York'
     options.eventAfterAllRender = function() {
       var events = currentCalendar.clientEvents()
+      var eventEls = $('.fc-event')
       var i
 
       expect(events.length).toBe(NUM_EVENTS)
@@ -91,24 +92,6 @@ describe('Google Calendar plugin', function() {
         expect(events[i].url).toMatch('ctz=America/New_York')
       }
 
-      done()
-    }
-    initCalendar(options)
-  })
-
-  it('requests/receives correctly when no timezone, defaults to not editable', function(done) {
-    options.googleCalendarApiKey = API_KEY
-    options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
-    options.eventAfterAllRender = function() {
-      var events = currentCalendar.clientEvents()
-      var eventEls = $('.fc-event')
-      var i
-
-      expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
-      for (i = 0; i < events.length; i++) {
-        expect(events[i].url).not.toMatch('ctz=')
-      }
-
       expect(eventEls.length).toBe(NUM_EVENTS)
       expect(eventEls.find('.fc-resizer').length).toBe(0) // not editable
 

+ 21 - 31
tests/automated/legacy/events-json-feed.js

@@ -1,3 +1,5 @@
+import { formatIsoTimeZoneOffset } from '../datelib/utils'
+
 describe('events as a json feed', function() {
 
   pushOptions({
@@ -13,28 +15,14 @@ describe('events as a json feed', function() {
     XHRMock.teardown()
   })
 
-  it('requests correctly when no timezone', function(done) {
-
-    XHRMock.get(/^my-feed\.php/, function(req, res) {
-      expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08'
-      })
-      done()
-      return res.status(200).header('content-type', 'application/json').body('[]')
-    })
-
-    initCalendar({
-      events: 'my-feed.php'
-    })
-  })
-
   it('requests correctly when local timezone', function(done) {
+    const START = '2014-04-27T00:00:00'
+    const END = '2014-06-08T00:00:00'
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08'
+        start: START + formatIsoTimeZoneOffset(new Date(START)),
+        end: END + formatIsoTimeZoneOffset(new Date(END))
       })
       done()
       return res.status(200).header('content-type', 'application/json').body('[]')
@@ -50,8 +38,8 @@ describe('events as a json feed', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08',
+        start: '2014-04-27T00:00:00Z',
+        end: '2014-06-08T00:00:00Z',
         timezone: 'UTC'
       })
       done()
@@ -68,8 +56,8 @@ describe('events as a json feed', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08',
+        start: '2014-04-27T00:00:00',
+        end: '2014-06-08T00:00:00',
         timezone: 'America/Chicago'
       })
       done()
@@ -86,8 +74,8 @@ describe('events as a json feed', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08',
+        start: '2014-04-27T00:00:00',
+        end: '2014-06-08T00:00:00',
         timezone: 'America/Chicago'
       })
       return res.status(200).header('content-type', 'application/json').body(
@@ -106,19 +94,20 @@ describe('events as a json feed', function() {
         className: 'customeventclass'
       } ],
       timezone: 'America/Chicago',
-      eventRender: function(eventObj, eventElm) {
-        expect(eventElm).toHaveClass('customeventclass')
+      eventRender: function(arg) {
+        expect(arg.el).toHaveClass('customeventclass')
         done()
       }
     })
   })
 
-  it('accepts jQuery.ajax params', function(done) {
+  it('accepts a data object', function(done) {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08',
+        timezone: 'UTC',
+        start: '2014-04-27T00:00:00Z',
+        end: '2014-06-08T00:00:00Z',
         customParam: 'yes'
       })
       done()
@@ -139,8 +128,9 @@ describe('events as a json feed', function() {
 
     XHRMock.get(/^my-feed\.php/, function(req, res) {
       expect(req.url().query).toEqual({
-        start: '2014-04-27',
-        end: '2014-06-08',
+        timezone: 'UTC',
+        start: '2014-04-27T00:00:00Z',
+        end: '2014-06-08T00:00:00Z',
         customParam: 'heckyeah'
       })
       done()

+ 2 - 2
tests/automated/legacy/nowIndicator.js

@@ -53,13 +53,13 @@ describe('now indicator', function() {
 
           it('renders on correct time', function() {
             initCalendar(options)
-            isNowIndicatorRenderedAt('2015-12-26T06:00:00')
+            isNowIndicatorRenderedAt('2015-12-26T06:00:00Z')
           })
 
           it('renders on correct time2', function() {
             options.now = '2015-12-20T02:30:00'
             initCalendar(options)
-            isNowIndicatorRenderedAt('2015-12-20T02:30:00')
+            isNowIndicatorRenderedAt('2015-12-20T02:30:00Z')
           })
         })
       })

+ 1 - 1
tests/automated/legacy/refetchEventSources.js

@@ -192,7 +192,7 @@ describe('refetchEventSources', function() {
   })
 
   function createEventGenerator(classNamePrefix) {
-    return function(start, end, timezone, callback) {
+    return function(arg, callback) {
       var events = []
 
       for (var i = 0; i < eventCount; i++) {

+ 3 - 3
tests/automated/legacy/refetchEvents.js

@@ -11,7 +11,7 @@ describe('refetchEvents', function() {
         scrollTime: '00:00',
         height: 400, // makes this test more consistent across viewports
         defaultView: 'agendaDay',
-        events: function(start, end, timezone, callback) {
+        events: function(arg, callback) {
           setTimeout(function() {
             callback([
               { id: '1', resourceId: 'b', start: '2015-08-07T02:00:00', end: '2015-08-07T07:00:00', title: 'event 1' },
@@ -85,7 +85,7 @@ describe('refetchEvents', function() {
     describe('and one event source is asynchronous', function() {
       it('original events remain on the calendar until all events have been refetched', function(done) {
         // set a 100ms timeout on this event source
-        eventSources[0].events = function(start, end, timezone, callback) {
+        eventSources[0].events = function(arg, callback) {
           var events = [
             { id: '1',
               start: '2015-08-07T02:00:00',
@@ -119,7 +119,7 @@ describe('refetchEvents', function() {
 
     // relies on fetchCount
     function createEventGenerator() {
-      return function(start, end, timezone, callback) {
+      return function(arg, callback) {
         var events = [
           {
             id: 1,

+ 5 - 5
tests/automated/legacy/removeEventSource.js

@@ -25,7 +25,7 @@ describe('removeEventSource', function() {
   })
 
   describe('with a function', function() {
-    testInput(function(start, end, timezone, callback) {
+    testInput(function(arg, callback) {
       callback(buildEventArray())
     })
   })
@@ -44,7 +44,7 @@ describe('removeEventSource', function() {
 
   describe('with an object+function', function() {
     testInput({
-      events: function(start, end, timezone, callback) {
+      events: function(arg, callback) {
         callback(buildEventArray())
       }
     })
@@ -52,7 +52,7 @@ describe('removeEventSource', function() {
 
   it('won\'t render removed events when subsequent addEventSource', function(done) {
 
-    var source1 = function(start, end, timezone, callback) {
+    var source1 = function(arg, callback) {
       setTimeout(function() {
         callback([ {
           title: 'event1',
@@ -62,7 +62,7 @@ describe('removeEventSource', function() {
       }, 100)
     }
 
-    var source2 = function(start, end, timezone, callback) {
+    var source2 = function(arg, callback) {
       setTimeout(function() {
         callback([ {
           title: 'event2',
@@ -90,7 +90,7 @@ describe('removeEventSource', function() {
   })
 
   describe('when multiple sources share the same fetching function', function() {
-    var fetchFunc = function(start, end, timezone, callback) {
+    var fetchFunc = function(arg, callback) {
       callback([ {
         title: 'event',
         start: '2014-08-01T02:00:00'

+ 1 - 1
tests/automated/legacy/removeEventSources.js

@@ -36,7 +36,7 @@ describe('removeEventSources', function() {
   function buildEventSource(id) {
     return {
       id: id,
-      events: function(start, end, timezone, callback) {
+      events: function(arg, callback) {
         callback([ {
           title: 'event' + id,
           className: 'event' + id,

+ 3 - 3
tests/automated/legacy/selectHelper.js

@@ -9,11 +9,11 @@ describe('selectHelper', function() {
 
   it('goes through eventRender', function() {
     initCalendar({
-      eventRender: function(event, element, view) {
-        $(element).addClass('didEventRender')
+      eventRender: function(arg) {
+        $(arg.el).addClass('didEventRender')
       }
     })
-    currentCalendar.select('2014-08-04T01:00:00', '2014-08-04T04:00:00')
+    currentCalendar.select('2014-08-04T01:00:00Z', '2014-08-04T04:00:00Z')
     expect($('.fc-helper')).toHaveClass('didEventRender')
   })
 })

+ 2 - 2
tests/automated/legacy/slotLabelFormat.js

@@ -23,9 +23,9 @@ describe('slotLabelFormat', function() {
 
   it('renders correctly when customized', function() {
     initCalendar({
-      slotLabelFormat: 'H:mm:mm[!]'
+      slotLabelFormat: { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }
     })
-    expect(getAxisText()).toBe('0:00:00!')
+    expect(getAxisText()).toBe('00:00:00')
   })
 
 })

+ 6 - 6
tests/automated/legacy/unselectAuto.js

@@ -25,11 +25,11 @@ describe('unselectAuto', function() {
       it('unselects the current selection when clicking elsewhere in DOM', function(done) {
 
         initCalendar({
-          unselect: function(ev, view) {
+          unselect: function(arg) {
             expect($('.fc-highlight').length).toBe(0)
 
-            expect('currentTarget' in ev).toBe(true) // a JS event
-            expect(view instanceof View).toBe(true)
+            expect('currentTarget' in arg.jsEvent).toBe(true) // a JS event
+            expect(arg.view instanceof View).toBe(true)
 
             done()
           }
@@ -49,11 +49,11 @@ describe('unselectAuto', function() {
       it('unselects the current selection when clicking elsewhere in DOM', function(done) {
 
         initCalendar({
-          unselect: function(ev, view) {
+          unselect: function(arg) {
             expect($('.fc-highlight').length).toBe(0)
 
-            expect('currentTarget' in ev).toBe(true) // a JS event
-            expect(view instanceof View).toBe(true)
+            expect('currentTarget' in arg.jsEvent).toBe(true) // a JS event
+            expect(arg.view instanceof View).toBe(true)
 
             done()
           }

+ 3 - 3
tests/automated/legacy/viewDestroy.js

@@ -26,7 +26,7 @@ describe('viewDestroy', function() {
         viewRender: function() {
           ++viewRenderCalls
         },
-        viewDestroy: function(givenViewObj, givenViewEl) {
+        viewDestroy: function(arg) {
           if (++viewDestroyCalls === 1) { // because done() calls destroy
 
             // the viewDestroy should be called before the next viewRender
@@ -35,8 +35,8 @@ describe('viewDestroy', function() {
             var viewObj = currentCalendar.getView()
             var viewEl = $('.fc-view', currentCalendar.el)
 
-            expect(viewObj).toBe(givenViewObj)
-            expect(viewEl[0]).toBe(givenViewEl)
+            expect(viewObj).toBe(arg.view)
+            expect(viewEl[0]).toBe(arg.el)
             expect(viewEl.children().length >= 1).toBe(true) // is the content still rendered?
             done()
           }

+ 3 - 3
tests/automated/legacy/viewRender.js

@@ -22,12 +22,12 @@ describe('viewRender', function() {
 
     it('fires after the view is rendered, with correct arguments', function(done) {
       initCalendar({
-        viewRender: function(givenViewObj, givenViewEl) {
+        viewRender: function(arg) {
           var viewObj = currentCalendar.getView()
           var viewEl = $('.fc-view', currentCalendar.el)
 
-          expect(viewObj).toBe(givenViewObj)
-          expect(viewEl[0]).toBe(givenViewEl)
+          expect(viewObj).toBe(arg.view)
+          expect(viewEl[0]).toBe(arg.el)
           expect(viewEl.children().length >= 1).toBe(true) // has it rendered content?
           done()
         }

+ 1 - 1
tests/automated/legacy/weekViewRender.js

@@ -1,6 +1,6 @@
 describe('weekViewRender', function() {
 
-  var nowStr = new Date().toISOString()
+  var nowStr = '2018-05-28'
 
   pushOptions({
     defaultDate: nowStr,

+ 11 - 7
tests/automated/lib/dnd-resize-utils.js

@@ -183,20 +183,24 @@ export function testSelection(options, start, end, expectSuccess, callback) {
   var allowed
 
   var isAllDay = false
+  var meta
   if (typeof start === 'string') {
-    isAllDay = isAllDay || start.indexOf('T') === -1
-    start = new Date(start)
+    meta = FullCalendar.parseMarker(start)
+    isAllDay = isAllDay || meta.isTimeUnspecified
+    start = meta.marker
   }
   if (typeof end === 'string') {
-    isAllDay = isAllDay || end.indexOf('T') === -1
-    end = new Date(end)
+    meta = FullCalendar.parseMarker(end)
+    isAllDay = isAllDay || meta.isTimeUnspecified
+    end = meta.marker
   }
 
   options.selectable = true
-  options.select = function(selectionStart, selectionEnd) {
+  options.select = function(arg) {
     successfulSelection =
-      selectionStart.valueOf() === start.valueOf() &&
-        selectionEnd.valueOf() === end.valueOf()
+      arg.isAllDay === isAllDay &&
+      arg.start.valueOf() === start.valueOf() &&
+      arg.end.valueOf() === end.valueOf()
   }
   spyOn(options, 'select').and.callThrough()
   initCalendar(options)

+ 1 - 1
tests/automated/view-dates/gotoDate.js

@@ -3,7 +3,7 @@ describe('gotoDate', function() {
 
   describe('when asynchronicity', function() {
     pushOptions({
-      events: function(start, end, timezone, callback) {
+      events: function(arg, callback) {
         setTimeout(function() {
           callback([])
         }, 0)

+ 3 - 0
tests/automated/view-render/DayGridRenderUtils.js

@@ -2,6 +2,9 @@ import { formatIsoDay } from '../datelib/utils'
 
 
 export function getSingleDayEl(date) {
+  if (typeof date === 'string') {
+    date = new Date(date)
+  }
   var els = $('.fc-day-grid .fc-bg .fc-day[data-date="' + formatIsoDay(date) + '"]')
   expect(els).toHaveLength(1)
   return els

+ 1 - 1
tests/automated/view-render/columnHeaderHtml.js

@@ -3,7 +3,7 @@ describe('columnHeaderHtml', function() {
   pushOptions({
     defaultDate: '2014-05-11',
     columnHeaderHtml: function(date) {
-      return '<div class="test">' + date.format('dddd') + '</div>'
+      return '<div class="test">' + currentCalendar.formatDate(date, { weekday: 'long' }) + '</div>'
     }
   })
 

+ 1 - 1
tests/automated/view-render/columnHeaderText.js

@@ -3,7 +3,7 @@ describe('columnHeaderText', function() {
   pushOptions({
     defaultDate: '2014-05-11',
     columnHeaderText: function(date) {
-      return '<div>Custom ' + date.format('dddd') + '</div>'
+      return '<div>Custom ' + currentCalendar.formatDate(date, { weekday: 'long' }) + '</div>'
     }
   })
 

+ 1 - 1
tests/automated/view-render/slotDuration.js

@@ -6,7 +6,7 @@ describe('slotDuration', function() {
     defaultDate: '2017-07-17',
     defaultView: 'agendaDay',
     scrollTime: 0,
-    slotLabelFormat: 'HH:mm'
+    slotLabelFormat: { hour: '2-digit', minute: '2-digit', hour12: false }
   })
 
   describe('when only major slots', function() {

+ 3 - 1
tests/automated/view-type/changeView.js

@@ -37,7 +37,9 @@ describe('changeView', function() {
 
       initCalendar({
         defaultView: 'month',
-        eventAfterAllRender: function(view) {
+        eventAfterAllRender: function(arg) {
+          var view = arg.view
+
           renderCalls++
 
           switch (renderCalls) {