|
@@ -1,5 +1,7 @@
|
|
|
|
|
|
|
|
describe('moment plugin', function() {
|
|
describe('moment plugin', function() {
|
|
|
|
|
+ let toMoment = FullCalendar.Moment.toMoment
|
|
|
|
|
+ let toDuration = FullCalendar.Moment.toDuration
|
|
|
|
|
|
|
|
// TODO: test formatting
|
|
// TODO: test formatting
|
|
|
|
|
|
|
@@ -13,8 +15,8 @@ describe('moment plugin', function() {
|
|
|
timeZone: 'UTC'
|
|
timeZone: 'UTC'
|
|
|
})
|
|
})
|
|
|
let event = calendar.getEvents()[0]
|
|
let event = calendar.getEvents()[0]
|
|
|
- var startMom = FullCalendar.toMoment(calendar, event.start)
|
|
|
|
|
- var endMom = FullCalendar.toMoment(calendar, event.end)
|
|
|
|
|
|
|
+ var startMom = toMoment(calendar, event.start)
|
|
|
|
|
+ var endMom = toMoment(calendar, event.end)
|
|
|
expect(startMom.format()).toEqual('2018-09-05T12:00:00Z')
|
|
expect(startMom.format()).toEqual('2018-09-05T12:00:00Z')
|
|
|
expect(endMom.format()).toEqual('2018-09-05T18:00:00Z')
|
|
expect(endMom.format()).toEqual('2018-09-05T18:00:00Z')
|
|
|
})
|
|
})
|
|
@@ -25,8 +27,8 @@ describe('moment plugin', function() {
|
|
|
timeZone: 'local'
|
|
timeZone: 'local'
|
|
|
})
|
|
})
|
|
|
let event = calendar.getEvents()[0]
|
|
let event = calendar.getEvents()[0]
|
|
|
- var startMom = FullCalendar.toMoment(calendar, event.start)
|
|
|
|
|
- var endMom = FullCalendar.toMoment(calendar, event.end)
|
|
|
|
|
|
|
+ var startMom = toMoment(calendar, event.start)
|
|
|
|
|
+ var endMom = toMoment(calendar, event.end)
|
|
|
expect(startMom.toDate()).toEqualDate('2018-09-05T12:00:00') // compare to local
|
|
expect(startMom.toDate()).toEqualDate('2018-09-05T12:00:00') // compare to local
|
|
|
expect(endMom.toDate()).toEqualDate('2018-09-05T18:00:00') // compare to local
|
|
expect(endMom.toDate()).toEqualDate('2018-09-05T18:00:00') // compare to local
|
|
|
})
|
|
})
|
|
@@ -39,7 +41,7 @@ describe('moment plugin', function() {
|
|
|
locale: 'es'
|
|
locale: 'es'
|
|
|
})
|
|
})
|
|
|
let event = calendar.getEvents()[0]
|
|
let event = calendar.getEvents()[0]
|
|
|
- var mom = FullCalendar.toMoment(calendar, event.start)
|
|
|
|
|
|
|
+ var mom = toMoment(calendar, event.start)
|
|
|
expect(mom.locale()).toEqual('es')
|
|
expect(mom.locale()).toEqual('es')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -54,8 +56,8 @@ describe('moment plugin', function() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// hacky way to have a duration parsed
|
|
// hacky way to have a duration parsed
|
|
|
- let timedDuration = FullCalendar.toDuration(calendar.defaultTimedEventDuration)
|
|
|
|
|
- let allDayDuration = FullCalendar.toDuration(calendar.defaultAllDayEventDuration)
|
|
|
|
|
|
|
+ let timedDuration = toDuration(calendar.defaultTimedEventDuration)
|
|
|
|
|
+ let allDayDuration = toDuration(calendar.defaultAllDayEventDuration)
|
|
|
|
|
|
|
|
expect(timedDuration.asHours()).toBe(5)
|
|
expect(timedDuration.asHours()).toBe(5)
|
|
|
expect(allDayDuration.asDays()).toBe(3)
|
|
expect(allDayDuration.asDays()).toBe(3)
|