next.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. describe('next', function() {
  2. pushOptions({
  3. defaultDate: '2017-06-08'
  4. });
  5. describe('when in a week 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. });
  28. describe('when in a month view', function() {
  29. pushOptions({
  30. defaultView: 'month'
  31. });
  32. describe('when dateIncrement not specified', function() {
  33. it('moves forward by one month', function() {
  34. initCalendar();
  35. currentCalendar.next();
  36. ViewDateUtils.expectActiveRange('2017-06-25', '2017-08-06');
  37. });
  38. });
  39. describe('when two month dateIncrement is specified', function() {
  40. pushOptions({
  41. dateIncrement: { months: 2 }
  42. });
  43. it('moves forward by two months', function() {
  44. initCalendar();
  45. currentCalendar.next();
  46. ViewDateUtils.expectActiveRange('2017-07-30', '2017-09-10');
  47. });
  48. });
  49. });
  50. describe('when in custom three day view', function() {
  51. pushOptions({
  52. defaultView: 'basic',
  53. duration: { days: 3 }
  54. });
  55. describe('when no dateAlignment is specified', function() {
  56. describe('when dateIncrement not specified', function() {
  57. it('moves forward three days', function() {
  58. initCalendar();
  59. currentCalendar.next();
  60. ViewDateUtils.expectActiveRange('2017-06-11', '2017-06-14');
  61. });
  62. });
  63. describe('when two day dateIncrement is specified', function() {
  64. pushOptions({
  65. dateIncrement: { days: 2 }
  66. })
  67. it('moves forward two days', function() {
  68. initCalendar();
  69. currentCalendar.next();
  70. ViewDateUtils.expectActiveRange('2017-06-10', '2017-06-13');
  71. });
  72. });
  73. })
  74. describe('when week dateAlignment is specified', function() {
  75. pushOptions({
  76. dateAlignment: 'week'
  77. });
  78. describe('when dateIncrement not specified', function() {
  79. it('moves forward one week', function() {
  80. initCalendar();
  81. currentCalendar.next();
  82. ViewDateUtils.expectActiveRange('2017-06-11', '2017-06-14');
  83. });
  84. });
  85. describe('when two day dateIncrement is specified', function() {
  86. pushOptions({
  87. dateIncrement: { days: 2 }
  88. });
  89. it('does not navigate nor rerender', function() {
  90. var called;
  91. initCalendar({
  92. viewRender: function() {
  93. called = true;
  94. }
  95. });
  96. called = false;
  97. currentCalendar.next();
  98. ViewDateUtils.expectActiveRange('2017-06-04', '2017-06-07'); // the same as how it started
  99. expect(called).toBe(false);
  100. });
  101. });
  102. });
  103. });
  104. });