瀏覽代碼

more test conversions

Adam Shaw 7 年之前
父節點
當前提交
65509ae057

+ 14 - 14
tests/automated/legacy/ListView.js

@@ -27,8 +27,8 @@ describe('ListView rendering', function() {
         var events = getEventInfo()
 
         expect(days.length).toBe(2)
-        expect(days[0].date.format()).toEqual('2016-08-15')
-        expect(days[1].date.format()).toEqual('2016-08-17')
+        expect(days[0].date).toEqualDate('2016-08-15')
+        expect(days[1].date).toEqualDate('2016-08-17')
 
         expect(events.length).toBe(2)
         expect(events[0].title).toBe('event 1')
@@ -39,8 +39,8 @@ describe('ListView rendering', function() {
 
       it('filters events through eventRender', function() {
         var options = {}
-        options.eventRender = function(event, el) {
-          $(el).find('.fc-event-dot').replaceWith('<span class="custom-icon" />')
+        options.eventRender = function(arg) {
+          $(arg.el).find('.fc-event-dot').replaceWith('<span class="custom-icon" />')
         }
 
         initCalendar(options)
@@ -143,10 +143,10 @@ describe('ListView rendering', function() {
         var events = getEventInfo()
 
         expect(days.length).toBe(2)
-        expect(days[0].date.format()).toEqual('2016-08-15')
+        expect(days[0].date).toEqualDate('2016-08-15')
         expect(days[0].mainText).toEqual('lundi')
         expect(days[0].altText).toEqual('15 août 2016')
-        expect(days[1].date.format()).toEqual('2016-08-17')
+        expect(days[1].date).toEqualDate('2016-08-17')
         expect(days[1].mainText).toEqual('mercredi')
         expect(days[1].altText).toEqual('17 août 2016')
 
@@ -354,13 +354,13 @@ describe('ListView rendering', function() {
       var events = getEventInfo()
 
       expect(days.length).toBe(7)
-      expect(days[0].date.format()).toEqual('2016-08-28')
-      expect(days[1].date.format()).toEqual('2016-08-29')
-      expect(days[2].date.format()).toEqual('2016-08-30')
-      expect(days[3].date.format()).toEqual('2016-08-31')
-      expect(days[4].date.format()).toEqual('2016-09-01')
-      expect(days[5].date.format()).toEqual('2016-09-02')
-      expect(days[6].date.format()).toEqual('2016-09-03')
+      expect(days[0].date).toEqualDate('2016-08-28')
+      expect(days[1].date).toEqualDate('2016-08-29')
+      expect(days[2].date).toEqualDate('2016-08-30')
+      expect(days[3].date).toEqualDate('2016-08-31')
+      expect(days[4].date).toEqualDate('2016-09-01')
+      expect(days[5].date).toEqualDate('2016-09-02')
+      expect(days[6].date).toEqualDate('2016-09-03')
 
       expect(events.length).toBe(13)
       expect(events[0].title).toBe('Long Event')
@@ -443,7 +443,7 @@ describe('ListView rendering', function() {
       return {
         mainText: el.find('.fc-list-heading-main').text() || '',
         altText: el.find('.fc-list-heading-alt').text() || '',
-        date: FullCalendar.moment(el.data('date'))
+        date: new Date(el.data('date'))
       }
     }).get()
   }

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

@@ -17,8 +17,8 @@ describe('View object', function() {
     })
 
     it('is available in the viewRender callback', function() {
-      var viewRenderSpy = spyOnCalendarCallback('viewRender', function(view) {
-        expect(view.title).toBe('January 2015')
+      var viewRenderSpy = spyOnCalendarCallback('viewRender', function(arg) {
+        expect(arg.view.title).toBe('January 2015')
       })
       initCalendar()
       expect(viewRenderSpy).toHaveBeenCalled()

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

@@ -47,9 +47,9 @@ describe('forceEventDuration', function() {
       })
       var events = currentCalendar.clientEvents()
       expect(events[0].id).toEqual('1')
-      expect(moment.isMoment(events[0].end)).toEqual(true)
+      expect(events[0].end instanceof Date).toEqual(true)
       expect(events[1].id).toEqual('2')
-      expect(moment.isMoment(events[1].end)).toEqual(true)
+      expect(events[1].end instanceof Date).toEqual(true)
     })
   })
 

+ 4 - 5
tests/automated/legacy/header-navigation.js

@@ -17,7 +17,7 @@ describe('header navigation', function() {
       currentCalendar.gotoDate('2010-02-01')
       $('.fc-next-button').simulate('click')
       var newDate = currentCalendar.getDate()
-      expect(newDate).toEqualMoment('2010-03-01')
+      expect(newDate).toEqualDate('2010-03-01')
     })
   })
 
@@ -26,7 +26,7 @@ describe('header navigation', function() {
       currentCalendar.gotoDate('2010-02-01')
       $('.fc-prev-button').simulate('click')
       var newDate = currentCalendar.getDate()
-      expect(newDate).toEqualMoment('2010-01-01')
+      expect(newDate).toEqualDate('2010-01-01')
     })
   })
 
@@ -35,7 +35,7 @@ describe('header navigation', function() {
       currentCalendar.gotoDate('2010-02-01')
       $('.fc-prevYear-button').simulate('click')
       var newDate = currentCalendar.getDate()
-      expect(newDate).toEqualMoment('2009-02-01')
+      expect(newDate).toEqualDate('2009-02-01')
     })
   })
 
@@ -44,7 +44,7 @@ describe('header navigation', function() {
       currentCalendar.gotoDate('2010-02-01')
       $('.fc-nextYear-button').simulate('click')
       var newDate = currentCalendar.getDate()
-      expect(newDate).toEqualMoment('2011-02-01')
+      expect(newDate).toEqualDate('2011-02-01')
     })
   })
 
@@ -53,7 +53,6 @@ describe('header navigation', function() {
       currentCalendar.gotoDate('2010-02-01')
       $('.fc-today-button').simulate('click')
       var newDate = currentCalendar.getDate() // will be ambig zone
-      newDate.local() // assign the local timezone
       expect(newDate).toEqualNow()
     })
   })

+ 2 - 50
tests/automated/legacy/locale.js

@@ -1,53 +1,5 @@
 describe('locale', function() {
 
-  afterEach(function() {
-    moment.locale('en')
-  })
-
-  it('is not affected by global moment locale when unset', function() {
-    moment.locale('fr')
-    initCalendar()
-    var mom = currentCalendar.moment('2014-05-01')
-    var s = mom.format('dddd MMMM Do YYYY')
-    expect(s).toEqual('Thursday May 1st 2014')
-  })
-
-  it('is not affected by global moment locale when unset', function() {
-    moment.locale('fr')
-    initCalendar({
-      locale: 'es'
-    })
-    var mom = currentCalendar.moment('2014-05-01')
-    var s = mom.format('dddd MMMM Do YYYY')
-    expect(s).toEqual('jueves mayo 1º 2014')
-  })
-
-  it('doesn\'t side-effect the global moment locale when customized', function() {
-    moment.locale('fr')
-    initCalendar({
-      locale: 'es'
-    })
-    var mom = moment.utc('2014-05-01')
-    var s = mom.format('dddd MMMM Do YYYY')
-    expect(s).toEqual('jeudi mai 1er 2014')
-    expect(moment.locale()).toEqual('fr')
-  })
-
-  // the most recent version of moment will actually throw a cryptic exception,
-  // and instead of papering over this, just let it be thrown. will indicate that something
-  // needs to be fixed to the developer.
-  /*
-  xit('defaults to English when configured to locale that isn\'t loaded', function() {
-    pushOptions({
-      locale: 'zz'
-    });
-    var calendar = initCalendar();
-    var mom = calendar.moment('2014-05-01');
-    var s = mom.format('dddd MMMM Do YYYY');
-    expect(s).toEqual('Thursday May 1st 2014');
-  });
-  */
-
   it('works when certain locale has no FC settings defined', function() {
     initCalendar({
       locale: 'en-ca',
@@ -57,7 +9,7 @@ describe('locale', function() {
         { title: 'Christmas', start: '2014-12-25T10:00:00' }
       ]
     })
-    expect($('.fc-day-header:first')).toHaveText('Sun 12-21')
+    expect($('.fc-day-header:first')).toHaveText('Sun. 12-21')
     expect($('.fc-event .fc-time')).toHaveText('10:00')
   })
 
@@ -70,7 +22,7 @@ describe('locale', function() {
 
     var calendarEl = currentCalendar.el
 
-    expect($('h2', calendarEl)).toHaveText('julio 2016')
+    expect($('h2', calendarEl)).toHaveText('julio de 2016')
     expect($(calendarEl)).not.toHaveClass('fc-rtl')
 
     currentCalendar.option('locale', 'fr')

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

@@ -1,3 +1,5 @@
+import { formatIsoDay } from '../datelib/utils'
+
 describe('navLinks', function() {
   var options
 
@@ -56,7 +58,7 @@ describe('navLinks', function() {
 
     it('executes a custom handler', function() {
       options.navLinkDayClick = function(date, ev) {
-        expect(date.format()).toBe('2016-08-09')
+        expect(date).toEqualDate('2016-08-09')
         expect(typeof ev).toBe('object')
       }
       spyOn(options, 'navLinkDayClick').and.callThrough()
@@ -149,19 +151,23 @@ describe('navLinks', function() {
   ------------------------------------------------------------------------------------------------------------------ */
 
   function expectDayView(viewName, dayDate) {
-    dayDate = FullCalendar.moment(dayDate)
+    if (typeof dayDate === 'string') {
+      dayDate = new Date(dayDate)
+    }
     expect(getCurrentViewName()).toBe(viewName)
     var dates = getDayGridDates()
     expect(dates.length).toBe(1)
-    expect(dates[0].format()).toEqualMoment(dayDate)
+    expect(dates[0]).toEqualDate(dayDate)
   }
 
   function expectWeekView(viewName, firstDayDate) {
-    firstDayDate = FullCalendar.moment(firstDayDate)
+    if (typeof firstDayDate === 'string') {
+      firstDayDate = new Date(firstDayDate)
+    }
     expect(getCurrentViewName()).toBe(viewName)
     var dates = getDayGridDates()
     expect(dates.length).toBe(7)
-    expect(dates[0].format()).toEqualMoment(firstDayDate)
+    expect(dates[0]).toEqualDate(firstDayDate)
   }
 
   function getCurrentViewName() {
@@ -171,8 +177,10 @@ describe('navLinks', function() {
   // day headers (for both day grid and time grid)
 
   function getDayHeaderLink(dayDate) {
-    dayDate = FullCalendar.moment(dayDate)
-    return $('.fc-day-header[data-date="' + dayDate.format('YYYY-MM-DD') + '"] a')
+    if (typeof dayDate === 'string') {
+      dayDate = new Date(dayDate)
+    }
+    return $('.fc-day-header[data-date="' + formatIsoDay(dayDate) + '"] a')
   }
 
   function getDayHeaderLinks(dayDate) {
@@ -182,8 +190,10 @@ describe('navLinks', function() {
   // day grid
 
   function getDayGridNumberEl(dayDate) {
-    dayDate = FullCalendar.moment(dayDate)
-    return $('.fc-day-top[data-date="' + dayDate.format('YYYY-MM-DD') + '"] .fc-day-number')
+    if (typeof dayDate === 'string') {
+      dayDate = new Date(dayDate)
+    }
+    return $('.fc-day-top[data-date="' + formatIsoDay(dayDate) + '"] .fc-day-number')
   }
 
   function getDayGridClassicWeekLinks() { // along the sides of the row
@@ -196,15 +206,17 @@ describe('navLinks', function() {
 
   function getDayGridDates() {
     return $('.fc-day-grid .fc-day').map(function(i, el) {
-      return FullCalendar.moment($(el).data('date'))
+      return new Date($(el).data('date'))
     }).get()
   }
 
   // list view
 
   function getListDayHeaderLink(dayDate) {
-    dayDate = FullCalendar.moment(dayDate)
-    return $('.fc-list-heading[data-date="' + dayDate.format('YYYY-MM-DD') + '"] a.fc-list-heading-main')
+    if (typeof dayDate === 'string') {
+      dayDate = new Date(dayDate)
+    }
+    return $('.fc-list-heading[data-date="' + formatIsoDay(dayDate) + '"] a.fc-list-heading-main')
   }
 
   // agenda view

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

@@ -31,11 +31,11 @@ describe('now', function() {
     })
   })
 
-  it('accepts a function that returns a moment', function() {
+  it('accepts a function that returns a Date', function() {
     initCalendar({
       defaultView: 'month',
       now: function() {
-        return moment.utc('2014-05-01')
+        return new Date('2014-05-01')
       }
     })
     var todayCell = $('td.fc-today', currentCalendar.el)
@@ -43,7 +43,7 @@ describe('now', function() {
     expect(todayDate).toEqual('2014-05-01')
   })
 
-  it('accepts a function that returns a moment-ish string', function() {
+  it('accepts a function that returns a date string', function() {
     initCalendar({
       defaultView: 'month',
       now: function() {

+ 72 - 81
tests/automated/legacy/select-callback.js

@@ -24,15 +24,14 @@ describe('select callback', function() {
           options.defaultView = 'month'
         })
         it('gets fired correctly when the user selects cells', function(done) {
-          options.select = function(start, end, jsEvent, view) {
-            expect(moment.isMoment(start)).toEqual(true)
-            expect(moment.isMoment(end)).toEqual(true)
-            expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-            expect(typeof view).toEqual('object') // "
-            expect(start.hasTime()).toEqual(false)
-            expect(end.hasTime()).toEqual(false)
-            expect(start).toEqualMoment('2014-04-28')
-            expect(end).toEqualMoment('2014-05-07')
+          options.select = function(arg) {
+            expect(arg.start instanceof Date).toEqual(true)
+            expect(arg.end instanceof Date).toEqual(true)
+            expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+            expect(typeof arg.view).toEqual('object') // "
+            expect(arg.isAllDay).toEqual(true)
+            expect(arg.start).toEqualDate('2014-04-28')
+            expect(arg.end).toEqualDate('2014-05-07')
           }
           spyOn(options, 'select').and.callThrough()
           initCalendar(options)
@@ -45,15 +44,14 @@ describe('select callback', function() {
           })
         })
         it('gets fired correctly when the user selects cells via touch', function(done) {
-          options.select = function(start, end, jsEvent, view) {
-            expect(moment.isMoment(start)).toEqual(true)
-            expect(moment.isMoment(end)).toEqual(true)
-            expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-            expect(typeof view).toEqual('object') // "
-            expect(start.hasTime()).toEqual(false)
-            expect(end.hasTime()).toEqual(false)
-            expect(start).toEqualMoment('2014-04-28')
-            expect(end).toEqualMoment('2014-05-07')
+          options.select = function(arg) {
+            expect(arg.start instanceof Date).toEqual(true)
+            expect(arg.end instanceof Date).toEqual(true)
+            expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+            expect(typeof arg.view).toEqual('object') // "
+            expect(arg.isAllDay).toEqual(true)
+            expect(arg.start).toEqualDate('2014-04-28')
+            expect(arg.end).toEqualDate('2014-05-07')
           }
           spyOn(options, 'select').and.callThrough()
           initCalendar(options)
@@ -68,15 +66,14 @@ describe('select callback', function() {
           })
         })
         it('gets fired correctly when the user selects just one cell', function(done) {
-          options.select = function(start, end, jsEvent, view) {
-            expect(moment.isMoment(start)).toEqual(true)
-            expect(moment.isMoment(end)).toEqual(true)
-            expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-            expect(typeof view).toEqual('object') // "
-            expect(start.hasTime()).toEqual(false)
-            expect(end.hasTime()).toEqual(false)
-            expect(start).toEqualMoment('2014-04-28')
-            expect(end).toEqualMoment('2014-04-29')
+          options.select = function(arg) {
+            expect(arg.start instanceof Date).toEqual(true)
+            expect(arg.end instanceof Date).toEqual(true)
+            expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+            expect(typeof arg.view).toEqual('object') // "
+            expect(arg.isAllDay).toEqual(true)
+            expect(arg.start).toEqualDate('2014-04-28')
+            expect(arg.end).toEqualDate('2014-04-29')
           }
           spyOn(options, 'select').and.callThrough()
           initCalendar(options)
@@ -96,15 +93,14 @@ describe('select callback', function() {
         })
         describe('when selecting all-day slots', function() {
           it('gets fired correctly when the user selects cells', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(false)
-              expect(end.hasTime()).toEqual(false)
-              expect(start).toEqualMoment('2014-05-28')
-              expect(end).toEqualMoment('2014-05-30')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(true)
+              expect(arg.start).toEqualDate('2014-05-28')
+              expect(arg.end).toEqualDate('2014-05-30')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -117,15 +113,14 @@ describe('select callback', function() {
             })
           })
           it('gets fired correctly when the user selects a single cell', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(false)
-              expect(end.hasTime()).toEqual(false)
-              expect(start).toEqualMoment('2014-05-28')
-              expect(end).toEqualMoment('2014-05-29')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(true)
+              expect(arg.start).toEqualDate('2014-05-28')
+              expect(arg.end).toEqualDate('2014-05-29')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -139,15 +134,14 @@ describe('select callback', function() {
         })
         describe('when selecting timed slots', function() {
           it('gets fired correctly when the user selects slots', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(true)
-              expect(end.hasTime()).toEqual(true)
-              expect(start).toEqualMoment('2014-05-28T09:00:00')
-              expect(end).toEqualMoment('2014-05-28T10:30:00')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(false)
+              expect(arg.start).toEqualDate('2014-05-28T09:00:00Z')
+              expect(arg.end).toEqualDate('2014-05-28T10:30:00Z')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -160,15 +154,14 @@ describe('select callback', function() {
             })
           })
           it('gets fired correctly when the user selects slots via touch', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(true)
-              expect(end.hasTime()).toEqual(true)
-              expect(start).toEqualMoment('2014-05-28T09:00:00')
-              expect(end).toEqualMoment('2014-05-28T10:30:00')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(false)
+              expect(arg.start).toEqualDate('2014-05-28T09:00:00Z')
+              expect(arg.end).toEqualDate('2014-05-28T10:30:00Z')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -185,15 +178,14 @@ describe('select callback', function() {
             }, 0)
           })
           it('gets fired correctly when the user selects slots in a different day', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(true)
-              expect(end.hasTime()).toEqual(true)
-              expect(start).toEqualMoment('2014-05-28T09:00:00')
-              expect(end).toEqualMoment('2014-05-29T10:30:00')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(false)
+              expect(arg.start).toEqualDate('2014-05-28T09:00:00Z')
+              expect(arg.end).toEqualDate('2014-05-29T10:30:00Z')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -207,15 +199,14 @@ describe('select callback', function() {
             })
           })
           it('gets fired correctly when the user selects a single slot', function(done) {
-            options.select = function(start, end, jsEvent, view) {
-              expect(moment.isMoment(start)).toEqual(true)
-              expect(moment.isMoment(end)).toEqual(true)
-              expect(typeof jsEvent).toEqual('object') // TODO: more descrimination
-              expect(typeof view).toEqual('object') // "
-              expect(start.hasTime()).toEqual(true)
-              expect(end.hasTime()).toEqual(true)
-              expect(start).toEqualMoment('2014-05-28T09:00:00')
-              expect(end).toEqualMoment('2014-05-28T09:30:00')
+            options.select = function(arg) {
+              expect(arg.start instanceof Date).toEqual(true)
+              expect(arg.end instanceof Date).toEqual(true)
+              expect(typeof arg.jsEvent).toEqual('object') // TODO: more descrimination
+              expect(typeof arg.view).toEqual('object') // "
+              expect(arg.isAllDay).toEqual(false)
+              expect(arg.start).toEqualDate('2014-05-28T09:00:00Z')
+              expect(arg.end).toEqualDate('2014-05-28T09:30:00Z')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)

+ 26 - 30
tests/automated/legacy/select-method.js

@@ -26,7 +26,7 @@ describe('select method', function() {
         beforeEach(function() {
           options.defaultView = 'month'
         })
-        describe('when called with all-day moments', function() {
+        describe('when called with all-day date strings', function() {
           describe('when in bounds', function() {
             it('renders a selection', function() {
               initCalendar(options)
@@ -39,11 +39,10 @@ describe('select method', function() {
               expect($('.fc-highlight')).toBeVisible()
             })
             it('fires a selection event', function() {
-              options.select = function(start, end) {
-                expect(start.hasTime()).toEqual(false)
-                expect(end.hasTime()).toEqual(false)
-                expect(start).toEqualMoment('2014-05-07')
-                expect(end).toEqualMoment('2014-05-09')
+              options.select = function(arg) {
+                expect(arg.isAllDay).toEqual(true)
+                expect(arg.start).toEqualDate('2014-05-07')
+                expect(arg.end).toEqualDate('2014-05-09')
               }
               spyOn(options, 'select').and.callThrough()
               initCalendar(options)
@@ -60,9 +59,9 @@ describe('select method', function() {
             /*
             TODO: implement this behavior
             it('doesn\'t fire a selection event', function() {
-              options.select = function(start, end) {
-                expect(start).toEqualMoment('2014-05-07');
-                expect(end).toEqualMoment('2014-05-09');
+              options.select = function(arg) {
+                expect(arg.start).toEqualDate('2014-05-07');
+                expect(arg.end).toEqualDate('2014-05-09');
               };
               spyOn(options, 'select').and.callThrough();
               initCalendar(options);
@@ -72,18 +71,17 @@ describe('select method', function() {
             */
           })
         })
-        describe('when called with timed moments', function() {
+        describe('when called with timed date strings', function() {
           it('renders a selection', function() {
             initCalendar(options)
             currentCalendar.select('2014-05-07T06:00:00', '2014-05-09T07:00:00')
             expect($('.fc-highlight')).toBeVisible()
           })
           it('fires a selection event', function() {
-            options.select = function(start, end) {
-              expect(start.hasTime()).toEqual(true)
-              expect(end.hasTime()).toEqual(true)
-              expect(start).toEqualMoment('2014-05-07T06:00:00')
-              expect(end).toEqualMoment('2014-05-09T06:00:00')
+            options.select = function(arg) {
+              expect(arg.isAllDay).toEqual(false)
+              expect(arg.start).toEqualDate('2014-05-07T06:00:00Z')
+              expect(arg.end).toEqualDate('2014-05-09T06:00:00Z')
             }
             spyOn(options, 'select').and.callThrough()
             initCalendar(options)
@@ -98,7 +96,7 @@ describe('select method', function() {
           options.scrollTime = '01:00:00' // so that most events will be below the divider
           options.height = 400 // short enought to make scrolling happen
         })
-        describe('when called with timed moments', function() {
+        describe('when called with timed date strings', function() {
           describe('when in bounds', function() {
             it('renders a selection when called with one argument', function() {
               initCalendar(options)
@@ -123,9 +121,9 @@ describe('select method', function() {
             /*
             TODO: implement this behavior
             it('doesn\'t fire a selection event', function() {
-              options.select = function(start, end) {
-                expect(start).toEqualMoment('2015-05-07T06:00:00');
-                expect(end).toEqualMoment('2015-05-09T07:00:00');
+              options.select = function(arg) {
+                expect(arg.start).toEqualDate('2015-05-07T06:00:00Z');
+                expect(arg.end).toEqualDate('2015-05-09T07:00:00Z');
               };
               spyOn(options, 'select').and.callThrough();
               initCalendar(options);
@@ -135,7 +133,7 @@ describe('select method', function() {
             */
           })
         })
-        describe('when called with all-day moments', function() { // forget about in/out bounds for this :)
+        describe('when called with all-day date strings', function() { // forget about in/out bounds for this :)
           describe('when allDaySlot is on', function() {
             beforeEach(function() {
               options.allDaySlot = true
@@ -149,11 +147,10 @@ describe('select method', function() {
               expect(overlayTop).toBeLessThan(slotAreaTop)
             })
             it('fires a selection event', function() {
-              options.select = function(start, end) {
-                expect(start.hasTime()).toEqual(false)
-                expect(end.hasTime()).toEqual(false)
-                expect(start).toEqualMoment('2014-05-26')
-                expect(end).toEqualMoment('2014-05-28')
+              options.select = function(arg) {
+                expect(arg.isAllDay).toEqual(true)
+                expect(arg.start).toEqualDate('2014-05-26')
+                expect(arg.end).toEqualDate('2014-05-28')
               }
               spyOn(options, 'select').and.callThrough()
               initCalendar(options)
@@ -173,11 +170,10 @@ describe('select method', function() {
             /*
             TODO: implement
             it('doesn\'t fire a selection event', function() {
-              options.select = function(start, end) {
-                expect(start.hasTime()).toEqual(false);
-                expect(end.hasTime()).toEqual(false);
-                expect(start).toEqualMoment('2014-05-26');
-                expect(end).toEqualMoment('2014-05-28');
+              options.select = function(arg) {
+                expect(arg.isAllDay).toEqual(true);
+                expect(arg.start).toEqualDate('2014-05-26');
+                expect(arg.end).toEqualDate('2014-05-28');
               };
               spyOn(options, 'select').and.callThrough();
               initCalendar(options);

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

@@ -13,8 +13,8 @@ describe('selectAllow', function() {
     var options = {
       selectAllow: function(selectInfo) {
         expect(typeof selectInfo).toBe('object')
-        expect(moment.isMoment(selectInfo.start)).toBe(true)
-        expect(moment.isMoment(selectInfo.end)).toBe(true)
+        expect(selectInfo.start instanceof Date).toBe(true)
+        expect(selectInfo.end instanceof Date).toBe(true)
         return false
       }
     }
@@ -22,7 +22,7 @@ describe('selectAllow', function() {
 
     initCalendar(options)
 
-    selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
+    selectTimeGrid('2016-09-04T01:00:00Z', '2016-09-04T05:00:00Z')
       .then(function(selectInfo) {
         expect(selectInfo).toBeFalsy()
         expect(options.selectAllow).toHaveBeenCalled()
@@ -40,11 +40,11 @@ describe('selectAllow', function() {
 
     initCalendar(options)
 
-    selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
+    selectTimeGrid('2016-09-04T01:00:00Z', '2016-09-04T05:00:00Z')
       .then(function(selectInfo) {
         expect(typeof selectInfo).toBe('object')
-        expect(selectInfo.start.format()).toBe('2016-09-04T01:00:00')
-        expect(selectInfo.end.format()).toBe('2016-09-04T05:30:00')
+        expect(selectInfo.start).toEqualDate('2016-09-04T01:00:00Z')
+        expect(selectInfo.end).toEqualDate('2016-09-04T05:30:00Z')
         expect(options.selectAllow).toHaveBeenCalled()
         done()
       })

+ 4 - 4
tests/automated/legacy/timeFormat.js

@@ -33,9 +33,9 @@ describe('timeFormat', function() {
 
     it('renders correctly when customized', function() {
       initCalendar({
-        timeFormat: 'Hh:mm:mm'
+        timeFormat: { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }
       })
-      expect(getRenderedEventTime()).toBe('153:00:00')
+      expect(getRenderedEventTime()).toBe('15:00:00')
     })
   })
 
@@ -59,9 +59,9 @@ describe('timeFormat', function() {
 
     it('renders correctly when customized', function() {
       initCalendar({
-        timeFormat: 'Hh:mm:mm'
+        timeFormat: { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }
       })
-      expect(getRenderedEventTime()).toBe('153:00:00 - 175:00:00')
+      expect(getRenderedEventTime()).toBe('15:00:00 - 17:00:00')
     })
   })
 

+ 20 - 53
tests/automated/legacy/timezone.js

@@ -25,30 +25,6 @@ describe('timezone', function() {
     ]
   })
 
-  it('receives events correctly when no timezone', function(done) {
-    initCalendar({
-      eventAfterAllRender: function() {
-        expectNoTimezone()
-        done()
-      }
-    })
-  })
-
-  function expectNoTimezone() {
-    var allDayEvent = currentCalendar.clientEvents('1')[0]
-    var timedEvent = currentCalendar.clientEvents('2')[0]
-    var zonedEvent = currentCalendar.clientEvents('3')[0]
-    expect(allDayEvent.start.hasZone()).toEqual(false)
-    expect(allDayEvent.start.hasTime()).toEqual(false)
-    expect(allDayEvent.start.format()).toEqual('2014-05-02')
-    expect(timedEvent.start.hasZone()).toEqual(false)
-    expect(timedEvent.start.hasTime()).toEqual(true)
-    expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00')
-    expect(zonedEvent.start.hasZone()).toEqual(true)
-    expect(zonedEvent.start.hasTime()).toEqual(true)
-    expect(zonedEvent.start.format()).toEqual('2014-05-10T14:00:00+11:00')
-  }
-
 
   it('receives events correctly when local timezone', function(done) {
     initCalendar({
@@ -64,15 +40,12 @@ describe('timezone', function() {
     var allDayEvent = currentCalendar.clientEvents('1')[0]
     var timedEvent = currentCalendar.clientEvents('2')[0]
     var zonedEvent = currentCalendar.clientEvents('3')[0]
-    expect(allDayEvent.start.hasZone()).toEqual(false)
-    expect(allDayEvent.start.hasTime()).toEqual(false)
-    expect(allDayEvent.start.format()).toEqual('2014-05-02')
-    expect(timedEvent.start.hasZone()).toEqual(true)
-    expect(timedEvent.start.hasTime()).toEqual(true)
-    expect(timedEvent.start.utcOffset()).toEqual(-new Date(2014, 4, 10, 12).getTimezoneOffset())
-    expect(zonedEvent.start.hasZone()).toEqual(true)
-    expect(zonedEvent.start.hasTime()).toEqual(true)
-    expect(zonedEvent.start.utcOffset()).toEqual(-new Date('Sat May 10 2014 14:00:00 GMT+1100').getTimezoneOffset())
+    expect(allDayEvent.isAllDay).toEqual(true)
+    expect(allDayEvent.start).toEqualDate('2014-05-02T00:00:00') // local
+    expect(timedEvent.isAllDay).toEqual(false)
+    expect(timedEvent.start).toEqualDate('2014-05-10T12:00:00') // local
+    expect(zonedEvent.isAllDay).toEqual(false)
+    expect(zonedEvent.start).toEqualDate('2014-05-10T14:00:00+11:00')
   }
 
 
@@ -90,15 +63,12 @@ describe('timezone', function() {
     var allDayEvent = currentCalendar.clientEvents('1')[0]
     var timedEvent = currentCalendar.clientEvents('2')[0]
     var zonedEvent = currentCalendar.clientEvents('3')[0]
-    expect(allDayEvent.start.hasZone()).toEqual(false)
-    expect(allDayEvent.start.hasTime()).toEqual(false)
-    expect(allDayEvent.start.format()).toEqual('2014-05-02')
-    expect(timedEvent.start.hasZone()).toEqual(true)
-    expect(timedEvent.start.hasTime()).toEqual(true)
-    expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00Z')
-    expect(zonedEvent.start.hasZone()).toEqual(true)
-    expect(zonedEvent.start.hasTime()).toEqual(true)
-    expect(zonedEvent.start.format()).toEqual('2014-05-10T03:00:00Z')
+    expect(allDayEvent.isAllDay).toEqual(true)
+    expect(allDayEvent.start).toEqualDate('2014-05-02')
+    expect(timedEvent.isAllDay).toEqual(false)
+    expect(timedEvent.start).toEqualDate('2014-05-10T12:00:00Z')
+    expect(zonedEvent.isAllDay).toEqual(false)
+    expect(zonedEvent.start).toEqualDate('2014-05-10T14:00:00+11:00')
   }
 
 
@@ -116,15 +86,12 @@ describe('timezone', function() {
     var allDayEvent = currentCalendar.clientEvents('1')[0]
     var timedEvent = currentCalendar.clientEvents('2')[0]
     var zonedEvent = currentCalendar.clientEvents('3')[0]
-    expect(allDayEvent.start.hasZone()).toEqual(false)
-    expect(allDayEvent.start.hasTime()).toEqual(false)
-    expect(allDayEvent.start.format()).toEqual('2014-05-02')
-    expect(timedEvent.start.hasZone()).toEqual(false)
-    expect(timedEvent.start.hasTime()).toEqual(true)
-    expect(timedEvent.start.format()).toEqual('2014-05-10T12:00:00')
-    expect(zonedEvent.start.hasZone()).toEqual(true)
-    expect(zonedEvent.start.hasTime()).toEqual(true)
-    expect(zonedEvent.start.format()).toEqual('2014-05-10T14:00:00+11:00')
+    expect(allDayEvent.isAllDay).toEqual(true)
+    expect(allDayEvent.start).toEqualDate('2014-05-02')
+    expect(timedEvent.isAllDay).toEqual(false)
+    expect(timedEvent.start).toEqualDate('2014-05-10T12:00:00Z')
+    expect(zonedEvent.isAllDay).toEqual(false)
+    expect(zonedEvent.start).toEqualDate('2014-05-10T14:00:00Z') // coerced to UTC
   }
 
 
@@ -133,11 +100,11 @@ describe('timezone', function() {
     var rootEl
 
     initCalendar({
-      timezone: false,
+      timezone: 'local',
       eventAfterAllRender: function() {
         callCnt++
         if (callCnt === 1) {
-          expectNoTimezone()
+          expectLocalTimezone()
           rootEl = $('.fc-view > *:first')
           expect(rootEl.length).toBe(1)
           currentCalendar.option('timezone', 'UTC') // will cause second call...

+ 12 - 14
tests/automated/legacy/titleFormat.js

@@ -6,10 +6,10 @@ describe('titleFormat', function() {
 
     var viewWithFormat = [
       { view: 'month', expected: 'June 2014' },
-      { view: 'basicWeek', expected: /Jun 8 - 14,? 2014/ }, // moment changed LL defaults after 2.8
-      { view: 'agendaWeek', expected: /Jun 8 - 14,? 2014/ }, // "
-      { view: 'basicDay', expected: /June 12,? 2014/ }, // "
-      { view: 'agendaDay', expected: /June 12,? 2014/ } // "
+      { view: 'basicWeek', expected: /Jun 8 - 14,? 2014/ },
+      { view: 'agendaWeek', expected: /Jun 8 - 14,? 2014/ },
+      { view: 'basicDay', expected: /June 12,? 2014/ },
+      { view: 'agendaDay', expected: /June 12,? 2014/ }
     ]
 
     beforeEach(function() {
@@ -33,11 +33,10 @@ describe('titleFormat', function() {
   describe('when set on a per-view basis', function() {
 
     var viewWithFormat = [
-      { view: 'month', expected: '2014, June' },
-      { view: 'basicWeek', expected: '8 - 14 6 2014' },
-      { view: 'agendaWeek', expected: '8 - 14, 6, 2014' },
-      { view: 'basicDay', expected: 'Thursday June 12 2014' },
-      { view: 'agendaDay', expected: 'Thursday, June, 12, 2014' }
+      { view: 'month', expected: 'June 2014' },
+      { view: 'basicWeek', expected: 'Jun 8 - 14, 2014' },
+      { view: 'agendaWeek', expected: 'June 8 - 14, 2014' },
+      { view: 'basicDay', expected: 'Thursday, June 12, 2014' },
     ]
 
     beforeEach(function() {
@@ -45,11 +44,10 @@ describe('titleFormat', function() {
         defaultDate: '2014-06-12',
         titleRangeSeparator: ' - ',
         views: {
-          month: { titleFormat: 'YYYY, MMMM' },
-          basicWeek: { titleFormat: 'D M YYYY' },
-          agendaWeek: { titleFormat: 'D, M, YYYY' },
-          basicDay: { titleFormat: 'dddd MMMM D YYYY' },
-          agendaDay: { titleFormat: 'dddd, MMMM, D, YYYY' }
+          month: { titleFormat: { year: 'numeric', month: 'long' } },
+          basicWeek: { titleFormat: { day: 'numeric', month: 'short', year: 'numeric' } },
+          agendaWeek: { titleFormat: { day: 'numeric', month: 'long', year: 'numeric' } },
+          basicDay: { titleFormat: { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' } }
         }
       })
     })

+ 7 - 7
tests/automated/legacy/views-specific-options.js

@@ -7,7 +7,7 @@ describe('view-specific options', function() {
       right: 'month,basicWeek,basicDay,agendaWeek,agendaDay'
     },
     defaultView: 'month',
-    titleFormat: '[default]',
+    titleFormat: function() { return 'default' },
     views: { }
   })
 
@@ -22,7 +22,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         month: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })
@@ -39,7 +39,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         agendaWeek: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })
@@ -56,7 +56,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         basic: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })
@@ -73,7 +73,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         agenda: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })
@@ -90,7 +90,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         week: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })
@@ -107,7 +107,7 @@ describe('view-specific options', function() {
     initCalendar({
       views: {
         day: {
-          titleFormat: '[special!!!]'
+          titleFormat: function() { return 'special!!!' }
         }
       }
     })

+ 4 - 4
tests/automated/legacy/weekNumberTitle.js → tests/automated/legacy/weekLabel.js

@@ -1,4 +1,4 @@
-describe('weekNumberTitle', function() {
+describe('weekLabel', function() {
 
   pushOptions({
     weekNumbers: true
@@ -7,7 +7,7 @@ describe('weekNumberTitle', function() {
   function getRenderedWeekNumberTitle() {
     // works for both kinds of views
     var text = $('th.fc-week-number').text()
-    return text.replace(/\d/g, '')
+    return text.replace(/\d/g, '').trim()
   }
 
   [ 'basicWeek', 'agendaWeek' ].forEach(function(viewName) {
@@ -32,7 +32,7 @@ describe('weekNumberTitle', function() {
       it('renders correctly when customized and LTR', function() {
         initCalendar({
           isRTL: false,
-          weekNumberTitle: 'YO'
+          weekLabel: 'YO'
         })
         expect(getRenderedWeekNumberTitle()).toBe('YO')
       })
@@ -40,7 +40,7 @@ describe('weekNumberTitle', function() {
       it('renders correctly when customized and RTL', function() {
         initCalendar({
           isRTL: true,
-          weekNumberTitle: 'YO'
+          weekLabel: 'YO'
         })
         expect(getRenderedWeekNumberTitle()).toBe('YO')
       })

+ 2 - 2
tests/automated/lib/time-grid.js

@@ -27,8 +27,8 @@ export function selectTimeGrid(start, inclusiveEnd) {
   return new Promise(function(resolve) {
     var selectInfo = null
 
-    currentCalendar.on('select', function(start, end) {
-      selectInfo = { start: start, end: end }
+    currentCalendar.on('select', function(arg) {
+      selectInfo = arg
     })
 
     getTimeGridDayEls(start).simulate('drag', {

+ 4 - 4
tests/manual/week_numbers.html

@@ -9,16 +9,16 @@
 <script>
 
   $(document).ready(function() {
-  
+
     var date = new Date();
     var d = date.getDate();
     var m = date.getMonth();
     var y = date.getFullYear();
-    
+
     $('#calendar').fullCalendar({
 
       weekNumbers: true,
-      weekNumberTitle: 'Wk ',
+      weekLabel: 'Wk',
 
       //weekNumberCalculation: function(date) {
       //  return date.getMonth(); // inappropriate. but just for testing
@@ -82,7 +82,7 @@
         }
       ]
     });
-    
+
   });
 
 </script>