| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- describe('defaultTimedEventDuration', function() {
- pushOptions({
- defaultDate: '2014-05-01',
- defaultView: 'month'
- })
- describe('when forceEventDuration is on', function() {
- pushOptions({
- forceEventDuration: true
- })
- it('correctly calculates an unspecified end when using a Duration object input', function() {
- initCalendar({
- defaultTimedEventDuration: { hours: 2, minutes: 30 },
- events: [
- {
- allDay: false,
- start: '2014-05-05T04:00:00'
- }
- ]
- })
- var event = currentCalendar.clientEvents()[0]
- expect(event.end).toEqualMoment('2014-05-05T06:30:00')
- })
- it('correctly calculates an unspecified end when using a string Duration input', function() {
- initCalendar({
- defaultTimedEventDuration: '03:15:00',
- events: [
- {
- allDay: false,
- start: '2014-05-05T04:00:00'
- }
- ]
- })
- var event = currentCalendar.clientEvents()[0]
- expect(event.end).toEqualMoment('2014-05-05T07:15:00')
- })
- })
- describe('when forceEventDuration is off', function() {
- pushOptions({
- forceEventDuration: false
- })
- describe('with agendaWeek view', function() {
- pushOptions({
- defaultView: 'agendaWeek'
- })
- it('renders a timed event with no `end` to appear to have the default duration', function(done) {
- initCalendar({
- defaultTimedEventDuration: '01:15:00',
- events: [
- {
- // a control. so we know how tall it should be
- title: 'control event',
- allDay: false,
- start: '2014-05-01T04:00:00',
- end: '2014-05-01T05:15:00'
- },
- {
- // one day after the control. no specified end
- title: 'test event',
- allDay: false,
- start: '2014-05-02T04:00:00'
- }
- ],
- eventAfterAllRender: function() {
- var eventElms = $('.fc-event', currentCalendar.el)
- var height0 = eventElms.eq(0).outerHeight()
- var height1 = eventElms.eq(1).outerHeight()
- expect(height0).toBeGreaterThan(0)
- expect(height0).toEqual(height1)
- done()
- }
- })
- })
- })
- describe('with basicWeek view', function() {
- pushOptions({
- defaultView: 'basicWeek'
- })
- it('renders a timed event with no `end` to appear to have the default duration', function(done) {
- initCalendar({
- defaultTimedEventDuration: { days: 2 },
- events: [
- {
- // a control. so we know how wide it should be
- title: 'control event',
- allDay: false,
- start: '2014-04-28T04:00:00',
- end: '2014-04-30T00:00:00'
- },
- {
- // one day after the control. no specified end
- title: 'test event',
- allDay: false,
- start: '2014-04-28T04:00:00'
- }
- ],
- eventAfterAllRender: function() {
- var eventElms = $('.fc-event', currentCalendar.el)
- var width0 = eventElms.eq(0).outerWidth()
- var width1 = eventElms.eq(1).outerWidth()
- expect(width0).toBeGreaterThan(0)
- expect(width0).toEqual(width1)
- done()
- }
- })
- })
- })
- })
- })
|