next.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. describe('next', function() {
  2. pushOptions({
  3. defaultDate: '2017-06-08'
  4. });
  5. describe('when in agendaWeek view', function() {
  6. pushOptions({
  7. defaultView: 'agendaWeek'
  8. });
  9. describe('when dateIncrement not specified', function() {
  10. it('moves forward by one week', function() {
  11. initCalendar();
  12. currentCalendar.next();
  13. ViewDateUtils.expectActiveRange('2017-06-11', '2017-06-18');
  14. });
  15. })
  16. describeOptions('dateIncrement', {
  17. 'when two week dateIncrement specified as a plain object': { weeks: 2 },
  18. 'when two week dateIncrement specified as a Duration object': moment.duration({ weeks: 2 }),
  19. 'when two week dateIncrement specified as a string': '14.00:00:00'
  20. }, function() {
  21. it('moves forward by two weeks', function() {
  22. initCalendar();
  23. currentCalendar.next();
  24. ViewDateUtils.expectActiveRange('2017-06-18', '2017-06-25');
  25. });
  26. });
  27. it('does not duplicate-render skeleton', function() {
  28. initCalendar();
  29. currentCalendar.next();
  30. expect(TimeGridRenderUtils.isStructureValid()).toBe(true);
  31. });
  32. });
  33. describe('when in a month view', function() {
  34. pushOptions({
  35. defaultView: 'month'
  36. });
  37. describe('when dateIncrement not specified', function() {
  38. it('moves forward by one month', function() {
  39. initCalendar();
  40. currentCalendar.next();
  41. ViewDateUtils.expectActiveRange('2017-06-25', '2017-08-06');
  42. });
  43. });
  44. describe('when two month dateIncrement is specified', function() {
  45. pushOptions({
  46. dateIncrement: { months: 2 }
  47. });
  48. it('moves forward by two months', function() {
  49. initCalendar();
  50. currentCalendar.next();
  51. ViewDateUtils.expectActiveRange('2017-07-30', '2017-09-10');
  52. });
  53. });
  54. });
  55. describe('when in custom three day view', function() {
  56. pushOptions({
  57. defaultView: 'basic',
  58. duration: { days: 3 }
  59. });
  60. describe('when no dateAlignment is specified', function() {
  61. describe('when dateIncrement not specified', function() {
  62. it('moves forward three days', function() {
  63. initCalendar();
  64. currentCalendar.next();
  65. ViewDateUtils.expectActiveRange('2017-06-11', '2017-06-14');
  66. });
  67. });
  68. describe('when two day dateIncrement is specified', function() {
  69. pushOptions({
  70. dateIncrement: { days: 2 }
  71. })
  72. it('moves forward two days', function() {
  73. initCalendar();
  74. currentCalendar.next();
  75. ViewDateUtils.expectActiveRange('2017-06-10', '2017-06-13');
  76. });
  77. });
  78. })
  79. describe('when week dateAlignment is specified', function() {
  80. pushOptions({
  81. dateAlignment: 'week'
  82. });
  83. describe('when dateIncrement not specified', function() {
  84. it('moves forward one week', function() {
  85. initCalendar();
  86. currentCalendar.next();
  87. ViewDateUtils.expectActiveRange('2017-06-11', '2017-06-14');
  88. });
  89. });
  90. describe('when two day dateIncrement is specified', function() {
  91. pushOptions({
  92. dateIncrement: { days: 2 }
  93. });
  94. it('does not navigate nor rerender', function() {
  95. var called;
  96. initCalendar({
  97. viewRender: function() {
  98. called = true;
  99. }
  100. });
  101. called = false;
  102. currentCalendar.next();
  103. ViewDateUtils.expectActiveRange('2017-06-04', '2017-06-07'); // the same as how it started
  104. expect(called).toBe(false);
  105. });
  106. });
  107. });
  108. });
  109. });