|
@@ -1,63 +1,63 @@
|
|
|
describe('defaultAllDayEventDuration', function() {
|
|
describe('defaultAllDayEventDuration', function() {
|
|
|
|
|
|
|
|
- var options
|
|
|
|
|
-
|
|
|
|
|
- beforeEach(function() {
|
|
|
|
|
- affix('#cal')
|
|
|
|
|
-
|
|
|
|
|
- options = {
|
|
|
|
|
- defaultDate: '2014-05-01',
|
|
|
|
|
- defaultView: 'month'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ pushOptions({
|
|
|
|
|
+ defaultDate: '2014-05-01',
|
|
|
|
|
+ defaultView: 'month'
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('when forceEventDuration is on', function() {
|
|
describe('when forceEventDuration is on', function() {
|
|
|
|
|
|
|
|
- beforeEach(function() {
|
|
|
|
|
- options.forceEventDuration = true
|
|
|
|
|
|
|
+ pushOptions({
|
|
|
|
|
+ forceEventDuration: true
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('correctly calculates an unspecified end when using a Duration object input', function() {
|
|
it('correctly calculates an unspecified end when using a Duration object input', function() {
|
|
|
- options.defaultAllDayEventDuration = { days: 2 }
|
|
|
|
|
- options.events = [
|
|
|
|
|
- {
|
|
|
|
|
- allDay: true,
|
|
|
|
|
- start: '2014-05-05'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- $('#cal').fullCalendar(options)
|
|
|
|
|
- var event = $('#cal').fullCalendar('clientEvents')[0]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ initCalendar({
|
|
|
|
|
+ defaultAllDayEventDuration: { days: 2 },
|
|
|
|
|
+ events: [
|
|
|
|
|
+ {
|
|
|
|
|
+ allDay: true,
|
|
|
|
|
+ start: '2014-05-05'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ var event = currentCalendar.clientEvents()[0]
|
|
|
expect(event.end).toEqualMoment('2014-05-07')
|
|
expect(event.end).toEqualMoment('2014-05-07')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('correctly calculates an unspecified end when using a string Duration input', function() {
|
|
it('correctly calculates an unspecified end when using a string Duration input', function() {
|
|
|
- options.defaultAllDayEventDuration = '3.00:00:00'
|
|
|
|
|
- options.events = [
|
|
|
|
|
- {
|
|
|
|
|
- allDay: true,
|
|
|
|
|
- start: '2014-05-05'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- $('#cal').fullCalendar(options)
|
|
|
|
|
- var event = $('#cal').fullCalendar('clientEvents')[0]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ initCalendar({
|
|
|
|
|
+ defaultAllDayEventDuration: '3.00:00:00',
|
|
|
|
|
+ events: [
|
|
|
|
|
+ {
|
|
|
|
|
+ allDay: true,
|
|
|
|
|
+ start: '2014-05-05'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ var event = currentCalendar.clientEvents()[0]
|
|
|
expect(event.end).toEqualMoment('2014-05-08')
|
|
expect(event.end).toEqualMoment('2014-05-08')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('when forceEventDuration is off', function() {
|
|
describe('when forceEventDuration is off', function() {
|
|
|
|
|
|
|
|
- beforeEach(function() {
|
|
|
|
|
- options.forceEventDuration = false
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ pushOptions({
|
|
|
|
|
+ forceEventDuration: false
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- [ 'basicWeek', 'agendaWeek' ].forEach(function(viewName) { // because they render all-day events in similar ways
|
|
|
|
|
- describe('with ' + viewName + ' view', function() {
|
|
|
|
|
- beforeEach(function() {
|
|
|
|
|
- options.defaultView = viewName
|
|
|
|
|
- })
|
|
|
|
|
- it('renders an all-day event with no `end` to appear to have the default duration', function(done) {
|
|
|
|
|
- options.defaultAllDayEventDuration = { days: 2 }
|
|
|
|
|
- options.events = [
|
|
|
|
|
|
|
+ describeOptions('defaultView', {
|
|
|
|
|
+ 'with basicWeek view': 'basicWeek',
|
|
|
|
|
+ 'with agendaWeek view': 'agendaWeek'
|
|
|
|
|
+ }, function() {
|
|
|
|
|
+ it('renders an all-day event with no `end` to appear to have the default duration', function(done) {
|
|
|
|
|
+ initCalendar({
|
|
|
|
|
+ defaultAllDayEventDuration: { days: 2 },
|
|
|
|
|
+ events: [
|
|
|
{
|
|
{
|
|
|
// a control. so we know how wide it should be
|
|
// a control. so we know how wide it should be
|
|
|
title: 'control event',
|
|
title: 'control event',
|
|
@@ -71,15 +71,15 @@ describe('defaultAllDayEventDuration', function() {
|
|
|
allDay: true,
|
|
allDay: true,
|
|
|
start: '2014-04-28'
|
|
start: '2014-04-28'
|
|
|
}
|
|
}
|
|
|
- ]
|
|
|
|
|
- options.eventAfterAllRender = function() {
|
|
|
|
|
- var eventElms = $('#cal .fc-event')
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ eventAfterAllRender: function() {
|
|
|
|
|
+ var eventElms = $('.fc-event', currentCalendar.el)
|
|
|
var width0 = eventElms.eq(0).outerWidth()
|
|
var width0 = eventElms.eq(0).outerWidth()
|
|
|
var width1 = eventElms.eq(1).outerWidth()
|
|
var width1 = eventElms.eq(1).outerWidth()
|
|
|
|
|
+ expect(width0).toBeGreaterThan(0)
|
|
|
expect(width0).toEqual(width1)
|
|
expect(width0).toEqual(width1)
|
|
|
done()
|
|
done()
|
|
|
}
|
|
}
|
|
|
- $('#cal').fullCalendar(options)
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|