validRange.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import * as DayGridEventDragUtils from './DayGridEventDragUtils'
  2. describe('validRange event dragging', function() {
  3. describe('when start constraint', function() {
  4. describe('when in month view', function() {
  5. pushOptions({
  6. defaultView: 'month',
  7. defaultDate: '2017-06-01',
  8. validRange: { start: '2017-06-06' },
  9. events: [
  10. { start: '2017-06-07', end: '2017-06-10' }
  11. ],
  12. editable: true
  13. })
  14. pit('won\'t go before validRange', function() {
  15. initCalendar()
  16. return DayGridEventDragUtils.drag('2017-06-08', '2017-06-06')
  17. .then(function(res) {
  18. expect(res.isSuccess).toBe(false)
  19. })
  20. })
  21. })
  22. })
  23. describe('when end constraint', function() {
  24. describe('when in month view', function() {
  25. pushOptions({
  26. defaultView: 'month',
  27. defaultDate: '2017-06-01',
  28. validRange: { end: '2017-06-09' },
  29. events: [
  30. { start: '2017-06-04', end: '2017-06-07' }
  31. ],
  32. editable: true
  33. })
  34. pit('won\'t go after validRange', function() {
  35. initCalendar()
  36. return DayGridEventDragUtils.drag('2017-06-05', '2017-06-08')
  37. .then(function(res) {
  38. expect(res.isSuccess).toBe(false)
  39. })
  40. })
  41. })
  42. })
  43. })