forceEventDuration.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. describe('forceEventDuration', function() {
  2. var options;
  3. beforeEach(function() {
  4. affix('#cal');
  5. options = {
  6. defaultDate: '2014-05-01',
  7. defaultView: 'month'
  8. };
  9. });
  10. describe('when turned off', function() {
  11. beforeEach(function() {
  12. options.forceEventDuration = false;
  13. });
  14. it('allows a null end date for all-day and timed events', function() {
  15. options.events = [
  16. {
  17. id: '1',
  18. start: '2014-05-10'
  19. },
  20. {
  21. id: '2',
  22. start: '2014-05-10T14:00:00'
  23. }
  24. ];
  25. $('#cal').fullCalendar(options);
  26. var events = $('#cal').fullCalendar('clientEvents');
  27. expect(events[0].end).toBeNull();
  28. expect(events[1].end).toBeNull();
  29. });
  30. });
  31. describe('when turned on', function() {
  32. beforeEach(function() {
  33. options.forceEventDuration = true;
  34. });
  35. it('allows a null end date for all-day and timed events', function() {
  36. options.events = [
  37. {
  38. id: '1',
  39. start: '2014-05-10'
  40. },
  41. {
  42. id: '2',
  43. start: '2014-05-10T14:00:00'
  44. }
  45. ];
  46. $('#cal').fullCalendar(options);
  47. var events = $('#cal').fullCalendar('clientEvents');
  48. expect(events[0].id).toEqual('1');
  49. expect(moment.isMoment(events[0].end)).toEqual(true);
  50. expect(events[1].id).toEqual('2');
  51. expect(moment.isMoment(events[1].end)).toEqual(true);
  52. });
  53. });
  54. // NOTE: the actual verification of the correct calculation of the end
  55. // (using defaultTimedEventDuration and defaultAllDayEventDuration)
  56. // is done in those test files.
  57. });