Просмотр исходного кода

Merge branch 'v4' into reduxish

Adam Shaw 7 лет назад
Родитель
Сommit
be83793db5
43 измененных файлов с 714 добавлено и 329 удалено
  1. 2 1
      tests/automated/date-render/dayNumbers.js
  2. 5 3
      tests/automated/event-data/refetchEvents.js
  3. 2 2
      tests/automated/event-drag/DayGridEventDragUtils.js
  4. 5 4
      tests/automated/event-drag/repeating.js
  5. 2 2
      tests/automated/event-drag/showNonCurrentDates.js
  6. 79 5
      tests/automated/event-render/EventRenderUtils.js
  7. 9 6
      tests/automated/event-render/TimeGridEventRenderUtils.js
  8. 2 1
      tests/automated/event-render/eventOrder.js
  9. 2 2
      tests/automated/event-resize/DayGridEventResizeUtils.js
  10. 2 2
      tests/automated/event-resize/validRange.js
  11. 13 10
      tests/automated/legacy/Agenda-render.js
  12. 9 6
      tests/automated/legacy/DayGrid-events.js
  13. 25 12
      tests/automated/legacy/ListView.js
  14. 10 9
      tests/automated/legacy/TimeGrid-events.js
  15. 3 2
      tests/automated/legacy/addEventSource.js
  16. 29 18
      tests/automated/legacy/agenda-view.js
  17. 7 6
      tests/automated/legacy/allDaySlot.js
  18. 9 8
      tests/automated/legacy/allDayText.js
  19. 21 20
      tests/automated/legacy/aspectRatio.js
  20. 143 134
      tests/automated/legacy/background-events.js
  21. 8 3
      tests/automated/legacy/businessHours.js
  22. 9 14
      tests/automated/legacy/dayNames.js
  23. 8 6
      tests/automated/legacy/dayPopoverFormat.js
  24. 3 1
      tests/automated/legacy/defaultAllDayEventDuration.js
  25. 4 2
      tests/automated/legacy/defaultTimedEventDuration.js
  26. 9 7
      tests/automated/legacy/displayEventEnd.js
  27. 1 1
      tests/automated/legacy/event-obj.js
  28. 2 2
      tests/automated/legacy/event-resize.js
  29. 1 1
      tests/automated/legacy/events-gcal.js
  30. 1 1
      tests/automated/legacy/titleFormat.js
  31. 9 0
      tests/automated/lib/AgendaViewUtils.js
  32. 60 0
      tests/automated/lib/ListViewUtils.js
  33. 6 0
      tests/automated/lib/MonthViewUtils.js
  34. 6 0
      tests/automated/lib/ViewUtils.js
  35. 17 0
      tests/automated/lib/constants.js
  36. 1 1
      tests/automated/lib/date-matchers.js
  37. 3 0
      tests/automated/lib/day-grid.js
  38. 27 19
      tests/automated/lib/dnd-resize-utils.js
  39. 27 3
      tests/automated/lib/time-grid.js
  40. 126 6
      tests/automated/view-render/DayGridRenderUtils.js
  41. 3 7
      tests/automated/view-render/columnHeader.js
  42. 2 1
      tests/automated/view-render/columnHeaderHtml.js
  43. 2 1
      tests/automated/view-render/columnHeaderText.js

+ 2 - 1
tests/automated/date-render/dayNumbers.js

@@ -1,3 +1,4 @@
+import { getDayOfWeekHeaderElTopElText } from '../view-render/DayGridRenderUtils'
 
 describe('dayNumbers', function() {
   pushOptions({
@@ -9,7 +10,7 @@ describe('dayNumbers', function() {
       defaultView: 'month',
       locale: 'ar'
     })
-    expect($('td[data-date="2018-01-01"]')).toContainText('١') // an Arabic 1
+    expect(getDayOfWeekHeaderElTopElText('2018-01-01')).toEqual('١') // an Arabic 1
   })
 
 })

+ 5 - 3
tests/automated/event-data/refetchEvents.js

@@ -1,3 +1,5 @@
+import { getScrollerEl } from '../lib/MonthViewUtils'
+import { getEventEls } from '../event-render/EventRenderUtils'
 
 describe('refetchEvents', function() {
 
@@ -21,9 +23,9 @@ describe('refetchEvents', function() {
       ]
     }, el)
 
-    expect($('.fc-event').length).toBe(8)
+    expect(getEventEls().length).toBe(8)
 
-    scrollEl = el.find('.fc-scroller')
+    scrollEl = getScrollerEl()
     scrollEl.scrollTop(1000)
     scrollTop = scrollEl.scrollTop()
 
@@ -31,7 +33,7 @@ describe('refetchEvents', function() {
     expect(scrollTop).toBeGreaterThan(10)
 
     currentCalendar.refetchEvents()
-    expect($('.fc-event').length).toBe(8)
+    expect(getEventEls().length).toBe(8)
     expect(scrollEl.scrollTop()).toBe(scrollTop)
   })
 })

+ 2 - 2
tests/automated/event-drag/DayGridEventDragUtils.js

@@ -3,8 +3,8 @@ import * as DayGridRenderUtils from '../view-render/DayGridRenderUtils'
 
 
 export function drag(startDate, endDate, debug) {
-  var el0 = DayGridRenderUtils.getSingleDayEl(startDate)
-  var el1 = DayGridRenderUtils.getSingleDayEl(endDate)
+  var el0 = DayGridRenderUtils.getDayEl(startDate)
+  var el1 = DayGridRenderUtils.getDayEl(endDate)
 
   return EventDragUtils.drag(
     el0[0].getBoundingClientRect(),

+ 5 - 4
tests/automated/event-drag/repeating.js

@@ -1,4 +1,5 @@
 import * as TimeGridEventDragUtils from './TimeGridEventDragUtils'
+import { getVisibleEventEls, getFirstEventEl } from '../event-render/EventRenderUtils'
 
 describe('event dragging on repeating events', function() {
   pushOptions({
@@ -40,7 +41,7 @@ describe('event dragging on repeating events', function() {
       eventDragStart: function() {
         setTimeout(function() { // try go execute DURING the drag
           expect(
-            $('.fc-event:visible').filter(function(i, node) {
+            getVisibleEventEls().filter(function(i, node) {
               return $(node).css('visibility') !== 'hidden'
             }).length
           ).toBe(1)
@@ -53,7 +54,7 @@ describe('event dragging on repeating events', function() {
       }
     })
 
-    $('.fc-event:first').simulate('drag', {
+    getFirstEventEl().simulate('drag', {
       dx: 100,
       duration: 100 // ample time for separate eventDragStart/eventDrop
     })
@@ -76,7 +77,7 @@ describe('event dragging on repeating events', function() {
       eventDragStart: function() {
         setTimeout(function() { // try go execute DURING the drag
           expect(
-            $('.fc-event:visible').filter(function(i, node) {
+            getVisibleEventEls().filter(function(i, node) {
               return $(node).css('visibility') !== 'hidden'
             }).length
           ).toBe(2) // the dragging event AND the other regular event
@@ -89,7 +90,7 @@ describe('event dragging on repeating events', function() {
       }
     })
 
-    $('.fc-event:first').simulate('drag', {
+    getFirstEventEl().simulate('drag', {
       dx: 100,
       duration: 100 // ample time for separate eventDragStart/eventDrop
     })

+ 2 - 2
tests/automated/event-drag/showNonCurrentDates.js

@@ -17,8 +17,8 @@ describe('showNonCurrentDates event dragging', function() {
     pit('won\'t allow the drop', function() {
       initCalendar()
       return EventDragUtils.drag(
-        DayGridRenderUtils.getSingleDayEl('2017-06-08')[0].getBoundingClientRect(),
-        DayGridRenderUtils.getDisabledEl(3)[0].getBoundingClientRect() // the cell before Jun 1
+        DayGridRenderUtils.getDayEl('2017-06-08')[0].getBoundingClientRect(),
+        DayGridRenderUtils.getDisabledDayElAtIndex(3)[0].getBoundingClientRect() // the cell before Jun 1
       ).then(function(res) {
         expect(res).toBe(false)
       })

+ 79 - 5
tests/automated/event-render/EventRenderUtils.js

@@ -1,11 +1,28 @@
+const TIME_CLASS = 'fc-time'
+const EVENT_CLASS = 'fc-event'
+const TITLE_CLASS = 'fc-title'
+const RESIZER_CLASS = 'fc-resizer'
+const START_CLASS = 'fc-start'
+const END_CLASS = 'fc-end'
+const DAY_CLASS = 'fc-day'
+const EVENT_DOT_CLASS = 'fc-event-dot'
+const BACKGROUND_EVENT_CLASS = 'fc-bgevent'
+
+export function getEventElDotEl(el) {
+  return el.find(`.${EVENT_DOT_CLASS}`)
+}
+
+export function replaceEventElDotElWithEl(eventEl, newDotEl) {
+  return getEventElDotEl(eventEl).replaceWith(newDotEl)
+}
 
 export function expectIsStart(bool) {
   var el = getSingleEl()
 
   if (bool) {
-    expect(el).toHaveClass('fc-start')
+    expect(el).toHaveClass(START_CLASS)
   } else {
-    expect(el).not.toHaveClass('fc-start')
+    expect(el).not.toHaveClass(START_CLASS)
   }
 }
 
@@ -13,14 +30,71 @@ export function expectIsEnd(bool) {
   var el = getSingleEl()
 
   if (bool) {
-    expect(el).toHaveClass('fc-end')
+    expect(el).toHaveClass(END_CLASS)
   } else {
-    expect(el).not.toHaveClass('fc-end')
+    expect(el).not.toHaveClass(END_CLASS)
   }
 }
 
+export function getEventElTimeText(el) {
+  return $(el).find(`.${TIME_CLASS}`).text()
+}
+
+export function getVisibleEventEls() {
+  return $(`.${EVENT_CLASS}:visible`)
+}
+
+export function getDayEls() {
+  return $(`.${DAY_CLASS}`)
+}
+
+export function getEventEls() {
+  return $(`.${EVENT_CLASS}`)
+}
+
+export function getBackgroundEventEls(containerEl) {
+  return $(`.${BACKGROUND_EVENT_CLASS}`, containerEl)
+}
+
+export function getEventElAtIndex(index) {
+  return getEventEls().eq(index)
+}
+
+export function getFirstEventEl() {
+  return getEventEls().first()
+}
+
+export function getLastEventEl() {
+  return getEventEls().last()
+}
+
+export function getEventElTitleEl(eventEl) {
+  return eventEl.find(`.${TITLE_CLASS}`)
+}
+
+export function getEventElResizerEl(eventEl) {
+  return eventEl.find(`.${RESIZER_CLASS}`)
+}
+
 export function getSingleEl() {
-  var els = $('.fc-event')
+  var els = getEventEls()
   expect(els).toHaveLength(1)
   return els
 }
+
+export function getSingleBackgroundEventEl() {
+  var els = getBackgroundEventEls()
+  expect(els).toHaveLength(1)
+  return els
+}
+
+export function getEventElTimeEl(el) {
+  return el.find(`.${TIME_CLASS}`)
+}
+
+export function getEventElsWithCustomClass(customClass) {
+  return $(`.${customClass}`)
+}
+
+
+

+ 9 - 6
tests/automated/event-render/TimeGridEventRenderUtils.js

@@ -1,7 +1,10 @@
+import { getDayOfWeekHeaderEls } from '../view-render/DayGridRenderUtils'
+import { getSlotEls } from '../lib/time-grid'
+import { getEventEls, getEventElTimeText } from './EventRenderUtils'
 
 export function getTimeTexts() {
-  return $('.fc-event').map(function(i, eventEl) {
-    return $(eventEl).find('.fc-time').text()
+  return getEventEls().map(function(i, eventEl) {
+    return getEventElTimeText(eventEl)
   }).get()
 }
 
@@ -20,7 +23,7 @@ export function checkEventRendering(start, end) {
   }
 
   var expectedRects = computeSpanRects(start, end)
-  var eventEls = $('.fc-event') // sorted by DOM order. not good for RTL
+  var eventEls = getEventEls() // sorted by DOM order. not good for RTL
   var isMatch = checkEventRenderingMatch(expectedRects, eventEls)
 
   return {
@@ -139,9 +142,9 @@ export function computeSpanRects(start, end) {
 
 
 function computeDays() {
-  var dayEls = $('.fc-day-header[data-date]')
+  var dayOfWeekHeaderEls = getDayOfWeekHeaderEls()
 
-  var days = dayEls.map(function(i, node) {
+  var days = dayOfWeekHeaderEls.map(function(i, node) {
     var rect = node.getBoundingClientRect()
     return $.extend({}, rect, {
       date: FullCalendar.parseMarker(
@@ -155,7 +158,7 @@ function computeDays() {
 
 
 function computeSlots() {
-  var slotEls = $('.fc-time-grid .fc-slats tr[data-time]')
+  var slotEls = getSlotEls()
 
   var slots = slotEls.map(function(i, node) {
     var rect = node.getBoundingClientRect()

+ 2 - 1
tests/automated/event-render/eventOrder.js

@@ -1,3 +1,4 @@
+import { getEventEls } from './EventRenderUtils'
 
 describe('eventOrder', function() {
   pushOptions({
@@ -87,7 +88,7 @@ describe('eventOrder', function() {
   })
 
   function getEventOrder() {
-    return $('.fc-event').map(function(i, node) {
+    return getEventEls().map(function(i, node) {
       return $(node).data('event-id')
     }).get()
   }

+ 2 - 2
tests/automated/event-resize/DayGridEventResizeUtils.js

@@ -3,8 +3,8 @@ import * as DayGridRenderUtils from '../view-render/DayGridRenderUtils'
 
 
 export function resize(startDate, endDate, debug) {
-  var el0 = DayGridRenderUtils.getSingleDayEl(startDate)
-  var el1 = DayGridRenderUtils.getSingleDayEl(endDate)
+  var el0 = DayGridRenderUtils.getDayEl(startDate)
+  var el1 = DayGridRenderUtils.getDayEl(endDate)
 
   return EventResizeUtils.resize(
     el0[0].getBoundingClientRect(),

+ 2 - 2
tests/automated/event-resize/validRange.js

@@ -17,8 +17,8 @@ describe('validRange event resizing', function() {
     pit('won\'t go after validRange', function() {
       initCalendar()
       return EventResizeUtils.resize(
-        DayGridRenderUtils.getSingleDayEl('2017-06-06')[0].getBoundingClientRect(),
-        DayGridRenderUtils.getDisabledEl(0)[0].getBoundingClientRect() // where Jun 9th would be
+        DayGridRenderUtils.getDayEl('2017-06-06')[0].getBoundingClientRect(),
+        DayGridRenderUtils.getDisabledDayElAtIndex(0)[0].getBoundingClientRect() // where Jun 9th would be
       ).then(function(res) {
         expect(res).toBe(false)
       })

+ 13 - 10
tests/automated/legacy/Agenda-render.js

@@ -1,3 +1,8 @@
+import {
+  getFirstDayEl, getTimeGridHeaderAxisEl,
+  getDayGridAxisEl, getSlatElAxisEl,
+  getSlatElGridEls, getFirstDayGridDayEl } from './../view-render/DayGridRenderUtils'
+import { getSlotEls } from '../lib/time-grid'
 
 describe('Agenda view rendering', function() {
   pushOptions({
@@ -11,11 +16,10 @@ describe('Agenda view rendering', function() {
 
     it('renders the axis on the left', function() {
       initCalendar()
-      var header = $('.fc-view > table > thead')
-      var firstSlat = $('.fc-slats tr:first')
-      expect(header.find('.fc-axis')).toBeLeftOf(header.find('.fc-day-header:first'))
-      expect($('.fc-day-grid .fc-axis')).toBeLeftOf($('.fc-day-grid .fc-day:first'))
-      expect(firstSlat.find('.fc-axis')).toBeLeftOf(firstSlat.find('td:not(.fc-axis)'))
+      var firstSlat = getSlotEls().first()
+      expect(getTimeGridHeaderAxisEl()).toBeLeftOf(getFirstDayEl())
+      expect(getDayGridAxisEl()).toBeLeftOf(getFirstDayGridDayEl())
+      expect(getSlatElAxisEl(firstSlat)).toBeLeftOf(getSlatElGridEls(firstSlat))
     })
   })
 
@@ -26,11 +30,10 @@ describe('Agenda view rendering', function() {
 
     it('renders the axis on the right', function() {
       initCalendar()
-      var header = $('.fc-view > table > thead')
-      var firstSlat = $('.fc-slats tr:first')
-      expect(header.find('.fc-axis')).toBeRightOf(header.find('.fc-day-header:first'))
-      expect($('.fc-day-grid .fc-axis')).toBeRightOf($('.fc-day-grid .fc-day:first'))
-      expect(firstSlat.find('.fc-axis')).toBeRightOf(firstSlat.find('td:not(.fc-axis)'))
+      var firstSlat = getSlotEls().first()
+      expect(getTimeGridHeaderAxisEl()).toBeRightOf(getFirstDayEl())
+      expect(getDayGridAxisEl()).toBeRightOf(getFirstDayGridDayEl())
+      expect(getSlatElAxisEl(firstSlat)).toBeRightOf(getSlatElGridEls(firstSlat))
     })
   })
 })

+ 9 - 6
tests/automated/legacy/DayGrid-events.js

@@ -1,3 +1,6 @@
+import { getDayGridRowDayElAtIndex, getDayGridRowElAtIndex } from '../view-render/DayGridRenderUtils'
+import { getFirstEventEl, getSingleEl } from '../event-render/EventRenderUtils'
+
 describe('DayGrid event rendering', function() {
   pushOptions({
     defaultDate: '2014-08-01', // 2014-07-27 - 2014-10-07 (excl)
@@ -204,10 +207,10 @@ describe('DayGrid event rendering', function() {
       }
     ]
     initCalendar(options)
-    var row0 = $('.fc-day-grid .fc-row:eq(0)')
+    var row0 = getDayGridRowElAtIndex(0)
     var row0event1 = row0.find('.event1')
     var row0event2 = row0.find('.event2')
-    var row1 = $('.fc-day-grid .fc-row:eq(1)')
+    var row1 = getDayGridRowElAtIndex(1)
     var row1event1 = row1.find('.event1')
     var row1event2 = row1.find('.event2')
     expect(row0event1.offset().top).toBeLessThan(row0event2.offset().top)
@@ -221,7 +224,7 @@ describe('DayGrid event rendering', function() {
       start: '2014-08-01'
     } ]
     initCalendar(options)
-    var seg = $('.fc-event')
+    var seg = getSingleEl()
     expect(seg).not.toHaveAttr('href')
   })
 
@@ -233,7 +236,7 @@ describe('DayGrid event rendering', function() {
       url: 'http://google.com/'
     } ]
     initCalendar(options)
-    var seg = $('.fc-event')
+    var seg = getSingleEl()
     expect(seg).toHaveAttr('href')
   })
 
@@ -248,10 +251,10 @@ describe('DayGrid event rendering', function() {
     - isEnd
   */
   function directionallyTestSeg(opts, isRTL) {
-    var el = $(opts.el || '.fc-event:first')
+    var el = opts.el ? $(opts.el) : getFirstEventEl()
 
     var row = opts.row || 0
-    var rowTds = $('.fc-day-grid .fc-row:eq(' + row + ') .fc-day')
+    var rowTds = getDayGridRowDayElAtIndex(row)
     expect(rowTds.length).toBeGreaterThan(1)
 
     var leftCol

+ 25 - 12
tests/automated/legacy/ListView.js

@@ -1,3 +1,16 @@
+import {
+  getEmptyMessageElsCount,
+  getListHeadingElAltElText,
+  getListHeadingElMainElText,
+  getListHeadingEls,
+  getListEventEls,
+  getListEventElsCount,
+  getListEventElTimeText,
+  getListEventElTitle
+} from '../lib/ListViewUtils'
+import { getScrollerEl } from '../lib/MonthViewUtils'
+import { replaceEventElDotElWithEl } from '../event-render/EventRenderUtils'
+
 describe('ListView rendering', function() {
   pushOptions({
     defaultView: 'listWeek',
@@ -40,7 +53,7 @@ describe('ListView rendering', function() {
       it('filters events through eventRender', function() {
         var options = {}
         options.eventRender = function(arg) {
-          $(arg.el).find('.fc-event-dot').replaceWith('<span class="custom-icon" />')
+          replaceEventElDotElWithEl($(arg.el), '<span class="custom-icon" />')
         }
 
         initCalendar(options)
@@ -396,7 +409,7 @@ describe('ListView rendering', function() {
       initCalendar({
         header: false
       }, $el)
-      let $scrollEl = $('.fc-view .fc-scroller')
+      let $scrollEl = getScrollerEl()
       expect(
         $scrollEl[0].scrollHeight
       ).toBeGreaterThan(
@@ -411,7 +424,7 @@ describe('ListView rendering', function() {
         header: false,
         height: 'auto'
       }, $el)
-      let $scrollEl = $('.fc-view .fc-scroller')
+      let $scrollEl = getScrollerEl()
       expect(
         Math.abs($scrollEl[0].scrollHeight - $scrollEl[0].clientHeight)
       ).toBeLessThan(2)
@@ -430,35 +443,35 @@ describe('ListView rendering', function() {
     initCalendar(options)
     currentCalendar.changeView('listWeek')
 
-    expect($('.fc-list-item').length).toBe(1)
+    expect(getListEventElsCount()).toBe(1)
 
     currentCalendar.prev()
 
-    expect($('.fc-list-item').length).toBe(0)
+    expect(getListEventElsCount()).toBe(0)
   })
 
   function getDayInfo() {
-    return $('.fc-list-heading').map(function(i, el) {
+    return getListHeadingEls().map(function(i, el) {
       el = $(el)
       return {
-        mainText: el.find('.fc-list-heading-main').text() || '',
-        altText: el.find('.fc-list-heading-alt').text() || '',
+        mainText: getListHeadingElMainElText(el) || '',
+        altText: getListHeadingElAltElText(el) || '',
         date: new Date(el.data('date'))
       }
     }).get()
   }
 
   function getEventInfo() { // gets all *segments*
-    return $('.fc-list-item').map(function(i, el) {
+    return getListEventEls().map(function(i, el) {
       el = $(el)
       return {
-        title: el.find('.fc-list-item-title').text() || '', // text!
-        timeText: el.find('.fc-list-item-time').text() || '' // text!
+        title: getListEventElTitle(el) || '', // text!
+        timeText: getListEventElTimeText(el) || '' // text!
       }
     }).get()
   }
 
   function getIsEmptyMessage() {
-    return Boolean($('.fc-list-empty').length)
+    return Boolean(getEmptyMessageElsCount())
   }
 })

+ 10 - 9
tests/automated/legacy/TimeGrid-events.js

@@ -1,3 +1,4 @@
+import { getEventElAtIndex, getEventElTimeEl, getSingleEl } from '../event-render/EventRenderUtils'
 
 describe('TimeGrid event rendering', function() {
 
@@ -15,7 +16,7 @@ describe('TimeGrid event rendering', function() {
         end: '2014-08-18T22:00:00'
       } ]
     })
-    expect('.fc-event .fc-time').toHaveText('2:00 - 10:00')
+    expect(getEventElTimeEl(getSingleEl())).toHaveText('2:00 - 10:00')
   })
 
   it('renders time to/from midnight for an event that spans two days', function() {
@@ -26,10 +27,10 @@ describe('TimeGrid event rendering', function() {
         end: '2014-08-19T22:00:00'
       } ]
     })
-    var seg1 = $('.fc-event:eq(0)')
-    var seg2 = $('.fc-event:eq(1)')
-    expect(seg1.find('.fc-time')).toHaveText('2:00 - 12:00')
-    expect(seg2.find('.fc-time')).toHaveText('12:00 - 10:00')
+    var seg1 = getEventElAtIndex(0)
+    var seg2 = getEventElAtIndex(1)
+    expect(getEventElTimeEl(seg1)).toHaveText('2:00 - 12:00')
+    expect(getEventElTimeEl(seg2)).toHaveText('12:00 - 10:00')
   })
 
   it('renders no time on an event segment that spans through an entire day', function() {
@@ -40,9 +41,9 @@ describe('TimeGrid event rendering', function() {
         end: '2014-08-20T22:00:00'
       } ]
     })
-    var seg2 = $('.fc-event:eq(1)')
+    var seg2 = getEventElAtIndex(1)
     expect(seg2).toBeInDOM()
-    expect(seg2.find('.fc-time')).not.toBeInDOM()
+    expect(getEventElTimeEl(seg2)).not.toBeInDOM()
   })
 
   it('renders an event with no url with no <a> href', function() {
@@ -52,7 +53,7 @@ describe('TimeGrid event rendering', function() {
         start: '2014-08-18T02:00:00'
       } ]
     })
-    var seg = $('.fc-event')
+    var seg = getSingleEl()
     expect(seg).not.toHaveAttr('href')
   })
 
@@ -64,7 +65,7 @@ describe('TimeGrid event rendering', function() {
         url: 'http://google.com/'
       } ]
     })
-    var seg = $('.fc-event')
+    var seg = getSingleEl()
     expect(seg).toHaveAttr('href')
   })
 

+ 3 - 2
tests/automated/legacy/addEventSource.js

@@ -1,3 +1,5 @@
+import { getEventEls } from './../event-render/EventRenderUtils'
+
 describe('addEventSource', function() {
   var eventArray = [
     { id: 0, title: 'event zero', start: '2014-06-24', className: 'event-zero' },
@@ -103,7 +105,6 @@ describe('addEventSource', function() {
   // has internal info on all the events.
   function checkAllEvents() {
     expect(currentCalendar.getEvents().length).toEqual(3)
-    expect($('.fc-event').length).toEqual(3)
+    expect(getEventEls().length).toEqual(3)
   }
-
 })

+ 29 - 18
tests/automated/legacy/agenda-view.js

@@ -1,3 +1,14 @@
+import { getHeaderTopEls } from './../view-render/DayGridRenderUtils'
+import { DAY_CLASSES } from '../lib/constants'
+
+
+const [
+  SUNDAY_CLASS, MONDAY_CLASS, TUESDAY_CLASS,
+  WEDNESDAY_CLASS, THURSDAY_CLASS,
+  FRIDAY_CLASS, SATURDY_CLASS
+] = DAY_CLASSES
+
+const AXIS_CLASS = 'fc-axis'
 
 describe('agenda view rendering', function() {
 
@@ -9,15 +20,15 @@ describe('agenda view rendering', function() {
 
     it('should have have days ordered sun to sat', function() {
       initCalendar()
-      var headers = $('.fc-view > table > thead th')
-      expect(headers[0]).toHaveClass('fc-axis')
-      expect(headers[1]).toHaveClass('fc-sun')
-      expect(headers[2]).toHaveClass('fc-mon')
-      expect(headers[3]).toHaveClass('fc-tue')
-      expect(headers[4]).toHaveClass('fc-wed')
-      expect(headers[5]).toHaveClass('fc-thu')
-      expect(headers[6]).toHaveClass('fc-fri')
-      expect(headers[7]).toHaveClass('fc-sat')
+      var headers = getHeaderTopEls()
+      expect(headers[0]).toHaveClass(AXIS_CLASS)
+      expect(headers[1]).toHaveClass(SUNDAY_CLASS)
+      expect(headers[2]).toHaveClass(MONDAY_CLASS)
+      expect(headers[3]).toHaveClass(TUESDAY_CLASS)
+      expect(headers[4]).toHaveClass(WEDNESDAY_CLASS)
+      expect(headers[5]).toHaveClass(THURSDAY_CLASS)
+      expect(headers[6]).toHaveClass(FRIDAY_CLASS)
+      expect(headers[7]).toHaveClass(SATURDY_CLASS)
     })
   })
 
@@ -29,15 +40,15 @@ describe('agenda view rendering', function() {
 
     it('should have have days ordered sat to sun', function() {
       initCalendar()
-      var headers = $('.fc-view > table > thead th')
-      expect(headers[0]).toHaveClass('fc-sat')
-      expect(headers[1]).toHaveClass('fc-fri')
-      expect(headers[2]).toHaveClass('fc-thu')
-      expect(headers[3]).toHaveClass('fc-wed')
-      expect(headers[4]).toHaveClass('fc-tue')
-      expect(headers[5]).toHaveClass('fc-mon')
-      expect(headers[6]).toHaveClass('fc-sun')
-      expect(headers[7]).toHaveClass('fc-axis')
+      var headers = getHeaderTopEls()
+      expect(headers[0]).toHaveClass(SATURDY_CLASS)
+      expect(headers[1]).toHaveClass(FRIDAY_CLASS)
+      expect(headers[2]).toHaveClass(THURSDAY_CLASS)
+      expect(headers[3]).toHaveClass(WEDNESDAY_CLASS)
+      expect(headers[4]).toHaveClass(TUESDAY_CLASS)
+      expect(headers[5]).toHaveClass(MONDAY_CLASS)
+      expect(headers[6]).toHaveClass(SUNDAY_CLASS)
+      expect(headers[7]).toHaveClass(AXIS_CLASS)
     })
   })
 

+ 7 - 6
tests/automated/legacy/allDaySlot.js

@@ -1,3 +1,4 @@
+import { getDayGridSlotElsCount } from './../lib/AgendaViewUtils'
 
 describe('allDaySlots', function() {
 
@@ -8,7 +9,7 @@ describe('allDaySlots', function() {
           defaultView: 'agendaWeek'
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(1)
       })
     })
@@ -18,7 +19,7 @@ describe('allDaySlots', function() {
           defaultView: 'agendaDay'
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(1)
       })
     })
@@ -32,7 +33,7 @@ describe('allDaySlots', function() {
           allDaySlot: true
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(1)
       })
     })
@@ -43,7 +44,7 @@ describe('allDaySlots', function() {
           allDaySlot: true
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(1)
       })
     })
@@ -57,7 +58,7 @@ describe('allDaySlots', function() {
           allDaySlot: false
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(0)
       })
     })
@@ -68,7 +69,7 @@ describe('allDaySlots', function() {
           allDaySlot: false
         }
         initCalendar(options)
-        var allDaySlotCount = $('.fc-day-grid').length
+        var allDaySlotCount = getDayGridSlotElsCount()
         expect(allDaySlotCount).toEqual(0)
       })
     })

+ 9 - 8
tests/automated/legacy/allDayText.js

@@ -1,3 +1,4 @@
+import { getAllDayAxisElText } from '../view-render/DayGridRenderUtils'
 
 describe('allDayText', function() {
 
@@ -8,7 +9,7 @@ describe('allDayText', function() {
           defaultView: 'agendaWeek'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('all-day')
       })
     })
@@ -18,7 +19,7 @@ describe('allDayText', function() {
           defaultView: 'agendaDay'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('all-day')
       })
     })
@@ -32,7 +33,7 @@ describe('allDayText', function() {
           allDaySlot: true
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('all-day')
       })
     })
@@ -43,7 +44,7 @@ describe('allDayText', function() {
           allDaySlot: true
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('all-day')
       })
     })
@@ -58,7 +59,7 @@ describe('allDayText', function() {
           locale: 'pt-br'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('dia inteiro')
       })
     })
@@ -70,7 +71,7 @@ describe('allDayText', function() {
           locale: 'pt-br'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('dia inteiro')
       })
     })
@@ -85,7 +86,7 @@ describe('allDayText', function() {
           allDayText: 'axis-phosy'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('axis-phosy')
       })
     })
@@ -96,7 +97,7 @@ describe('allDayText', function() {
           allDayText: 'axis-phosy'
         }
         initCalendar(options)
-        var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text()
+        var allDayText = getAllDayAxisElText()
         expect(allDayText).toEqual('axis-phosy')
       })
     })

+ 21 - 20
tests/automated/legacy/aspectRatio.js

@@ -1,3 +1,4 @@
+import { getViewContainerEl } from '../lib/ViewUtils'
 
 describe('aspectRatio', function() {
 
@@ -11,13 +12,13 @@ describe('aspectRatio', function() {
 
     it('fc-content should use the ratio 1:35 to set height', function() {
       initCalendar({}, getCalendarElement(elementWidth))
-      var height = $('.fc-view-container').height()
+      var height = getViewContainerEl().height()
       expect(Math.round(height)).toEqual(500)
     })
 
     it('fc-content should have width of div', function() {
       initCalendar({}, getCalendarElement(elementWidth))
-      var width = $('.fc-view-container').width()
+      var width = getViewContainerEl().width()
       expect(Math.round(width)).toEqual(elementWidth)
     })
 
@@ -35,14 +36,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should set the height to width sizes very close to ratio of 2', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
-        var height = $('.fc-view-container').height()
+        var width = getViewContainerEl().width()
+        var height = getViewContainerEl().height()
         var ratio = Math.round(width / height * 100)
         expect(Math.round(ratio)).toEqual(200)
       })
@@ -57,14 +58,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should set the height to width sizes very close to ratio of 2', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
-        var height = $('.fc-view-container').height()
+        var width = getViewContainerEl().width()
+        var height = getViewContainerEl().height()
         var ratio = Math.round(width / height * 100)
         expect(Math.round(ratio)).toEqual(100)
       })
@@ -79,14 +80,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
-        var height = $('.fc-view-container').height()
+        var width = getViewContainerEl().width()
+        var height = getViewContainerEl().height()
         var ratio = Math.round(width / height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
@@ -101,14 +102,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
-        var height = $('.fc-view-container').height()
+        var width = getViewContainerEl().width()
+        var height = getViewContainerEl().height()
         var ratio = Math.round(width / height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
@@ -123,14 +124,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
-        var height = $('.fc-view-container').height()
+        var width = getViewContainerEl().width()
+        var height = getViewContainerEl().height()
         var ratio = Math.round(width / height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
@@ -145,15 +146,15 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = $('.fc-view-container').width()
+        var width = getViewContainerEl().width()
         expect(Math.round(width)).toEqual(elementWidth)
       })
 
       it('should cause rows to be natural height', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var actualHeight = $('.fc-view-container').height()
+        var actualHeight = getViewContainerEl().height()
         $('tr.fc-week td:first-child > div').css('min-height', '').css('background', 'red')
-        var naturalHeight = $('.fc-view-container').height()
+        var naturalHeight = getViewContainerEl().height()
         expect(Math.round(actualHeight)).toEqual(Math.round(naturalHeight))
       })
 

+ 143 - 134
tests/automated/legacy/background-events.js

@@ -1,4 +1,21 @@
 import { RED_REGEX } from '../lib/dom-misc'
+import {
+  getBackgroundEventEls,
+  getEventEls,
+  getSingleBackgroundEventEl
+} from '../event-render/EventRenderUtils'
+import {
+  getBackgroundEventElsResizerEls,
+  getDayGridNonBusinessDayEls,
+  getNonBusinessDayEls,
+  getDayGridRowEls
+
+} from '../view-render/DayGridRenderUtils'
+import {
+  getTimeGridNonBusinessDayEls,
+  queryBgEventsInCol,
+  queryNonBusinessSegsInCol
+} from '../lib/time-grid'
 
 describe('background events', function() {
 
@@ -20,11 +37,11 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
-          expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-          expect($('.fc-bgevent')).toBeLeftOf('.fc-day[data-date="2014-11-05"]')
-          expect($('.fc-event').length).toBe(0)
-          expect($('.fc-bgevent .fc-resizer').length).toBe(0) // can't resize
+          expect(getBackgroundEventEls().length).toBe(1)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+          expect(getSingleBackgroundEventEl()).toBeLeftOf('.fc-day[data-date="2014-11-05"]')
+          expect(getEventEls().length).toBe(0)
+          expect(getBackgroundEventElsResizerEls().length).toBe(0) // can't resize
           done()
         }
         initCalendar(options)
@@ -38,12 +55,12 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(2)
-          expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-          expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-          expect($('.fc-bgevent:eq(0)')).toBeRightOf('.fc-day[data-date="2014-11-03"]')
-          expect($('.fc-bgevent:eq(1)')).toBeLeftOf('.fc-day[data-date="2014-11-12"]')
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(2)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+          expect(getBackgroundEventEls().eq(0)).toBeRightOf('.fc-day[data-date="2014-11-03"]')
+          expect(getBackgroundEventEls().eq(1)).toBeLeftOf('.fc-day[data-date="2014-11-12"]')
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -63,11 +80,11 @@ describe('background events', function() {
           }
         ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(2)
-          expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(2)
-          expect($('.fc-bgevent:eq(0)')).toBeRightOf('.fc-day[data-date="2014-11-02"]')
-          expect($('.fc-bgevent:eq(1)')).toBeLeftOf('.fc-day[data-date="2014-11-08"]')
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(2)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(2)
+          expect(getBackgroundEventEls().eq(0)).toBeRightOf('.fc-day[data-date="2014-11-02"]')
+          expect(getBackgroundEventEls().eq(1)).toBeLeftOf('.fc-day[data-date="2014-11-08"]')
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -82,10 +99,10 @@ describe('background events', function() {
             rendering: 'background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-            expect($('.fc-bgevent')).toBeRightOf('.fc-day-grid .fc-row:eq(1) .fc-week-number')
-            expect($('.fc-event').length).toBe(0)
+            expect(getBackgroundEventEls().length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+            expect(getBackgroundEventEls()).toBeRightOf('.fc-day-grid .fc-row:eq(1) .fc-week-number')
+            expect(getEventEls().length).toBe(0)
             done()
           }
           initCalendar(options)
@@ -96,7 +113,7 @@ describe('background events', function() {
         options.businessHours = true
         options.eventAfterAllRender = function() {
           setTimeout(function() { // no trigger when business hours renders. this will have to do.
-            expect($('.fc-nonbusiness').length).toBe(12) // there are 6 weeks. 2 weekend days each
+            expect(getNonBusinessDayEls().length).toBe(12) // there are 6 weeks. 2 weekend days each
             done()
           }, 0)
         }
@@ -115,10 +132,10 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
-          expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-          expect($('.fc-bgevent')).toBeRightOf('.fc-day[data-date="2014-11-06"]')
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(1)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+          expect(getBackgroundEventEls()).toBeRightOf('.fc-day[data-date="2014-11-06"]')
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -132,12 +149,12 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(2)
-          expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-          expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-          expect($('.fc-bgevent:eq(0)')).toBeLeftOf('.fc-day[data-date="2014-11-02"]')
-          expect($('.fc-bgevent:eq(1)')).toBeRightOf('.fc-day[data-date="2014-11-12"]')
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(2)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+          expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+          expect(getBackgroundEventEls().eq(0)).toBeLeftOf('.fc-day[data-date="2014-11-02"]')
+          expect(getBackgroundEventEls().eq(1)).toBeRightOf('.fc-day[data-date="2014-11-12"]')
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -152,10 +169,10 @@ describe('background events', function() {
             rendering: 'background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-            expect($('.fc-bgevent')).toBeLeftOf('.fc-day-grid .fc-row:eq(1) .fc-week-number span')
-            expect($('.fc-event').length).toBe(0)
+            expect(getBackgroundEventEls().length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+            expect(getBackgroundEventEls()).toBeLeftOf('.fc-day-grid .fc-row:eq(1) .fc-week-number span')
+            expect(getEventEls().length).toBe(0)
             done()
           }
           initCalendar(options)
@@ -174,20 +191,20 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(7)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(2)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(1)
-
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(0)'))
+            expect(getBackgroundEventEls().length).toBe(7)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(2)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(1)
+
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).eq(0))
               .toBeLeftOf('.fc-day[data-date="2014-11-05"]')
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(1)'))
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).eq(1))
               .toBeRightOf('.fc-day[data-date="2014-11-03"]')
 
-            expect($('.fc-event').length).toBe(0)
+            expect(getEventEls().length).toBe(0)
             done()
           }
           initCalendar(options)
@@ -201,21 +218,21 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(6)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(1)
-
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(0)'))
+            expect(getBackgroundEventEls().length).toBe(6)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(1)
+
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).eq(0))
               .toBeLeftOf('.fc-day[data-date="2014-11-05"]')
 
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent:eq(0)'))
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).eq(0))
               .toBeRightOf('.fc-day[data-date="2014-11-09"]')
 
-            expect($('.fc-event').length).toBe(0)
+            expect(getEventEls().length).toBe(0)
             done()
           }
           initCalendar(options)
@@ -228,15 +245,15 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(5)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(0)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(1)
-
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent'))
+            expect(getBackgroundEventEls().length).toBe(5)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(0)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(1)
+
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)))
               .toBeRightOf('.fc-day[data-date="2014-11-04"]')
 
             done()
@@ -251,15 +268,15 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(5)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(0)
-
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent'))
+            expect(getBackgroundEventEls().length).toBe(5)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(0)
+
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)))
               .toBeLeftOf('.fc-day[data-date="2014-11-28"]')
 
             done()
@@ -281,13 +298,13 @@ describe('background events', function() {
             }
           ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(8)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(3)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(1)
+            expect(getBackgroundEventEls().length).toBe(8)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(3)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(1)
 
             /* order in DOM is reversed
             expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(0)'))
@@ -313,13 +330,13 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(7)
-            expect($('.fc-day-grid .fc-row:eq(0) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent').length).toBe(2)
-            expect($('.fc-day-grid .fc-row:eq(2) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(3) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(4) .fc-bgevent').length).toBe(1)
-            expect($('.fc-day-grid .fc-row:eq(5) .fc-bgevent').length).toBe(1)
+            expect(getBackgroundEventEls().length).toBe(7)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(0)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(2)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(2)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(3)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(4)).length).toBe(1)
+            expect(getBackgroundEventEls(getDayGridRowEls().eq(5)).length).toBe(1)
 
             /* order in DOM is reversed
             expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(0)'))
@@ -346,8 +363,8 @@ describe('background events', function() {
           } ]
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(1)
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -365,8 +382,8 @@ describe('background events', function() {
           } ]
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
-          expect($('.fc-event').length).toBe(0)
+          expect(getBackgroundEventEls().length).toBe(1)
+          expect(getEventEls().length).toBe(0)
           done()
         }
         initCalendar(options)
@@ -386,12 +403,12 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
+          expect(getBackgroundEventEls().length).toBe(1)
           expect(queryBgEventsInCol(2).length).toBe(1) // column 2
-          expect($('.fc-bgevent')).toBeBelow('.fc-slats tr:eq(0)') // should be 1am (eq(1)) but FF cmplaning
-          expect($('.fc-bgevent')).toBeAbove('.fc-slats tr:eq(10)') // 5am
-          expect($('.fc-event').length).toBe(0)
-          expect($('.fc-bgevent .fc-resizer').length).toBe(0) // can't resize
+          expect(getBackgroundEventEls()).toBeBelow('.fc-slats tr:eq(0)') // should be 1am (eq(1)) but FF cmplaning
+          expect(getBackgroundEventEls()).toBeAbove('.fc-slats tr:eq(10)') // 5am
+          expect(getEventEls().length).toBe(0)
+          expect(getBackgroundEventElsResizerEls().length).toBe(0) // can't resize
           done()
         }
         initCalendar(options)
@@ -404,7 +421,7 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(2)
+          expect(getBackgroundEventEls().length).toBe(2)
           expect(queryBgEventsInCol(2).length).toBe(1)
           expect(queryBgEventsInCol(3).length).toBe(1)
           // TODO: maybe check y coords
@@ -427,7 +444,7 @@ describe('background events', function() {
           }
         ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(4)
+          expect(getBackgroundEventEls().length).toBe(4)
           expect(queryBgEventsInCol(2).length).toBe(2)
           expect(queryBgEventsInCol(3).length).toBe(2)
           // TODO: maybe check y coords
@@ -440,8 +457,8 @@ describe('background events', function() {
           var options = {}
           options.businessHours = true
           initCalendar(options)
-          expect($('.fc-day-grid .fc-nonbusiness').length).toBe(2) // whole days in the day area
-          expect($('.fc-time-grid .fc-nonbusiness').length).toBe(12) // strips of gray on the timed area
+          expect(getDayGridNonBusinessDayEls().length).toBe(2) // whole days in the day area
+          expect(getTimeGridNonBusinessDayEls().length).toBe(12) // strips of gray on the timed area
         })
         it('renders correctly if custom', function() {
           var options = {}
@@ -453,10 +470,10 @@ describe('background events', function() {
           initCalendar(options)
 
           // whole days
-          expect($('.fc-day-grid .fc-nonbusiness').length).toBe(2) // each multi-day stretch is one element
+          expect(getDayGridNonBusinessDayEls().length).toBe(2) // each multi-day stretch is one element
 
           // time area
-          expect($('.fc-time-grid .fc-nonbusiness').length).toBe(11)
+          expect(getTimeGridNonBusinessDayEls().length).toBe(11)
           expect(queryNonBusinessSegsInCol(0).length).toBe(1)
           expect(queryNonBusinessSegsInCol(1).length).toBe(2)
           expect(queryNonBusinessSegsInCol(2).length).toBe(2)
@@ -477,10 +494,10 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(1)
+          expect(getBackgroundEventEls().length).toBe(1)
           expect(queryBgEventsInCol(4).length).toBe(1)
-          expect($('.fc-bgevent')).toBeBelow('.fc-slats tr:eq(0)') // should be 1am (eq(1)) but FF cmplaining
-          expect($('.fc-bgevent')).toBeAbove('.fc-slats tr:eq(10)') // 5am
+          expect(getBackgroundEventEls()).toBeBelow('.fc-slats tr:eq(0)') // should be 1am (eq(1)) but FF cmplaining
+          expect(getBackgroundEventEls()).toBeAbove('.fc-slats tr:eq(10)') // 5am
           done()
         }
         initCalendar(options)
@@ -493,7 +510,7 @@ describe('background events', function() {
           rendering: 'background'
         } ]
         options.eventAfterAllRender = function() {
-          expect($('.fc-bgevent').length).toBe(2)
+          expect(getBackgroundEventEls().length).toBe(2)
           expect(queryBgEventsInCol(3).length).toBe(1)
           expect(queryBgEventsInCol(4).length).toBe(1)
           done()
@@ -511,10 +528,10 @@ describe('background events', function() {
           initCalendar(options)
 
           // whole days
-          expect($('.fc-day-grid .fc-nonbusiness').length).toBe(2) // each stretch of days is one element
+          expect(getDayGridNonBusinessDayEls().length).toBe(2) // each stretch of days is one element
 
           // time area
-          expect($('.fc-time-grid .fc-nonbusiness').length).toBe(11)
+          expect(getTimeGridNonBusinessDayEls().length).toBe(11)
           expect(queryNonBusinessSegsInCol(0).length).toBe(1)
           expect(queryNonBusinessSegsInCol(1).length).toBe(1)
           expect(queryNonBusinessSegsInCol(2).length).toBe(2)
@@ -538,7 +555,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(8)
+            expect(getBackgroundEventEls().length).toBe(8)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
             expect(queryBgEventsInCol(2).length).toBe(2)
@@ -560,7 +577,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(7)
+            expect(getBackgroundEventEls().length).toBe(7)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -582,7 +599,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(5)
+            expect(getBackgroundEventEls().length).toBe(5)
             expect(queryBgEventsInCol(0).length).toBe(0)
             expect(queryBgEventsInCol(1).length).toBe(0)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -604,7 +621,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(3)
+            expect(getBackgroundEventEls().length).toBe(3)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -631,7 +648,7 @@ describe('background events', function() {
             }
           ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(9)
+            expect(getBackgroundEventEls().length).toBe(9)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(2)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -662,7 +679,7 @@ describe('background events', function() {
             }
           ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(8)
+            expect(getBackgroundEventEls().length).toBe(8)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -671,8 +688,8 @@ describe('background events', function() {
             expect(queryBgEventsInCol(5).length).toBe(1)
             expect(queryBgEventsInCol(6).length).toBe(1)
 
-            expect($('.fc-bgevent:eq(3)')).toBeAbove('.fc-slats tr:eq(2)') // first part before 1am
-            expect($('.fc-bgevent:eq(4)')).toBeBelow('.fc-slats tr:eq(9)') // second part after 5am
+            expect(getBackgroundEventEls().eq(3)).toBeAbove('.fc-slats tr:eq(2)') // first part before 1am
+            expect(getBackgroundEventEls().eq(4)).toBeBelow('.fc-slats tr:eq(9)') // second part after 5am
 
             done()
           }
@@ -691,7 +708,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(8)
+            expect(getBackgroundEventEls().length).toBe(8)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
             expect(queryBgEventsInCol(2).length).toBe(1)
@@ -715,7 +732,7 @@ describe('background events', function() {
             rendering: 'inverse-background'
           } ]
           options.eventAfterAllRender = function() {
-            expect($('.fc-bgevent').length).toBe(7)
+            expect(getBackgroundEventEls().length).toBe(7)
             done()
           }
           initCalendar(options)
@@ -731,7 +748,7 @@ describe('background events', function() {
         color: 'red'
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
@@ -745,7 +762,7 @@ describe('background events', function() {
         backgroundColor: 'red'
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
@@ -761,7 +778,7 @@ describe('background events', function() {
         } ]
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
@@ -777,7 +794,7 @@ describe('background events', function() {
         } ]
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
@@ -793,7 +810,7 @@ describe('background events', function() {
         } ]
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
@@ -809,18 +826,10 @@ describe('background events', function() {
         } ]
       } ]
       options.eventAfterAllRender = function() {
-        expect($('.fc-bgevent').css('background-color')).toMatch(RED_REGEX)
+        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
         done()
       }
       initCalendar(options)
     })
   })
-
-  function queryBgEventsInCol(col) {
-    return $('.fc-time-grid .fc-content-skeleton td:not(.fc-axis):eq(' + col + ') .fc-bgevent')
-  }
-
-  function queryNonBusinessSegsInCol(col) {
-    return $('.fc-time-grid .fc-content-skeleton td:not(.fc-axis):eq(' + col + ') .fc-nonbusiness')
-  }
 })

+ 8 - 3
tests/automated/legacy/businessHours.js

@@ -2,8 +2,13 @@
 
 import { getBoundingRect } from '../lib/dom-geom'
 import { doElsMatchSegs } from '../lib/segs'
-import { getTimeGridTop, getTimeGridDayEls } from '../lib/time-grid'
+import {
+  getTimeGridTop,
+  getTimeGridDayEls,
+  getTimeGridNonBusinessDayEls
+} from '../lib/time-grid'
 import { ensureDate } from '../datelib/utils'
+import { getDayGridNonBusinessDayEls } from '../view-render/DayGridRenderUtils'
 
 
 describe('businessHours', function() {
@@ -21,7 +26,7 @@ describe('businessHours', function() {
     currentCalendar.next() // ... out. should render correctly.
 
     // whole days
-    expect($('.fc-day-grid .fc-nonbusiness').length).toBe(2) // each multi-day stretch is one element
+    expect(getDayGridNonBusinessDayEls().length).toBe(2) // each multi-day stretch is one element
 
     // timed area
     expect(isTimeGridNonBusinessSegsRendered([
@@ -183,7 +188,7 @@ describe('businessHours', function() {
   ------------------------------------------------------------------------------------------------------------------ */
 
   function isTimeGridNonBusinessSegsRendered(segs) {
-    return doElsMatchSegs($('.fc-time-grid .fc-nonbusiness'), segs, getTimeGridRect)
+    return doElsMatchSegs(getTimeGridNonBusinessDayEls(), segs, getTimeGridRect)
   }
 
   function getTimeGridRect(start, end) {

+ 9 - 14
tests/automated/legacy/dayNames.js

@@ -1,18 +1,13 @@
+import { getHeaderEl } from './../view-render/DayGridRenderUtils'
+import { DAY_CLASSES } from './../lib/constants'
+
 describe('day names', function() {
   var testableClasses = [
     'basicDay',
     'agendaDay'
   ]
-  var dayClasses = [
-    '.fc-sun',
-    '.fc-mon',
-    '.fc-tue',
-    '.fc-wed',
-    '.fc-thu',
-    '.fc-fri',
-    '.fc-sat'
-  ]
-  var sundayDate = new Date('2014-05-25T06:00:00Z')
+
+  var sundayDate = new Date('2014-05-25T06:00:00')
   var locales = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]
 
   pushOptions({
@@ -28,7 +23,7 @@ describe('day names', function() {
         pushOptions({
           locale: 'en'
         })
-        dayClasses.forEach(function(cls, index, classes) {
+        DAY_CLASSES.forEach(function(cls, index, classes) {
           var dayDate = FullCalendar.addDays(sundayDate, index)
           var dayText = dayDate.toLocaleString('en', { weekday: 'long' })
 
@@ -36,14 +31,14 @@ describe('day names', function() {
             initCalendar({
               now: dayDate
             })
-            expect($('.fc-view thead ' + dayClasses[index])).toHaveText(dayText)
+            expect(getHeaderEl().find(`.${cls}`)).toHaveText(dayText)
           })
         })
       })
 
       $.each(locales, function(index, locale) {
         describe('when locale is ' + locale, function() {
-          dayClasses.forEach(function(cls, index, classes) {
+          DAY_CLASSES.forEach(function(cls, index, classes) {
             var dayDate = FullCalendar.addDays(sundayDate, index)
             var dayText = dayDate.toLocaleString(locale, { weekday: 'long' })
 
@@ -54,7 +49,7 @@ describe('day names', function() {
                 now: dayDate
               })
 
-              expect($('.fc-view thead ' + dayClasses[index])).toHaveText(dayText)
+              expect(getHeaderEl().find(`.${cls}`)).toHaveText(dayText)
             })
           })
         })

+ 8 - 6
tests/automated/legacy/dayPopoverFormat.js

@@ -1,3 +1,5 @@
+import { getMoreEl, getMorePopoverTitle } from '../view-render/DayGridRenderUtils'
+
 describe('dayPopoverFormat', function() {
 
   pushOptions({
@@ -15,16 +17,16 @@ describe('dayPopoverFormat', function() {
     initCalendar({
       dayPopoverFormat: { month: 'long', day: 'numeric' }
     })
-    $('.fc-more').simulate('click')
-    expect($('.fc-more-popover > .fc-header .fc-title')).toHaveText('July 29')
+    getMoreEl().simulate('click')
+    expect(getMorePopoverTitle()).toBe('July 29')
   })
 
   it('is affected by the current locale when the value is default', function() {
     initCalendar({
       locale: 'fr'
     })
-    $('.fc-more').simulate('click')
-    expect($('.fc-more-popover > .fc-header .fc-title')).toHaveText('29 juillet 2014')
+    getMoreEl().simulate('click')
+    expect(getMorePopoverTitle()).toBe('29 juillet 2014')
   })
 
   it('still maintains the same format when explicitly set, and there is a locale', function() {
@@ -32,8 +34,8 @@ describe('dayPopoverFormat', function() {
       locale: 'fr',
       dayPopoverFormat: { year: 'numeric' }
     })
-    $('.fc-more').simulate('click')
-    expect($('.fc-more-popover > .fc-header .fc-title')).toHaveText('2014')
+    getMoreEl().simulate('click')
+    expect(getMorePopoverTitle()).toBe('2014')
   })
 
 })

+ 3 - 1
tests/automated/legacy/defaultAllDayEventDuration.js

@@ -1,3 +1,5 @@
+import { getEventEls } from '../event-render/EventRenderUtils'
+
 describe('defaultAllDayEventDuration', function() {
 
   pushOptions({
@@ -74,7 +76,7 @@ describe('defaultAllDayEventDuration', function() {
             }
           ],
           eventAfterAllRender: function() {
-            var eventElms = $('.fc-event', currentCalendar.el)
+            var eventElms = getEventEls()
             var width0 = eventElms.eq(0).outerWidth()
             var width1 = eventElms.eq(1).outerWidth()
             expect(width0).toBeGreaterThan(0)

+ 4 - 2
tests/automated/legacy/defaultTimedEventDuration.js

@@ -1,3 +1,5 @@
+import { getEventEls } from '../event-render/EventRenderUtils'
+
 describe('defaultTimedEventDuration', function() {
 
   pushOptions({
@@ -72,7 +74,7 @@ describe('defaultTimedEventDuration', function() {
             }
           ],
           eventAfterAllRender: function() {
-            var eventElms = $('.fc-event', currentCalendar.el)
+            var eventElms = getEventEls()
             var height0 = eventElms.eq(0).outerHeight()
             var height1 = eventElms.eq(1).outerHeight()
             expect(height0).toBeGreaterThan(0)
@@ -109,7 +111,7 @@ describe('defaultTimedEventDuration', function() {
             }
           ],
           eventAfterAllRender: function() {
-            var eventElms = $('.fc-event', currentCalendar.el)
+            var eventElms = getEventEls()
             var width0 = eventElms.eq(0).outerWidth()
             var width1 = eventElms.eq(1).outerWidth()
             expect(width0).toBeGreaterThan(0)

+ 9 - 7
tests/automated/legacy/displayEventEnd.js

@@ -1,3 +1,5 @@
+import { getSingleEl, getEventElTimeEl } from '../event-render/EventRenderUtils'
+
 describe('displayEventEnd', function() {
 
   pushOptions({
@@ -27,7 +29,7 @@ describe('displayEventEnd', function() {
               allDay: true
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time').length).toBe(0)
+              expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
               done()
             }
           })
@@ -43,7 +45,7 @@ describe('displayEventEnd', function() {
               allDay: false
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time')).toHaveText('1:00 AM')
+              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
               done()
             }
           })
@@ -60,7 +62,7 @@ describe('displayEventEnd', function() {
               allDay: false
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time')).toHaveText('1:00 AM')
+              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
               done()
             }
           })
@@ -84,7 +86,7 @@ describe('displayEventEnd', function() {
               allDay: true
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time').length).toBe(0)
+              expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
               done()
             }
           })
@@ -100,7 +102,7 @@ describe('displayEventEnd', function() {
               allDay: false
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time')).toHaveText('1:00 AM')
+              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
               done()
             }
           })
@@ -117,7 +119,7 @@ describe('displayEventEnd', function() {
               allDay: false
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time')).toHaveText('1:00 AM')
+              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
               done()
             }
           })
@@ -134,7 +136,7 @@ describe('displayEventEnd', function() {
               allDay: false
             } ],
             eventAfterAllRender: function() {
-              expect($('.fc-event .fc-time')).toHaveText('1:00 AM - 2:00 AM')
+              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM - 2:00 AM')
               done()
             }
           })

+ 1 - 1
tests/automated/legacy/event-obj.js

@@ -35,7 +35,7 @@ describe('event object creation', function() {
 
   it('doesn\'t produce an event when an invalid start string', function() {
     var event = init({
-      start: 'asdfasdfasdf',
+      start: 'asdfasdfasdf'
     })
     expect(event).toBeUndefined()
   })

+ 2 - 2
tests/automated/legacy/event-resize.js

@@ -176,8 +176,8 @@ describe('eventResize', function() {
             expect(arg.event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(arg.event.end).toEqualDate('2014-06-11T09:30:00Z')
 
-            arg.revert()
-            event = currentCalendar.getEvents()[0]
+            arg.revertFunc()
+            var event = currentCalendar.clientEvents()[0]
 
             expect(event.start).toEqualDate('2014-06-11T05:00:00Z')
             expect(event.end).toEqualDate('2014-06-11T07:00:00Z')

+ 1 - 1
tests/automated/legacy/events-gcal.js

@@ -8,7 +8,7 @@ if (SKIP_GCAL) {
 
 // eslint-disable-next-line
 SKIP_GCAL ||
-describe('Google Calendar plugin', function() {
+xdescribe('Google Calendar plugin', function() {
 
   var API_KEY = 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE'
   var HOLIDAY_CALENDAR_ID = 'en.usa#[email protected]'

+ 1 - 1
tests/automated/legacy/titleFormat.js

@@ -36,7 +36,7 @@ describe('titleFormat', function() {
       { view: 'month', expected: 'June 2014' },
       { view: 'basicWeek', expected: 'Jun 8 - 14, 2014' },
       { view: 'agendaWeek', expected: 'June 8 - 14, 2014' },
-      { view: 'basicDay', expected: 'Thursday, June 12, 2014' },
+      { view: 'basicDay', expected: 'Thursday, June 12, 2014' }
     ]
 
     beforeEach(function() {

+ 9 - 0
tests/automated/lib/AgendaViewUtils.js

@@ -0,0 +1,9 @@
+const DAY_GRID_CLASS = 'fc-day-grid'
+
+export function getDayGridSlotEls() {
+  return $(`.${DAY_GRID_CLASS}`)
+}
+
+export function getDayGridSlotElsCount() {
+  return getDayGridSlotEls().length
+}

+ 60 - 0
tests/automated/lib/ListViewUtils.js

@@ -0,0 +1,60 @@
+const LIST_ITEM_CLASS = 'fc-list-item'
+const LIST_ITEM_TITLE_CLASS = 'fc-list-item-title'
+const LIST_ITEM_TIME_CLASS = 'fc-list-item-time'
+const LIST_HEADING_CLASS = 'fc-list-heading'
+const LIST_HEADING_MAIN_CLASS = 'fc-list-heading-main'
+const LIST_HEADING_ALT_CLASS = 'fc-list-heading-alt'
+const EMPTY_MESSAGE_CLASS = 'fc-list-empty'
+
+
+export function getListEventEls() {
+  return $(`.${LIST_ITEM_CLASS}`)
+}
+
+export function getListEventElsCount() {
+  return getListEventEls().length
+}
+
+export function getListEventElTitleEl(el) {
+  return el.find(`.${LIST_ITEM_TITLE_CLASS}`)
+}
+
+export function getListEventElTimeEl(el) {
+  return el.find(`.${LIST_ITEM_TIME_CLASS}`)
+}
+
+export function getListEventElTitle(el) {
+  return getListEventElTitleEl(el).text()
+}
+
+export function getListEventElTimeText(el) {
+  return getListEventElTimeEl(el).text()
+}
+
+export function getListHeadingEls() {
+  return $(`.${LIST_HEADING_CLASS}`)
+}
+
+export function getListHeadingElMainEl(el) {
+  return el.find(`.${LIST_HEADING_MAIN_CLASS}`)
+}
+
+export function getListHeadingElAltEl(el) {
+  return el.find(`.${LIST_HEADING_ALT_CLASS}`)
+}
+
+export function getListHeadingElMainElText(el) {
+  return getListHeadingElMainEl(el).text()
+}
+
+export function getListHeadingElAltElText(el) {
+  return getListHeadingElAltEl(el).text()
+}
+
+export function getEmptyMessageEls() {
+  return $(`.${EMPTY_MESSAGE_CLASS}`)
+}
+
+export function getEmptyMessageElsCount() {
+  return getEmptyMessageEls().length
+}

+ 6 - 0
tests/automated/lib/MonthViewUtils.js

@@ -0,0 +1,6 @@
+const SCROLLER_CLASS = 'fc-scroller'
+
+export function getScrollerEl() {
+  return $(currentCalendar.el).find(`.${SCROLLER_CLASS}`)
+}
+

+ 6 - 0
tests/automated/lib/ViewUtils.js

@@ -0,0 +1,6 @@
+const VIEW_CONTAINER_CLASS = 'fc-view-container'
+
+
+export function getViewContainerEl() {
+  return $(`.${VIEW_CONTAINER_CLASS}`)
+}

+ 17 - 0
tests/automated/lib/constants.js

@@ -0,0 +1,17 @@
+const SUNDAY_CLASS = 'fc-sun'
+const MONDAY_CLASS = 'fc-mon'
+const TUESDAY_CLASS = 'fc-tue'
+const WEDNESDAY_CLASS = 'fc-wed'
+const THURSDAY_CLASS = 'fc-thu'
+const FRIDAY_CLASS = 'fc-fri'
+const SATURDY_CLASS = 'fc-sat'
+
+export const DAY_CLASSES = [
+  SUNDAY_CLASS,
+  MONDAY_CLASS,
+  TUESDAY_CLASS,
+  WEDNESDAY_CLASS,
+  THURSDAY_CLASS,
+  FRIDAY_CLASS,
+  SATURDY_CLASS
+]

+ 1 - 1
tests/automated/lib/date-matchers.js

@@ -5,7 +5,7 @@ beforeEach(function() {
     toEqualDate() {
       return {
         compare: function(actual, expected) {
-          var result;
+          var result
 
           if (typeof expected === 'string') {
             expected = new Date(expected)

+ 3 - 0
tests/automated/lib/day-grid.js

@@ -8,6 +8,9 @@ export function getDayGridDayEls(date) {
   return $('.fc-day-grid .fc-day[data-date="' + formatIsoDay(date) + '"]')
 }
 
+export function getDayGridAxis() {
+  return $('.fc-day-grid .fc-axis')
+}
 
 // TODO: discourage use
 export function getDayGridDowEls(dayAbbrev) {

+ 27 - 19
tests/automated/lib/dnd-resize-utils.js

@@ -1,7 +1,15 @@
-import { formatIsoDay } from '../datelib/utils'
+import { formatIsoDay, addDays } from '../datelib/utils'
+import { getTimeGridDayEls, getSlotElByIndex } from './time-grid'
+import { getDayEl } from '../view-render/DayGridRenderUtils'
+import {
+  getEventElResizerEl,
+  getEventElTitleEl,
+  getEventElTimeEl,
+  getFirstEventEl,
+  getLastEventEl
+} from '../event-render/EventRenderUtils'
 
 
-// this function has been mangled to work with external jqui draggables as well
 export function testEventDrag(options, dropDate, expectSuccess, callback, eventClassName) {
   var eventsRendered = false
 
@@ -30,19 +38,19 @@ export function testEventDrag(options, dropDate, expectSuccess, callback, eventC
       dropDateHasTime = true
     }
 
-    eventEl = $('.' + (eventClassName || 'fc-event') + ':first')
+    eventEl = eventClassName ? $(`.${eventClassName}:first`) : getFirstEventEl()
     expect(eventEl.length).toBe(1)
 
     if (dropDateHasTime) {
-      dragEl = eventEl.find('.fc-time')
-      dayEl = $('.fc-time-grid .fc-day[data-date="' + formatIsoDay(dropDate) + '"]')
+      dragEl = getEventElTimeEl(eventEl)
+      dayEl = getTimeGridDayEls(dropDate)
       slatIndex = dropDate.getUTCHours() * 2 + (dropDate.getUTCMinutes() / 30) // assumes slotDuration:'30:00'
-      slatEl = $('.fc-slats tr:eq(' + slatIndex + ')')
+      slatEl = getSlotElByIndex(slatIndex)
       expect(slatEl.length).toBe(1)
       dy = slatEl.offset().top - eventEl.offset().top
     } else {
-      dragEl = eventEl.find('.fc-title')
-      dayEl = $('.fc-day-grid .fc-day[data-date="' + formatIsoDay(dropDate) + '"]')
+      dragEl = getEventElTitleEl(eventEl)
+      dayEl = getDayEl(dropDate)
       dy = dayEl.offset().top - eventEl.offset().top
     }
 
@@ -122,17 +130,17 @@ export function testEventResize(options, resizeDate, expectSuccess, callback, ev
       resizeDateHasTime = true
     }
 
-    eventEl = $('.' + (eventClassName || 'fc-event') + ':last')
-    dragEl = eventEl.find('.fc-resizer')
+    eventEl = eventClassName ? $(`.${eventClassName}:first`) : getLastEventEl(eventClassName)
+    dragEl = getEventElResizerEl(eventEl)
 
     if (resizeDateHasTime) {
-      lastDayEl = $('.fc-time-grid .fc-day[data-date="' + formatIsoDay(resizeDate) + '"]')
+      lastDayEl = getTimeGridDayEls(resizeDate)
       lastSlatIndex = resizeDate.getUTCHours() * 2 + (resizeDate.getUTCMinutes() / 30) // assumes slotDuration:'30:00'
-      lastSlatEl = $('.fc-slats tr:eq(' + (lastSlatIndex - 1) + ')')
+      lastSlatEl = getSlotElByIndex(lastSlatIndex - 1)
       expect(lastSlatEl.length).toBe(1)
       dy = lastSlatEl.offset().top + lastSlatEl.outerHeight() - (eventEl.offset().top + eventEl.outerHeight())
     } else {
-      lastDayEl = $('.fc-day-grid .fc-day[data-date="' + formatIsoDay(FullCalendar.addDays(resizeDate, -1)) + '"]')
+      lastDayEl = getDayEl(addDays(resizeDate, -1))
       dy = lastDayEl.offset().top - eventEl.offset().top
     }
 
@@ -206,19 +214,19 @@ export function testSelection(options, start, end, expectSuccess, callback) {
   initCalendar(options)
 
   if (!isAllDay) {
-    firstDayEl = $('.fc-time-grid .fc-day[data-date="' + formatIsoDay(start) + '"]')
-    lastDayEl = $('.fc-time-grid .fc-day[data-date="' + formatIsoDay(end) + '"]')
+    firstDayEl = getTimeGridDayEls(start)
+    lastDayEl = getTimeGridDayEls(end)
     firstSlatIndex = start.getUTCHours() * 2 + (start.getUTCMinutes() / 30) // assumes slotDuration:'30:00'
     lastSlatIndex = end.getUTCHours() * 2 + (end.getUTCMinutes() / 30) - 1 // assumes slotDuration:'30:00'
-    firstSlatEl = $('.fc-slats tr:eq(' + firstSlatIndex + ')')
-    lastSlatEl = $('.fc-slats tr:eq(' + lastSlatIndex + ')')
+    firstSlatEl = getSlotElByIndex(firstSlatIndex)
+    lastSlatEl = getSlotElByIndex(lastSlatIndex)
     expect(firstSlatEl.length).toBe(1)
     expect(lastSlatEl.length).toBe(1)
     dy = lastSlatEl.offset().top - firstSlatEl.offset().top
     dragEl = firstSlatEl
   } else {
-    firstDayEl = $('.fc-day-grid .fc-day[data-date="' + formatIsoDay(start) + '"]')
-    lastDayEl = $('.fc-day-grid .fc-day[data-date="' + formatIsoDay(new Date(end.valueOf() - 1)) + '"]') // inclusive
+    firstDayEl = getDayEl(start)
+    lastDayEl = getDayEl(new Date(end.valueOf() - 1)) // inclusive
     dy = lastDayEl.offset().top - firstDayEl.offset().top
     dragEl = firstDayEl
   }

+ 27 - 3
tests/automated/lib/time-grid.js

@@ -1,6 +1,11 @@
 import { getBoundingRect } from '../lib/dom-geom'
 import { formatIsoDay, formatIsoTime, ensureDate } from '../datelib/utils'
 
+const TIME_GRID_CLASS = 'fc-time-grid'
+const NON_BUSINESS_CLASS = 'fc-nonbusiness'
+const CONTENT_SKELETON_CLASS = 'fc-content-skeleton'
+const AXIS_CLASS = 'fc-axis'
+const BACKGROUND_EVENT_CLASS = 'fc-bgevent'
 
 export function dragTimeGridEvent(eventEl, dropDate) {
   return new Promise(function(resolve) {
@@ -86,7 +91,7 @@ export function getTimeGridLine(date) { // not in Scheduler
 
 export function getTimeGridTop(targetTimeMs) {
   const topBorderWidth = 1 // TODO: kill
-  let slotEls = getTimeGridSlotEls(targetTimeMs)
+  let slotEls = getSlotElByTime(targetTimeMs)
   let slotEl
 
   // exact slot match
@@ -94,7 +99,7 @@ export function getTimeGridTop(targetTimeMs) {
     return slotEls.eq(0).offset().top + topBorderWidth
   }
 
-  slotEls = $('.fc-time-grid .fc-slats tr[data-time]') // all slots
+  slotEls = getSlotEls() // all slots
   let slotTimeMs = null
   let prevSlotTimeMs = null
 
@@ -138,8 +143,16 @@ export function getTimeGridDayEls(date) {
   return $('.fc-time-grid .fc-day[data-date="' + formatIsoDay(date) + '"]')
 }
 
+export function getSlotEls() {
+  return $('.fc-time-grid .fc-slats tr[data-time]')
+}
+
 
-export function getTimeGridSlotEls(timeMs) {
+export function getSlotElByIndex(index) {
+  return $(`.fc-slats tr:eq(${index})`)
+}
+
+export function getSlotElByTime(timeMs) {
   const date = new Date('2016-01-01')
   date = new Date(date.valueOf() + timeMs)
 
@@ -150,6 +163,17 @@ export function getTimeGridSlotEls(timeMs) {
   }
 }
 
+export function getTimeGridNonBusinessDayEls() {
+  return $(`.${TIME_GRID_CLASS} .${NON_BUSINESS_CLASS}`)
+}
+
+export function queryBgEventsInCol(col) {
+  return $(`.${TIME_GRID_CLASS} .${CONTENT_SKELETON_CLASS} td:not(.${AXIS_CLASS}):eq(${col}) .${BACKGROUND_EVENT_CLASS}`)
+}
+
+export function queryNonBusinessSegsInCol(col) {
+  return $(`.${TIME_GRID_CLASS} .${CONTENT_SKELETON_CLASS} td:not(.${AXIS_CLASS}):eq(${col}) .${NON_BUSINESS_CLASS}`)
+}
 
 // TODO: discourage use
 export function getTimeGridDowEls(dayAbbrev) {

+ 126 - 6
tests/automated/view-render/DayGridRenderUtils.js

@@ -1,18 +1,138 @@
 import { formatIsoDay } from '../datelib/utils'
+import { getBackgroundEventEls } from '../event-render/EventRenderUtils'
 
+const DAY_GRID_CLASS = 'fc-day-grid'
+const ROW_CLASS = 'fc-row'
+const BG_CLASS = 'fc-bg'
+const HEAD_CLASS = 'fc-head'
+const VIEW_CLASS = 'fc-view'
+const DAY_HEADER_CLASS = 'fc-day-header'
+const DAY_TOP_CLASS = 'fc-day-top'
+const DAY_DISABLED_CLASS = 'fc-disabled-day'
+const AXIS_CLASS = 'fc-axis'
+const DAY_CLASS = 'fc-day'
+const MORE_CLASS = 'fc-more'
+const HEADER_CLASS = 'fc-header'
+const TITLE_CLASS = 'fc-title'
+const MORE_POPOVER_CLASS = 'fc-more-popover'
+const WIDGET_HEADER_CLASS = 'fc-widget-header'
+const HEAD_CONTAINER_CLASS = 'fc-head-container'
+const DIVIDER_CLASS = 'fc-divider'
+const RESIZER_CLASS = 'fc-resizer'
+const NON_BUSINESS_CLASS = 'fc-nonbusiness'
 
-export function getSingleDayEl(date) {
+export function getDayEl(date) {
   if (typeof date === 'string') {
     date = new Date(date)
   }
-  var els = $('.fc-day-grid .fc-bg .fc-day[data-date="' + formatIsoDay(date) + '"]')
-  expect(els).toHaveLength(1)
-  return els
+  return $(`.${DAY_GRID_CLASS} .${BG_CLASS} .${DAY_CLASS}[data-date="${formatIsoDay(date)}"]`)
 }
 
+export function getDisabledDayEls() {
+  return $(`.${DAY_GRID_CLASS} .${BG_CLASS} .${DAY_DISABLED_CLASS}`)
+}
 
-export function getDisabledEl(i) {
-  var el = $('.fc-day-grid .fc-bg .fc-disabled-day:eq(' + i + ')')
+export function getDisabledDayElAtIndex(i) {
+  var el = getDisabledDayEls().eq(i)
   expect(el).toHaveLength(1)
   return el
 }
+
+export function getDayOfWeekHeaderEls() {
+  return $(`.${DAY_HEADER_CLASS}`)
+}
+
+export function getDayOfWeekHeaderElTopElText(date) {
+  return $(`td.${DAY_TOP_CLASS}[data-date="${date}"]`).text()
+}
+
+export function getHeaderEl() {
+  return $(`.${VIEW_CLASS} > table > .${HEAD_CLASS}`)
+}
+
+export function hasHeaderEl() {
+  return getHeaderEl().length === 1
+}
+
+export function getFirstDayEl() {
+  return getDayOfWeekHeaderEls().first()
+}
+
+export function getLastDayEl() {
+  return getDayOfWeekHeaderEls().last()
+}
+
+export function getAllDayAxisEl() {
+  return $(`.${DAY_GRID_CLASS} > .${ROW_CLASS} > .${BG_CLASS} .${AXIS_CLASS}`)
+}
+
+export function getAllDayAxisElText() {
+  return getAllDayAxisEl().text()
+}
+
+export function getTimeGridHeaderAxisEl() {
+  return getHeaderEl().find(`.${AXIS_CLASS}`)
+}
+
+export function getSlatElAxisEl(slatEl) {
+  return slatEl.find(`.${AXIS_CLASS}`)
+}
+
+export function getSlatElGridEls(slatEl) {
+  return slatEl.find(`td:not(.${AXIS_CLASS})`)
+}
+
+export function getDayGridAxisEl() {
+  return $(`.${DAY_GRID_CLASS} .${AXIS_CLASS}`)
+}
+
+export function getDayGridDayEl() {
+  return $(`.${DAY_GRID_CLASS} .${DAY_CLASS}`)
+}
+
+export function getFirstDayGridDayEl() {
+  return getDayGridDayEl().first()
+}
+
+export function getMoreEl() {
+  return $(`.${MORE_CLASS}`)
+}
+
+export function getMorePopoverEl() {
+  return $(`.${MORE_POPOVER_CLASS}`)
+}
+
+export function getMorePopoverTitle() {
+  return getMorePopoverEl().find(`.${HEADER_CLASS} .${TITLE_CLASS}`).text()
+}
+
+export function getDayGridRowEls() {
+  return $(`.${DAY_GRID_CLASS} .${ROW_CLASS}`)
+}
+
+export function getDayGridRowElAtIndex(index) {
+  return getDayGridRowEls().eq(index)
+}
+
+export function getDayGridRowDayElAtIndex(index) {
+  return getDayGridRowElAtIndex(index).find(`.${DAY_CLASS}`)
+}
+
+export function getHeaderTopEls() {
+  return $(`.${WIDGET_HEADER_CLASS}`)
+    .not(`.${ROW_CLASS}`)
+    .not(`.${HEAD_CONTAINER_CLASS}`)
+    .not(`.${DIVIDER_CLASS}`)
+}
+
+export function getBackgroundEventElsResizerEls() {
+  return getBackgroundEventEls().find(`.${RESIZER_CLASS}`)
+}
+
+export function getNonBusinessDayEls() {
+  return $(`.${NON_BUSINESS_CLASS}`)
+}
+
+export function getDayGridNonBusinessDayEls() {
+  return $(`.${DAY_GRID_CLASS} .${NON_BUSINESS_CLASS}`)
+}

+ 3 - 7
tests/automated/view-render/columnHeader.js

@@ -1,3 +1,4 @@
+import { hasHeaderEl } from './DayGridRenderUtils'
 
 describe('columnHeader', function() {
   pushOptions({
@@ -17,7 +18,7 @@ describe('columnHeader', function() {
 
       it('should show header', function() {
         initCalendar()
-        expect(hasHeader()).toBe(true)
+        expect(hasHeaderEl()).toBe(true)
       })
     })
 
@@ -28,13 +29,8 @@ describe('columnHeader', function() {
 
       it('should not show header', function() {
         initCalendar()
-        expect(hasHeader()).toBe(false)
+        expect(hasHeaderEl()).toBe(false)
       })
     })
   })
-
-  function hasHeader() {
-    return $('.fc-view > table > .fc-head').length === 1
-  }
-
 })

+ 2 - 1
tests/automated/view-render/columnHeaderHtml.js

@@ -1,3 +1,4 @@
+import { getFirstDayEl } from './DayGridRenderUtils'
 
 describe('columnHeaderHtml', function() {
   pushOptions({
@@ -20,7 +21,7 @@ describe('columnHeaderHtml', function() {
   })
 
   function hasCustomHtml() {
-    var firstHeader = $('.fc-day-header:first')
+    var firstHeader = getFirstDayEl()
 
     return firstHeader.find('.test').length === 1 && firstHeader.text() === 'Sunday'
   }

+ 2 - 1
tests/automated/view-render/columnHeaderText.js

@@ -1,3 +1,4 @@
+import { getFirstDayEl } from './DayGridRenderUtils'
 
 describe('columnHeaderText', function() {
   pushOptions({
@@ -20,7 +21,7 @@ describe('columnHeaderText', function() {
   })
 
   function hasCustomText() {
-    var firstHeader = $('.fc-day-header:first')
+    var firstHeader = getFirstDayEl()
 
     return firstHeader.text() === '<div>Custom Sunday</div>'
   }