showNonCurrentDates.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import * as EventDragUtils from './EventDragUtils'
  2. import * as DayGridEventDragUtils from './DayGridEventDragUtils'
  3. import * as DayGridRenderUtils from '../view-render/DayGridRenderUtils'
  4. describe('showNonCurrentDates event dragging', function() {
  5. pushOptions({
  6. defaultView: 'month',
  7. defaultDate: '2017-06-01',
  8. showNonCurrentDates: false,
  9. events: [
  10. { start: '2017-06-07', end: '2017-06-10' }
  11. ],
  12. editable: true
  13. })
  14. describe('when dragging pointer into disabled region', function() {
  15. pit('won\'t allow the drop', function() {
  16. initCalendar()
  17. return EventDragUtils.drag(
  18. DayGridRenderUtils.getSingleDayEl('2017-06-08')[0].getBoundingClientRect(),
  19. DayGridRenderUtils.getDisabledEl(3)[0].getBoundingClientRect() // the cell before Jun 1
  20. ).then(function(res) {
  21. expect(res.isSuccess).toBe(false)
  22. })
  23. })
  24. })
  25. describe('when dragging an event\'s start into a disabled region', function() {
  26. pit('allow the drop if the cursor stays over non-disabled cells', function() {
  27. initCalendar()
  28. return DayGridEventDragUtils.drag('2017-06-08', '2017-06-01')
  29. .then(function(res) {
  30. expect(res.isSuccess).toBe(true)
  31. })
  32. })
  33. })
  34. })