ViewRenderUtils.js 793 B

12345678910111213141516171819202122232425262728293031323334353637
  1. export function expectDayRange(start, end) {
  2. start = processWholeDay(start)
  3. end = processWholeDay(end)
  4. var dayBefore = start.clone().subtract(1, 'day')
  5. expectDay(dayBefore, false)
  6. var date = start.clone()
  7. while (date < end) { // eslint-disable-line
  8. expectDay(date, true)
  9. date.add(1, 'day')
  10. }
  11. // `date` is now the first day after the range
  12. expectDay(date, false)
  13. }
  14. export function expectDay(date, bool) {
  15. date = processWholeDay(date)
  16. var els = $('td.fc-day[data-date="' + date.format() + '"]')
  17. if (bool) {
  18. expect(els).toBeInDOM()
  19. } else {
  20. expect(els).not.toBeInDOM()
  21. }
  22. }
  23. function processWholeDay(date) {
  24. date = $.fullCalendar.moment.parseZone(date)
  25. expect(date.hasTime()).toBe(false)
  26. expect(date.hasZone()).toBe(false)
  27. return date
  28. }