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

kill lots of _eventsPositioned uses

Adam Shaw 6 лет назад
Родитель
Сommit
5deaffe4d9

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit e9e425dc2e54fb5a11c3530619da00c76eb5a178
+Subproject commit 270b99e14324fe78f0ddd45499c379cff360612d

+ 6 - 14
packages/__tests__/src/event-source/remove.js

@@ -3,9 +3,7 @@ describe('event source remove', function() {
     defaultDate: '2014-08-01'
   })
 
-  it('correctly removes events provided via `eventSources` at initialization', function(done) {
-    var callCnt = 0
-
+  it('correctly removes events provided via `eventSources` at initialization', function() {
     initCalendar({
       eventSources: [ {
         id: '5',
@@ -13,18 +11,12 @@ describe('event source remove', function() {
           { title: 'event1', start: '2014-08-01' },
           { title: 'event2', start: '2014-08-02' }
         ]
-      } ],
-      _eventsPositioned() {
-        callCnt++
-        if (callCnt === 1) {
-          expectEventCnt(2)
-          currentCalendar.getEventSourceById('5').remove()
-        } else if (callCnt === 2) {
-          expectEventCnt(0)
-          done()
-        }
-      }
+      } ]
     })
+
+    expectEventCnt(2)
+    currentCalendar.getEventSourceById('5').remove()
+    expectEventCnt(0)
   })
 
   it('won\'t render removed events when subsequent addEventSource', function(done) {

+ 568 - 661
packages/__tests__/src/legacy/background-events.js

@@ -29,366 +29,316 @@ describe('background events', function() {
     pushOptions({ defaultView: 'dayGridMonth' })
 
     describe('when LTR', function() {
-      it('render correctly on a single day', function(done) {
-        var options = {}
-        options.events = [ {
-          title: 'hi',
-          start: '2014-11-04',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          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)
-      })
-      it('render correctly spanning multiple weeks', function(done) {
-        var options = {}
-        options.events = [ {
-          title: 'hi',
-          start: '2014-11-04',
-          end: '2014-11-11',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          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)
-      })
-      it('render correctly when two span on top of each other', function(done) {
-        var options = {}
-        options.events = [
-          {
+
+      it('render correctly on a single day', function() {
+        initCalendar({
+          events: [ {
+            title: 'hi',
             start: '2014-11-04',
-            end: '2014-11-07',
             rendering: 'background'
-          },
-          {
-            start: '2014-11-05',
-            end: '2014-11-08',
-            rendering: 'background'
-          }
-        ]
-        options._eventsPositioned = function() {
-          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)
+          } ]
+        })
+        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
       })
-      describe('when weekNumbers', function() {
-        it('renders to right of week numbers', function(done) {
-          var options = {}
-          options.weekNumbers = true
-          options.events = [ {
-            start: '2014-11-02',
-            end: '2014-11-09',
+
+      it('render correctly spanning multiple weeks', function() {
+        initCalendar({
+          events: [ {
+            title: 'hi',
+            start: '2014-11-04',
+            end: '2014-11-11',
             rendering: 'background'
           } ]
-          options._eventsPositioned = function() {
-            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)
         })
+        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)
       })
-      it('renders "business hours" on whole days', function(done) {
-        var options = {}
-        options.businessHours = true
-        options._eventsPositioned = function() {
-          setTimeout(function() { // no trigger when business hours renders. this will have to do.
-            expect(getNonBusinessDayEls().length).toBe(12) // there are 6 weeks. 2 weekend days each
-            done()
-          }, 0)
-        }
-        initCalendar(options)
+
+      it('render correctly when two span on top of each other', function() {
+        initCalendar({
+          events: [
+            {
+              start: '2014-11-04',
+              end: '2014-11-07',
+              rendering: 'background'
+            },
+            {
+              start: '2014-11-05',
+              end: '2014-11-08',
+              rendering: 'background'
+            }
+          ]
+        })
+        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)
       })
-    })
 
-    describe('when RTL', function() {
-      pushOptions({dir: 'rtl'})
+      describe('when weekNumbers', function() {
 
-      it('render correctly on a single day', function(done) {
-        var options = {}
-        options.events = [ {
-          title: 'hi',
-          start: '2014-11-04',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
+        it('renders to right of week numbers', function() {
+          initCalendar({
+            weekNumbers: true,
+            events: [ {
+              start: '2014-11-02',
+              end: '2014-11-09',
+              rendering: 'background'
+            } ]
+          })
           expect(getBackgroundEventEls().length).toBe(1)
           expect(getBackgroundEventEls(getDayGridRowEls().eq(1)).length).toBe(1)
-          expect(getBackgroundEventEls()).toBeRightOf('.fc-day[data-date="2014-11-06"]')
+          expect(getBackgroundEventEls()).toBeRightOf('.fc-day-grid .fc-row:eq(1) .fc-week-number')
           expect(getEventEls().length).toBe(0)
-          done()
-        }
-        initCalendar(options)
-      })
-      it('render correctly spanning multiple weeks', function(done) {
-        var options = {}
-        options.events = [ {
-          title: 'hi',
-          start: '2014-11-04',
-          end: '2014-11-11',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          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)
+        })
       })
-      describe('when weekNumbers', function() {
-        it('renders to left of week numbers', function(done) {
-          var options = {}
-          options.weekNumbers = true
-          options.events = [ {
-            start: '2014-11-02',
-            end: '2014-11-09',
-            rendering: 'background'
-          } ]
-          options._eventsPositioned = function() {
-            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)
+
+      it('renders "business hours" on whole days', function() {
+        initCalendar({
+          businessHours: true
         })
+        expect(getNonBusinessDayEls().length).toBe(12) // there are 6 weeks. 2 weekend days each
       })
     })
 
-    describe('when inverse', function() {
+    describe('when RTL', function() {
+      pushOptions({dir: 'rtl'})
 
-      describe('when LTR', function() {
-        it('render correctly on a single day', function(done) {
-          var options = {}
-          options.events = [ {
+      it('render correctly on a single day', function() {
+        initCalendar({
+          events: [ {
             title: 'hi',
             start: '2014-11-04',
-            rendering: 'inverse-background'
+            rendering: 'background'
           } ]
-          options._eventsPositioned = function() {
-            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(getBackgroundEventEls(getDayGridRowEls().eq(1)).eq(1))
-              .toBeRightOf('.fc-day[data-date="2014-11-03"]')
-
-            expect(getEventEls().length).toBe(0)
-            done()
-          }
-          initCalendar(options)
-        })
-        it('render correctly spanning multiple weeks', function(done) {
-          var options = {}
-          options.events = [ {
+        })
+        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)
+      })
+
+      it('render correctly spanning multiple weeks', function() {
+        initCalendar({
+          events: [ {
             title: 'hi',
             start: '2014-11-04',
             end: '2014-11-11',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            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(getBackgroundEventEls(getDayGridRowEls().eq(2)).eq(0))
-              .toBeRightOf('.fc-day[data-date="2014-11-09"]')
-
-            expect(getEventEls().length).toBe(0)
-            done()
-          }
-          initCalendar(options)
-        })
-        it('render correctly when starts before start of month', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-10-24',
-            end: '2014-11-06',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            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()
-          }
-          initCalendar(options)
-        })
-        it('render correctly when ends after end of month', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-11-27',
-            end: '2014-12-08',
-            rendering: 'inverse-background'
+            rendering: 'background'
           } ]
-          options._eventsPositioned = function() {
-            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()
-          }
-          initCalendar(options)
-        })
-        it('render correctly with two related events, in reverse order', function(done) {
-          var options = {}
-          options.events = [
-            {
-              groupId: 'hi',
-              start: '2014-11-06',
+        })
+        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)
+      })
+
+      describe('when weekNumbers', function() {
+        it('renders to left of week numbers', function() {
+          initCalendar({
+            weekNumbers: true,
+            events: [ {
+              start: '2014-11-02',
+              end: '2014-11-09',
+              rendering: 'background'
+            } ]
+          })
+          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)
+        })
+      })
+    })
+
+    describe('when inverse', function() {
+
+      describe('when LTR', function() {
+
+        it('render correctly on a single day', function() {
+          initCalendar({
+            events: [ {
+              title: 'hi',
+              start: '2014-11-04',
               rendering: 'inverse-background'
-            },
-            {
-              groupId: 'hi',
+            } ]
+          })
+
+          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(getBackgroundEventEls(getDayGridRowEls().eq(1)).eq(1))
+            .toBeRightOf('.fc-day[data-date="2014-11-03"]')
+
+          expect(getEventEls().length).toBe(0)
+        })
+
+        it('render correctly spanning multiple weeks', function() {
+          initCalendar({
+            events: [ {
+              title: 'hi',
               start: '2014-11-04',
+              end: '2014-11-11',
               rendering: 'inverse-background'
-            }
-          ]
-          options._eventsPositioned = function() {
-            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)'))
-              .toBeLeftOf('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(1)')
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(1)'))
-              .toBeLeftOf('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(2)')
-            */
-
-            done()
-          }
-          initCalendar(options)
+            } ]
+          })
+
+          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(getBackgroundEventEls(getDayGridRowEls().eq(2)).eq(0))
+            .toBeRightOf('.fc-day[data-date="2014-11-09"]')
+
+          expect(getEventEls().length).toBe(0)
+        })
+
+        it('render correctly when starts before start of month', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-10-24',
+              end: '2014-11-06',
+              rendering: 'inverse-background'
+            } ]
+          })
+
+          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"]')
+        })
+
+        it('render correctly when ends after end of month', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-11-27',
+              end: '2014-12-08',
+              rendering: 'inverse-background'
+            } ]
+          })
+
+          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"]')
+        })
+
+        it('render correctly with two related events, in reverse order', function() {
+          initCalendar({
+            events: [
+              {
+                groupId: 'hi',
+                start: '2014-11-06',
+                rendering: 'inverse-background'
+              },
+              {
+                groupId: 'hi',
+                start: '2014-11-04',
+                rendering: 'inverse-background'
+              }
+            ]
+          })
+          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)
         })
+
       })
 
       describe('when RTL', function() {
         pushOptions({ dir: 'rtl' })
 
-        it('render correctly on a single day', function(done) {
-          var options = {}
-          options.events = [ {
-            title: 'hi',
-            start: '2014-11-04',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            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)'))
-              .toBeLeftOf('.fc-day[data-date="2014-11-03"]')
-            expect($('.fc-day-grid .fc-row:eq(1) .fc-bgevent:eq(1)'))
-              .toBeRightOf('.fc-day[data-date="2014-11-05"]')
-            */
-
-            done()
-          }
-          initCalendar(options)
+        it('render correctly on a single day', function() {
+          initCalendar({
+            events: [ {
+              title: 'hi',
+              start: '2014-11-04',
+              rendering: 'inverse-background'
+            } ]
+          })
+          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)
         })
       })
     })
 
     describe('when in month view', function() {
       // disabled for v4
-      xit('can be activated when rendering set on the source', function(done) {
-        var options = {}
-        options.defaultView = 'dayGridMonth'
-        options.eventSources = [ {
-          rendering: 'background',
-          events: [ {
-            start: '2014-11-04'
+      xit('can be activated when rendering set on the source', function() {
+        initCalendar({
+          defaultView: 'dayGridMonth',
+          eventSources: [ {
+            rendering: 'background',
+            events: [ {
+              start: '2014-11-04'
+            } ]
           } ]
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(1)
-          expect(getEventEls().length).toBe(0)
-          done()
-        }
-        initCalendar(options)
+        })
+        expect(getBackgroundEventEls().length).toBe(1)
+        expect(getEventEls().length).toBe(0)
       })
     })
 
     describe('when in timeGrid view and timed event', function() {
       // disabled for v4
-      xit('can be activated when rendering set on the source', function(done) {
-        var options = {}
-        options.defaultView = 'timeGridWeek'
-        options.eventSources = [ {
-          rendering: 'background',
-          events: [ {
-            start: '2014-11-04T01:00:00'
+      xit('can be activated when rendering set on the source', function() {
+        initCalendar({
+          defaultView: 'timeGridWeek',
+          eventSources: [ {
+            rendering: 'background',
+            events: [ {
+              start: '2014-11-04T01:00:00'
+            } ]
           } ]
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(1)
-          expect(getEventEls().length).toBe(0)
-          done()
-        }
-        initCalendar(options)
+        })
+        expect(getBackgroundEventEls().length).toBe(1)
+        expect(getEventEls().length).toBe(0)
       })
     })
   })
@@ -397,79 +347,75 @@ describe('background events', function() {
     pushOptions({ defaultView: 'timeGridWeek' })
 
     describe('when LTR', function() {
-      it('render correctly on one day', function(done) {
-        var options = {}
-        options.events = [ {
-          start: '2014-11-04T01:00:00',
-          end: '2014-11-04T05:00:00',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(1)
-          expect(queryBgEventsInCol(2).length).toBe(1) // column 2
-          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)
-      })
-      it('render correctly spanning multiple days', function(done) {
-        var options = {}
-        options.events = [ {
-          start: '2014-11-04T01:00:00',
-          end: '2014-11-05T05:00:00',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(2)
-          expect(queryBgEventsInCol(2).length).toBe(1)
-          expect(queryBgEventsInCol(3).length).toBe(1)
-          // TODO: maybe check y coords
-          done()
-        }
-        initCalendar(options)
+
+      it('render correctly on one day', function() {
+        initCalendar({
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            end: '2014-11-04T05:00:00',
+            rendering: 'background'
+          } ]
+        })
+        expect(getBackgroundEventEls().length).toBe(1)
+        expect(queryBgEventsInCol(2).length).toBe(1) // column 2
+        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
       })
-      it('render correctly when two span on top of each other', function(done) {
-        var options = {}
-        options.events = [
-          {
+
+      it('render correctly spanning multiple days', function() {
+        initCalendar({
+          events: [ {
             start: '2014-11-04T01:00:00',
             end: '2014-11-05T05:00:00',
             rendering: 'background'
-          },
-          {
-            start: '2014-11-04T03:00:00',
-            end: '2014-11-05T08:00:00',
-            rendering: 'background'
-          }
-        ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(4)
-          expect(queryBgEventsInCol(2).length).toBe(2)
-          expect(queryBgEventsInCol(3).length).toBe(2)
-          // TODO: maybe check y coords
-          done()
-        }
-        initCalendar(options)
+          } ]
+        })
+        expect(getBackgroundEventEls().length).toBe(2)
+        expect(queryBgEventsInCol(2).length).toBe(1)
+        expect(queryBgEventsInCol(3).length).toBe(1)
+      })
+
+      it('render correctly when two span on top of each other', function() {
+        initCalendar({
+          events: [
+            {
+              start: '2014-11-04T01:00:00',
+              end: '2014-11-05T05:00:00',
+              rendering: 'background'
+            },
+            {
+              start: '2014-11-04T03:00:00',
+              end: '2014-11-05T08:00:00',
+              rendering: 'background'
+            }
+          ]
+        })
+        expect(getBackgroundEventEls().length).toBe(4)
+        expect(queryBgEventsInCol(2).length).toBe(2)
+        expect(queryBgEventsInCol(3).length).toBe(2)
+        // TODO: maybe check y coords
       })
+
       describe('when businessHours', function() {
+
         it('renders correctly if assumed default', function() {
-          var options = {}
-          options.businessHours = true
-          initCalendar(options)
+          initCalendar({
+            businessHours: true
+          })
           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 = {}
-          options.businessHours = {
-            startTime: '02:00',
-            endTime: '06:00',
-            daysOfWeek: [ 1, 2, 3, 4 ] // Mon-Thu
-          }
-          initCalendar(options)
+          initCalendar({
+            businessHours: {
+              startTime: '02:00',
+              endTime: '06:00',
+              daysOfWeek: [ 1, 2, 3, 4 ] // Mon-Thu
+            }
+          })
 
           // whole days
           expect(getDayGridNonBusinessDayEls().length).toBe(2) // each multi-day stretch is one element
@@ -486,48 +432,49 @@ describe('background events', function() {
         })
       })
     })
+
     describe('when RTL', function() {
-      pushOptions({ dir: 'rtl' })
-      it('render correctly on one day', function(done) {
-        var options = {}
-        options.events = [ {
-          start: '2014-11-04T01:00:00',
-          end: '2014-11-04T05:00:00',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(1)
-          expect(queryBgEventsInCol(2).length).toBe(1)
-          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)
+      pushOptions({
+        dir: 'rtl'
       })
-      it('render correctly spanning multiple days', function(done) {
-        var options = {}
-        options.events = [ {
-          start: '2014-11-04T01:00:00',
-          end: '2014-11-05T05:00:00',
-          rendering: 'background'
-        } ]
-        options._eventsPositioned = function() {
-          expect(getBackgroundEventEls().length).toBe(2)
-          expect(queryBgEventsInCol(3).length).toBe(1)
-          expect(queryBgEventsInCol(2).length).toBe(1)
-          done()
-        }
-        initCalendar(options)
+
+      it('render correctly on one day', function() {
+        initCalendar({
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            end: '2014-11-04T05:00:00',
+            rendering: 'background'
+          } ]
+        })
+        expect(getBackgroundEventEls().length).toBe(1)
+        expect(queryBgEventsInCol(2).length).toBe(1)
+        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
+      })
+
+      it('render correctly spanning multiple days', function() {
+        initCalendar({
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            end: '2014-11-05T05:00:00',
+            rendering: 'background'
+          } ]
+        })
+        expect(getBackgroundEventEls().length).toBe(2)
+        expect(queryBgEventsInCol(3).length).toBe(1)
+        expect(queryBgEventsInCol(2).length).toBe(1)
       })
+
       describe('when businessHours', function() {
+
         it('renders correctly if custom', function() {
-          var options = {}
-          options.businessHours = {
-            startTime: '02:00',
-            endTime: '06:00',
-            daysOfWeek: [ 1, 2, 3, 4 ] // Mon-Thu
-          }
-          initCalendar(options)
+          initCalendar({
+            businessHours: {
+              startTime: '02:00',
+              endTime: '06:00',
+              daysOfWeek: [ 1, 2, 3, 4 ] // Mon-Thu
+            }
+          })
 
           // whole days
           expect(getDayGridNonBusinessDayEls().length).toBe(2) // each stretch of days is one element
@@ -549,289 +496,249 @@ describe('background events', function() {
 
       describe('when LTR', function() {
 
-        it('render correctly on one day', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-11-04T01:00:00',
-            end: '2014-11-04T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(8)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(2)
-            expect(queryBgEventsInCol(3).length).toBe(1)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
-        })
-
-        it('render correctly spanning multiple days', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-11-04T01:00:00',
-            end: '2014-11-05T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(7)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(1)
-            expect(queryBgEventsInCol(3).length).toBe(1)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
-        })
-
-        it('render correctly when starts before start of week', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-10-30T01:00:00',
-            end: '2014-11-04T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(5)
-            expect(queryBgEventsInCol(0).length).toBe(0)
-            expect(queryBgEventsInCol(1).length).toBe(0)
-            expect(queryBgEventsInCol(2).length).toBe(1)
-            expect(queryBgEventsInCol(3).length).toBe(1)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
-        })
-
-        it('render correctly when ends after end of week', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-11-04T01:00:00',
-            end: '2014-11-12T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(3)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
-        })
-
-        it('render correctly with two related events, in reverse order', function(done) {
-          var options = {}
-          options.events = [
-            {
-              groupId: 'hello',
-              start: '2014-11-05T01:00:00',
-              end: '2014-11-05T05:00:00',
-              rendering: 'inverse-background'
-            },
-            {
-              groupId: 'hello',
-              start: '2014-11-03T01:00:00',
-              end: '2014-11-03T05:00:00',
+        it('render correctly on one day', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-11-04T01:00:00',
+              end: '2014-11-04T05:00:00',
               rendering: 'inverse-background'
-            }
-          ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(9)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(2)
-            expect(queryBgEventsInCol(2).length).toBe(1)
-            expect(queryBgEventsInCol(3).length).toBe(2)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
-        })
-
-        it('render correctly with two related events, nested', function(done) {
-          var options = {}
-          options.events = [
-            {
-              groupId: 'hello',
-              start: '2014-11-05T01:00:00',
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(8)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(2)
+          expect(queryBgEventsInCol(3).length).toBe(1)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          // TODO: maybe check y coords
+        })
+
+        it('render correctly spanning multiple days', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-11-04T01:00:00',
               end: '2014-11-05T05:00:00',
               rendering: 'inverse-background'
-            },
-            {
-              groupId: 'hello',
-              start: '2014-11-05T02:00:00',
-              end: '2014-11-05T04:00:00',
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(7)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(1)
+          expect(queryBgEventsInCol(3).length).toBe(1)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          // TODO: maybe check y coords
+        })
+
+        it('render correctly when starts before start of week', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-10-30T01:00:00',
+              end: '2014-11-04T05:00:00',
               rendering: 'inverse-background'
-            }
-          ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(8)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(1)
-            expect(queryBgEventsInCol(3).length).toBe(2)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(5)
+          expect(queryBgEventsInCol(0).length).toBe(0)
+          expect(queryBgEventsInCol(1).length).toBe(0)
+          expect(queryBgEventsInCol(2).length).toBe(1)
+          expect(queryBgEventsInCol(3).length).toBe(1)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          // TODO: maybe check y coords
+        })
 
-            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
+        it('render correctly when ends after end of week', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-11-04T01:00:00',
+              end: '2014-11-12T05:00:00',
+              rendering: 'inverse-background'
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(3)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(1)
+          // TODO: maybe check y coords
+        })
 
-            done()
-          }
-          initCalendar(options)
+        it('render correctly with two related events, in reverse order', function() {
+          initCalendar({
+            events: [
+              {
+                groupId: 'hello',
+                start: '2014-11-05T01:00:00',
+                end: '2014-11-05T05:00:00',
+                rendering: 'inverse-background'
+              },
+              {
+                groupId: 'hello',
+                start: '2014-11-03T01:00:00',
+                end: '2014-11-03T05:00:00',
+                rendering: 'inverse-background'
+              }
+            ]
+          })
+          expect(getBackgroundEventEls().length).toBe(9)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(2)
+          expect(queryBgEventsInCol(2).length).toBe(1)
+          expect(queryBgEventsInCol(3).length).toBe(2)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          // TODO: maybe check y coords
+        })
+
+        it('render correctly with two related events, nested', function() {
+          initCalendar({
+            events: [
+              {
+                groupId: 'hello',
+                start: '2014-11-05T01:00:00',
+                end: '2014-11-05T05:00:00',
+                rendering: 'inverse-background'
+              },
+              {
+                groupId: 'hello',
+                start: '2014-11-05T02:00:00',
+                end: '2014-11-05T04:00:00',
+                rendering: 'inverse-background'
+              }
+            ]
+          })
+          expect(getBackgroundEventEls().length).toBe(8)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(1)
+          expect(queryBgEventsInCol(3).length).toBe(2)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          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
         })
 
       })
 
       describe('when RTL', function() {
-        pushOptions({ dir: 'rtl' })
-        it('render correctly on one day', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-11-04T01:00:00',
-            end: '2014-11-04T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(8)
-            expect(queryBgEventsInCol(0).length).toBe(1)
-            expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(2)
-            expect(queryBgEventsInCol(3).length).toBe(1)
-            expect(queryBgEventsInCol(4).length).toBe(1)
-            expect(queryBgEventsInCol(5).length).toBe(1)
-            expect(queryBgEventsInCol(6).length).toBe(1)
-            // TODO: maybe check y coords
-            done()
-          }
-          initCalendar(options)
+        pushOptions({
+          dir: 'rtl'
         })
-      })
 
-      describe('when out of view range', function() {
-        it('should still render', function(done) {
-          var options = {}
-          options.events = [ {
-            start: '2014-01-01T01:00:00',
-            end: '2014-01-01T05:00:00',
-            rendering: 'inverse-background'
-          } ]
-          options._eventsPositioned = function() {
-            expect(getBackgroundEventEls().length).toBe(7)
-            done()
-          }
-          initCalendar(options)
+        it('render correctly on one day', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-11-04T01:00:00',
+              end: '2014-11-04T05:00:00',
+              rendering: 'inverse-background'
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(8)
+          expect(queryBgEventsInCol(0).length).toBe(1)
+          expect(queryBgEventsInCol(1).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(2)
+          expect(queryBgEventsInCol(3).length).toBe(1)
+          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(5).length).toBe(1)
+          expect(queryBgEventsInCol(6).length).toBe(1)
+          // TODO: maybe check y coords
         })
       })
-    })
 
-    it('can have custom Event Object color', function(done) {
-      var options = {}
-      options.events = [ {
-        start: '2014-11-04T01:00:00',
-        rendering: 'background',
-        color: 'red'
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
-    })
+      describe('when out of view range', function() {
 
-    it('can have custom Event Object backgroundColor', function(done) {
-      var options = {}
-      options.events = [ {
-        start: '2014-11-04T01:00:00',
-        rendering: 'background',
-        backgroundColor: 'red'
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
+        it('should still render', function() {
+          initCalendar({
+            events: [ {
+              start: '2014-01-01T01:00:00',
+              end: '2014-01-01T05:00:00',
+              rendering: 'inverse-background'
+            } ]
+          })
+          expect(getBackgroundEventEls().length).toBe(7)
+        })
+      })
     })
 
-    it('can have custom Event Source color', function(done) {
-      var options = {}
-      options.eventSources = [ {
-        color: 'red',
+    it('can have custom Event Object color', function() {
+      initCalendar({
         events: [ {
           start: '2014-11-04T01:00:00',
-          rendering: 'background'
+          rendering: 'background',
+          color: 'red'
         } ]
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
     })
 
-    it('can have custom Event Source backgroundColor', function(done) {
-      var options = {}
-      options.eventSources = [ {
-        backgroundColor: 'red',
+    it('can have custom Event Object backgroundColor', function() {
+      initCalendar({
         events: [ {
           start: '2014-11-04T01:00:00',
-          rendering: 'background'
+          rendering: 'background',
+          backgroundColor: 'red'
         } ]
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
     })
 
-    it('is affected by global eventColor', function(done) {
-      var options = {}
-      options.eventColor = 'red'
-      options.eventSources = [ {
-        events: [ {
-          start: '2014-11-04T01:00:00',
-          rendering: 'background'
+    it('can have custom Event Source color', function() {
+      initCalendar({
+        eventSources: [ {
+          color: 'red',
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            rendering: 'background'
+          } ]
         } ]
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
     })
 
-    it('is affected by global eventBackgroundColor', function(done) {
-      var options = {}
-      options.eventBackgroundColor = 'red'
-      options.eventSources = [ {
-        events: [ {
-          start: '2014-11-04T01:00:00',
-          rendering: 'background'
+    it('can have custom Event Source backgroundColor', function() {
+      initCalendar({
+        eventSources: [ {
+          backgroundColor: 'red',
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            rendering: 'background'
+          } ]
+        } ]
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
+    })
+
+    it('is affected by global eventColor', function() {
+      initCalendar({
+        eventColor: 'red',
+        eventSources: [ {
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            rendering: 'background'
+          } ]
         } ]
-      } ]
-      options._eventsPositioned = function() {
-        expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
-        done()
-      }
-      initCalendar(options)
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
+    })
+
+    it('is affected by global eventBackgroundColor', function() {
+      initCalendar({
+        eventBackgroundColor: 'red',
+        eventSources: [ {
+          events: [ {
+            start: '2014-11-04T01:00:00',
+            rendering: 'background'
+          } ]
+        } ]
+      })
+      expect(getBackgroundEventEls().css('background-color')).toMatch(RED_REGEX)
     })
   })
 })

+ 8 - 10
packages/__tests__/src/legacy/defaultAllDayEventDuration.js

@@ -57,7 +57,7 @@ describe('defaultAllDayEventDuration', function() {
       'with dayGridWeek view': 'dayGridWeek',
       'with week view': 'timeGridWeek'
     }, function() {
-      it('renders an all-day event with no `end` to appear to have the default duration', function(done) {
+      it('renders an all-day event with no `end` to appear to have the default duration', function() {
         initCalendar({
           defaultAllDayEventDuration: { days: 2 },
           events: [
@@ -74,16 +74,14 @@ describe('defaultAllDayEventDuration', function() {
               allDay: true,
               start: '2014-04-28'
             }
-          ],
-          _eventsPositioned: function() {
-            var eventElms = getEventEls()
-            var width0 = eventElms.eq(0).outerWidth()
-            var width1 = eventElms.eq(1).outerWidth()
-            expect(width0).toBeGreaterThan(0)
-            expect(width0).toEqual(width1)
-            done()
-          }
+          ]
         })
+
+        var eventElms = getEventEls()
+        var width0 = eventElms.eq(0).outerWidth()
+        var width1 = eventElms.eq(1).outerWidth()
+        expect(width0).toBeGreaterThan(0)
+        expect(width0).toEqual(width1)
       })
     })
   })

+ 16 - 21
packages/__tests__/src/legacy/defaultTimedEventDuration.js

@@ -55,7 +55,7 @@ describe('defaultTimedEventDuration', function() {
         defaultView: 'timeGridWeek'
       })
 
-      it('renders a timed event with no `end` to appear to have the default duration', function(done) {
+      it('renders a timed event with no `end` to appear to have the default duration', function() {
         initCalendar({
           defaultTimedEventDuration: '01:15:00',
           events: [
@@ -72,16 +72,14 @@ describe('defaultTimedEventDuration', function() {
               allDay: false,
               start: '2014-05-02T04:00:00'
             }
-          ],
-          _eventsPositioned: function() {
-            var eventElms = getEventEls()
-            var height0 = eventElms.eq(0).outerHeight()
-            var height1 = eventElms.eq(1).outerHeight()
-            expect(height0).toBeGreaterThan(0)
-            expect(height0).toEqual(height1)
-            done()
-          }
+          ]
         })
+
+        var eventElms = getEventEls()
+        var height0 = eventElms.eq(0).outerHeight()
+        var height1 = eventElms.eq(1).outerHeight()
+        expect(height0).toBeGreaterThan(0)
+        expect(height0).toEqual(height1)
       })
     })
 
@@ -91,8 +89,7 @@ describe('defaultTimedEventDuration', function() {
         defaultView: 'dayGridWeek'
       })
 
-      it('renders a timed event with no `end` to appear to have the default duration', function(done) {
-
+      it('renders a timed event with no `end` to appear to have the default duration', function() {
         initCalendar({
           defaultTimedEventDuration: { days: 2 },
           events: [
@@ -109,16 +106,14 @@ describe('defaultTimedEventDuration', function() {
               allDay: false,
               start: '2014-04-28T04:00:00'
             }
-          ],
-          _eventsPositioned: function() {
-            var eventElms = getEventEls()
-            var width0 = eventElms.eq(0).outerWidth()
-            var width1 = eventElms.eq(1).outerWidth()
-            expect(width0).toBeGreaterThan(0)
-            expect(width0).toEqual(width1)
-            done()
-          }
+          ]
         })
+
+        var eventElms = getEventEls()
+        var width0 = eventElms.eq(0).outerWidth()
+        var width1 = eventElms.eq(1).outerWidth()
+        expect(width0).toBeGreaterThan(0)
+        expect(width0).toEqual(width1)
       })
     })
   })

+ 21 - 42
packages/__tests__/src/legacy/displayEventEnd.js

@@ -20,52 +20,43 @@ describe('displayEventEnd', function() {
       })
 
       describe('with an all-day event', function() {
-        it('displays no time text', function(done) {
+        it('displays no time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13',
               end: '2014-06-13',
               allDay: true
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
         })
       })
 
       describe('with a timed event with no end time', function() {
-        it('displays only the start time text', function(done) {
+        it('displays only the start time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13T01:00:00',
               allDay: false
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
         })
       })
 
       describe('with a timed event with an end time', function() {
-        it('displays only the start time text', function(done) {
+        it('displays only the start time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13T01:00:00',
               end: '2014-06-13T02:00:00',
               allDay: false
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
         })
       })
     })
@@ -77,69 +68,57 @@ describe('displayEventEnd', function() {
       })
 
       describe('with an all-day event', function() {
-        it('displays no time text', function(done) {
+        it('displays no time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13',
               end: '2014-06-13',
               allDay: true
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl()).length).toBe(0)
         })
       })
 
       describe('with a timed event with no end time', function() {
-        it('displays only the start time text', function(done) {
+        it('displays only the start time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13T01:00:00',
               allDay: false
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
         })
       })
 
       describe('with a timed event given an invalid end time', function() {
-        it('displays only the start time text', function(done) {
+        it('displays only the start time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13T01:00:00',
               end: '2014-06-13T01:00:00',
               allDay: false
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM')
         })
       })
 
       describe('with a timed event with an end time', function() {
-        it('displays both the start and end time text', function(done) {
+        it('displays both the start and end time text', function() {
           initCalendar({
             events: [ {
               title: 'timed event',
               start: '2014-06-13T01:00:00',
               end: '2014-06-13T02:00:00',
               allDay: false
-            } ],
-            _eventsPositioned: function() {
-              expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM - 2:00 AM')
-              done()
-            }
+            } ]
           })
+          expect(getEventElTimeEl(getSingleEl())).toHaveText('1:00 AM - 2:00 AM')
         })
       })
     })

+ 94 - 148
packages/__tests__/src/legacy/event-resize.js

@@ -98,21 +98,15 @@ describe('eventResize', function() {
     })
 
     describe('when rendering a timed event', function() {
-      it('should not have resize capabilities', function(done) {
-        var options = {}
-
-        options.events = [ {
-          title: 'timed event',
-          start: '2014-06-11T08:00:00',
-          allDay: false
-        } ]
-
-        options._eventsPositioned = function() {
-          expect($('.fc-event .fc-resizer').length).toBe(0)
-          done()
-        }
-
-        initCalendar(options)
+      it('should not have resize capabilities', function() {
+        initCalendar({
+          events: [ {
+            title: 'timed event',
+            start: '2014-06-11T08:00:00',
+            allDay: false
+          } ]
+        })
+        expect($('.fc-event .fc-resizer').length).toBe(0)
       })
     })
   })
@@ -317,119 +311,89 @@ describe('eventResize', function() {
       })
 
       it('should display the correct time text while resizing', function(done) {
-        var renderCnt = 0
-        var options = {}
-
-        options._eventsPositioned = function() {
-          renderCnt++
-
-          if (renderCnt === 1) {
-            setTimeout(function() {
-              var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
-              $('.fc-event').simulate('mouseover') // for revealing resizer
-              $('.fc-event .fc-resizer').simulate('drag', {
-                dy: dy,
-                onBeforeRelease: function() {
-                  expect($('.fc-event.fc-mirror .fc-time')).toHaveText('5:00 - 9:30')
-
-                  // drag it back
-                  $('.fc-event.fc-mirror').simulate('drag', {
-                    dy: -dy,
-                    onBeforeRelease: function() {
-                      expect($('.fc-event.fc-mirror')).not.toExist()
-                      expect($('.fc-event')).toBeVisible()
-                      expect($('.fc-event .fc-time')).toHaveText('5:00 - 7:00')
-                    },
-                    onRelease: function() {
-                      done()
-                    }
-                  })
-                }
-              })
-            }, 0) // idk
+        initCalendar()
+
+        var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
+        $('.fc-event').simulate('mouseover') // for revealing resizer
+        $('.fc-event .fc-resizer').simulate('drag', {
+          dy: dy,
+          onBeforeRelease: function() {
+            expect($('.fc-event.fc-mirror .fc-time')).toHaveText('5:00 - 9:30')
+
+            // drag it back
+            $('.fc-event.fc-mirror').simulate('drag', {
+              dy: -dy,
+              onBeforeRelease: function() {
+                expect($('.fc-event.fc-mirror')).not.toExist()
+                expect($('.fc-event')).toBeVisible()
+                expect($('.fc-event .fc-time')).toHaveText('5:00 - 7:00')
+              },
+              onRelease: function() {
+                done()
+              }
+            })
           }
-        }
-
-        initCalendar(options)
+        })
       })
 
       it('should run the temporarily rendered event through eventRender', function(done) {
-        var renderCnt = 0
-
         initCalendar({
           eventRender(arg) {
             $(arg.el).addClass('eventDidRender')
           },
           eventPositioned(arg) {
             $(arg.el).addClass('eventDidPosition')
-          },
-          _eventsPositioned() {
-            renderCnt++
-
-            if (renderCnt === 1) {
-              setTimeout(function() {
-                var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
-                $('.fc-event').simulate('mouseover') // for revealing resizer
-                $('.fc-event .fc-resizer').simulate('drag', {
-                  dy: dy,
-                  onBeforeRelease: function() {
-                    expect($('.fc-event.fc-mirror')).toHaveClass('eventDidRender')
-                    expect($('.fc-event.fc-mirror')).toHaveClass('eventDidPosition')
-
-                    // drag it back
-                    $('.fc-event.fc-mirror').simulate('drag', {
-                      dy: -dy,
-                      onBeforeRelease: function() {
-                        expect($('.fc-event.fc-mirror')).not.toExist()
-                      },
-                      onRelease: function() {
-                        done()
-                      }
-                    })
-                  }
-                })
-              }, 0) // idk
-            }
+          }
+        })
+
+        var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
+        $('.fc-event').simulate('mouseover') // for revealing resizer
+        $('.fc-event .fc-resizer').simulate('drag', {
+          dy: dy,
+          onBeforeRelease: function() {
+            expect($('.fc-event.fc-mirror')).toHaveClass('eventDidRender')
+            expect($('.fc-event.fc-mirror')).toHaveClass('eventDidPosition')
+
+            // drag it back
+            $('.fc-event.fc-mirror').simulate('drag', {
+              dy: -dy,
+              onBeforeRelease: function() {
+                expect($('.fc-event.fc-mirror')).not.toExist()
+              },
+              onRelease: function() {
+                done()
+              }
+            })
           }
         })
       })
 
       it('should not fire the windowResize handler', function(done) { // bug 1116
-        var alreadyRendered = false
-
         // has to do this crap because PhantomJS was trigger false window resizes unrelated to the fc-event resize
         var isDragging = false
         var calledWhileDragging = false
-        var options = {}
-        options.windowResizeDelay = 0
-        options.windowResize = function(ev) {
-          if (isDragging) {
-            calledWhileDragging = true
-          }
-        }
 
-        options._eventsPositioned = function() {
-          if (alreadyRendered) {
-            return
+        initCalendar({
+          windowResizeDelay: 0,
+          windowResize: function(ev) {
+            if (isDragging) {
+              calledWhileDragging = true
+            }
           }
-          alreadyRendered = true
-          setTimeout(function() {
-            isDragging = true
-            $('.fc-event').simulate('mouseover') // for revealing resizer
-            $('.fc-event .fc-resizer').simulate('drag', {
-              dy: 100,
-              onBeforeRelease: function() {
-                isDragging = false
-              },
-              onRelease: function() {
-                expect(calledWhileDragging).toBe(false)
-                done()
-              }
-            })
-          }, 100) // hack for PhantomJS. after any initial false window resizes
-        }
+        })
 
-        initCalendar(options)
+        isDragging = true
+        $('.fc-event').simulate('mouseover') // for revealing resizer
+        $('.fc-event .fc-resizer').simulate('drag', {
+          dy: 100,
+          onBeforeRelease: function() {
+            isDragging = false
+          },
+          onRelease: function() {
+            expect(calledWhileDragging).toBe(false)
+            done()
+          }
+        })
       })
     })
 
@@ -444,40 +408,29 @@ describe('eventResize', function() {
       })
 
       it('should display the correct time text while resizing', function(done) {
-        var renderCnt = 0
-        var options = {}
-
-        options._eventsPositioned = function() {
-          renderCnt++
-
-          if (renderCnt === 1) {
-            setTimeout(function() {
-              var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
-              $('.fc-event').simulate('mouseover') // for revealing resizer
-              $('.fc-event .fc-resizer').simulate('drag', {
-                dy: dy,
-                onBeforeRelease: function() {
-                  expect($('.fc-event.fc-mirror .fc-time')).toHaveText('5:00 - 9:30')
-
-                  // drag it back
-                  $('.fc-event.fc-mirror').simulate('drag', {
-                    dy: -dy,
-                    onBeforeRelease: function() {
-                      expect($('.fc-event.fc-mirror')).not.toExist()
-                      expect($('.fc-event')).toBeVisible()
-                      expect($('.fc-event .fc-time')).toHaveText('5:00')
-                    },
-                    onRelease: function() {
-                      done()
-                    }
-                  })
-                }
-              })
-            }, 0) // idk
+        initCalendar()
+
+        var dy = $('.fc-slats tr:eq(1)').height() * 5 // 5 slots, so 2.5 hours
+        $('.fc-event').simulate('mouseover') // for revealing resizer
+        $('.fc-event .fc-resizer').simulate('drag', {
+          dy: dy,
+          onBeforeRelease: function() {
+            expect($('.fc-event.fc-mirror .fc-time')).toHaveText('5:00 - 9:30')
+
+            // drag it back
+            $('.fc-event.fc-mirror').simulate('drag', {
+              dy: -dy,
+              onBeforeRelease: function() {
+                expect($('.fc-event.fc-mirror')).not.toExist()
+                expect($('.fc-event')).toBeVisible()
+                expect($('.fc-event .fc-time')).toHaveText('5:00')
+              },
+              onRelease: function() {
+                done()
+              }
+            })
           }
-        }
-
-        initCalendar(options)
+        })
       })
     })
   })
@@ -485,14 +438,6 @@ describe('eventResize', function() {
   // Initialize a calendar, run a resize, and do type-checking of all arguments for all handlers.
   // TODO: more descrimination instead of just checking for 'object'
   function init(options, resizeStartFunc, resizeDoneFunc) {
-    var eventsRendered = false
-
-    options._eventsPositioned = function() {
-      if (!eventsRendered) { // because event rerendering will happen when resize is over
-        resizeStartFunc()
-        eventsRendered = true
-      }
-    }
     options.eventResizeStart = function(arg) {
       expect(arg.el instanceof Element).toBe(true)
       expect(arg.el).toHaveClass('fc-event')
@@ -529,6 +474,7 @@ describe('eventResize', function() {
 
     setTimeout(function() { // hack. timeGrid view scroll state would get messed up between tests
       initCalendar(options)
+      resizeStartFunc()
     }, 0)
   }
 })

+ 0 - 5
packages/__tests__/src/legacy/eventLimit-popover.js

@@ -501,20 +501,17 @@ describe('eventLimit popover', function() {
       ],
       eventRender: function() {},
       eventPositioned: function() {},
-      _eventsPositioned: function() {},
       eventDestroy: function() {}
     }
 
     spyOn(options, 'eventRender')
     spyOn(options, 'eventPositioned')
-    spyOn(options, '_eventsPositioned')
     spyOn(options, 'eventDestroy')
 
     initCalendar(options)
 
     expect(options.eventRender.calls.count()).toBe(4)
     expect(options.eventPositioned.calls.count()).toBe(4)
-    expect(options._eventsPositioned.calls.count()).toBe(1)
     expect(options.eventDestroy.calls.count()).toBe(0)
 
     openWithClick()
@@ -522,7 +519,6 @@ describe('eventLimit popover', function() {
 
       expect(options.eventRender.calls.count()).toBe(8) // +4
       expect(options.eventPositioned.calls.count()).toBe(8) // +4
-      expect(options._eventsPositioned.calls.count()).toBe(2) // +1
       expect(options.eventDestroy.calls.count()).toBe(0)
 
       closeWithClick()
@@ -530,7 +526,6 @@ describe('eventLimit popover', function() {
 
         expect(options.eventRender.calls.count()).toBe(8)
         expect(options.eventPositioned.calls.count()).toBe(8)
-        expect(options._eventsPositioned.calls.count()).toBe(2)
         expect(options.eventDestroy.calls.count()).toBe(4) // +4
 
         done()

+ 66 - 94
packages/__tests__/src/legacy/eventRender.js

@@ -20,7 +20,7 @@ describe('eventRender', function() {
       })
 
       describe('with foreground event', function() {
-        it('receives correct args AND can modify the element', function(done) {
+        it('receives correct args AND can modify the element', function() {
           var options = {
             eventRender: function(arg) {
               expect(typeof arg.event).toBe('object')
@@ -30,15 +30,13 @@ describe('eventRender', function() {
               expect(typeof arg.view).toBe('object')
               expect(arg.isMirror).toBe(false)
               $(arg.el).css('font-size', '20px')
-            },
-            _eventsPositioned: function() {
-              expect($(gridSelector).find('.fc-event').css('font-size')).toBe('20px')
-              expect(options.eventRender).toHaveBeenCalled()
-              done()
             }
           }
           spyOn(options, 'eventRender').and.callThrough()
           initCalendar(options)
+
+          expect($(gridSelector).find('.fc-event').css('font-size')).toBe('20px')
+          expect(options.eventRender).toHaveBeenCalled()
         })
       })
     })
@@ -55,33 +53,31 @@ describe('eventRender', function() {
     })
 
     describe('with a foreground event', function() {
-      it('can return a new element', function(done) {
+
+      it('can return a new element', function() {
         var options = {
           eventRender: function(arg) {
             return $('<div class="fc-event sup" style="background-color:green">sup g</div>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .sup').length).toBe(1)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .sup').length).toBe(1)
+        expect(options.eventRender).toHaveBeenCalled()
       })
-      it('can return false and cancel rendering', function(done) {
+
+      it('can return false and cancel rendering', function() {
         var options = {
-          eventRender: function(arg) {
+          eventRender() {
             return false
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .fc-event').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .fc-event').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
     })
 
@@ -95,7 +91,7 @@ describe('eventRender', function() {
         } ]
       })
 
-      it('receives correct args AND can modify the element', function(done) {
+      it('receives correct args AND can modify the element', function() {
         var options = {
           eventRender: function(arg) {
             expect(typeof arg.event).toBe('object')
@@ -105,59 +101,51 @@ describe('eventRender', function() {
             expect(typeof arg.view).toBe('object')
             $(arg.el).css('font-size', '20px')
           },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .fc-bgevent').css('font-size')).toBe('20px')
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
-          }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .fc-bgevent').css('font-size')).toBe('20px')
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('can return a new element', function(done) {
+      it('can return a new element', function() {
         var options = {
           eventRender: function(arg) {
             return $('<td class="sup" style="background-color:green">sup g</td>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .sup').length).toBe(1)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .sup').length).toBe(1)
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('won\'t rendering when returning a new element of the wrong type', function(done) {
+      it('won\'t rendering when returning a new element of the wrong type', function() {
         var options = {
           eventRender: function(arg) {
             return $('<div class="sup" style="background-color:green">sup g</div>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .sup').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .sup').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('can return false and cancel rendering', function(done) {
+      it('can return false and cancel rendering', function() {
         var options = {
           eventRender: function(arg) {
             return false
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .fc-bgevent').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .fc-bgevent').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
     })
 
@@ -171,17 +159,15 @@ describe('eventRender', function() {
         } ]
       })
 
-      it('won\'t render or call eventRender', function(done) {
+      it('won\'t render or call eventRender', function() {
         var options = {
           eventRender: function(arg) {},
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .fc-bgevent').length).toBe(0)
-            expect(options.eventRender).not.toHaveBeenCalled()
-            done()
-          }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .fc-bgevent').length).toBe(0)
+        expect(options.eventRender).not.toHaveBeenCalled()
       })
     })
   })
@@ -201,34 +187,30 @@ describe('eventRender', function() {
         } ]
       })
 
-      it('can return a new element', function(done) {
+      it('can return a new element', function() {
         var options = {
           eventRender: function(arg) {
             return $('<div class="fc-event sup" style="background-color:green">sup g</div>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .sup').length).toBe(1)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .sup').length).toBe(1)
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('can return false and cancel rendering', function(done) {
+      it('can return false and cancel rendering', function() {
         var options = {
           eventRender: function(arg) {
             return false
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .fc-event').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .fc-event').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
     })
 
@@ -242,7 +224,7 @@ describe('eventRender', function() {
         } ]
       })
 
-      it('receives correct args AND can modify the element', function(done) {
+      it('receives correct args AND can modify the element', function() {
         var options = {
           eventRender: function(arg) {
             expect(typeof arg.event).toBe('object')
@@ -251,64 +233,56 @@ describe('eventRender', function() {
             expect(arg.el instanceof HTMLElement).toBe(true)
             expect(typeof arg.view).toBe('object')
             $(arg.el).css('font-size', '20px')
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .fc-bgevent').css('font-size')).toBe('20px')
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .fc-bgevent').css('font-size')).toBe('20px')
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('can return a new element', function(done) {
+      it('can return a new element', function() {
         var options = {
           eventRender: function() {
             return $('<div class="fc-bgevent sup" style="background-color:green">sup g</div>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .sup').length).toBe(1)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .sup').length).toBe(1)
+        expect(options.eventRender).toHaveBeenCalled()
       })
 
-      it('won\'t rendering when returning a new element of the wrong type', function(done) {
+      it('won\'t rendering when returning a new element of the wrong type', function() {
         var options = {
           eventRender: function() {
             return $('<p class="fc-bgevent sup" style="background-color:green">sup g</p>')[0]
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .sup').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .sup').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
-      it('can return false and cancel rendering', function(done) {
+
+      it('can return false and cancel rendering', function() {
         var options = {
           eventRender: function() {
             return false
-          },
-          _eventsPositioned: function() {
-            expect($('.fc-time-grid .fc-bgevent').length).toBe(0)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
           }
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-time-grid .fc-bgevent').length).toBe(0)
+        expect(options.eventRender).toHaveBeenCalled()
       })
     })
 
     describe('with an all-day background event', function() { // not exactly related to eventRender!
-
       pushOptions({
         events: [ {
           title: 'my event',
@@ -317,18 +291,16 @@ describe('eventRender', function() {
         } ]
       })
 
-      it('will render in all-day AND timed slots', function(done) {
+      it('will render in all-day AND timed slots', function() {
         var options = {
-          eventRender: function() {},
-          _eventsPositioned: function() {
-            expect($('.fc-day-grid .fc-bgevent').length).toBe(1)
-            expect($('.fc-time-grid .fc-bgevent').length).toBe(1)
-            expect(options.eventRender).toHaveBeenCalled()
-            done()
-          }
+          eventRender: function() {}
         }
         spyOn(options, 'eventRender').and.callThrough()
         initCalendar(options)
+
+        expect($('.fc-day-grid .fc-bgevent').length).toBe(1)
+        expect($('.fc-time-grid .fc-bgevent').length).toBe(1)
+        expect(options.eventRender).toHaveBeenCalled()
       })
     })
   })

+ 18 - 25
packages/__tests__/src/legacy/removeEvents.js

@@ -117,37 +117,30 @@ describe('removeEvents', function() {
 
   // Verifies the actions in removeFunc executed correctly by calling checkFunc.
   function go(events, removeFunc, checkFunc, doneFunc) {
-    var called = false
     initCalendar({
-      events: events,
-      _eventsPositioned: function() {
-        if (!called) { // don't execute on subsequent removeEvents/next/prev
-          called = true
-
-          checkAllEvents() // make sure all events initially rendered correctly
-
-          removeFunc() // remove the events
-          setTimeout(function() { // because the event rerender will be queued because we're a level deep
+      events
+    })
 
-            checkFunc() // check correctness
+    checkAllEvents() // make sure all events initially rendered correctly
+    removeFunc() // remove the events
+    setTimeout(function() { // because the event rerender will be queued because we're a level deep
 
-            // move the calendar back out of view, then back in
-            currentCalendar.next()
-            currentCalendar.prev()
+      checkFunc() // check correctness
 
-            // array event sources should maintain the same state
-            // whereas "dynamic" event sources should refetch and reset the state
-            if ($.isArray(events)) {
-              checkFunc() // for issue 2187
-            } else {
-              checkAllEvents()
-            }
+      // move the calendar back out of view, then back in
+      currentCalendar.next()
+      currentCalendar.prev()
 
-            doneFunc()
-          }, 0)
-        }
+      // array event sources should maintain the same state
+      // whereas "dynamic" event sources should refetch and reset the state
+      if ($.isArray(events)) {
+        checkFunc() // for issue 2187
+      } else {
+        checkAllEvents()
       }
-    })
+
+      doneFunc()
+    }, 0)
   }
 
 

+ 15 - 27
packages/__tests__/src/legacy/scroll-state.js

@@ -52,37 +52,25 @@ describe('scroll state', function() {
       }, 0)
     })
 
-    it('should be maintained when after rerendering events', function(done) {
-      var calls = 0
-      var eventEl0
-      var eventEl1
-      var scrollEl
-      var scroll0
-
+    it('should be maintained when after rerendering events', function() {
       initCalendar({
         events: [ {
           start: '2015-02-20'
-        } ],
-        _eventsPositioned: function() {
-          if (++calls === 1) {
-            eventEl0 = $('.fc-event', calendarEl)
-            expect(eventEl0.length).toBe(1)
-
-            setTimeout(function() { // wait until after browser's scroll state is applied
-              scrollEl.scrollTop(9999) // all the way
-              scroll0 = scrollEl.scrollTop()
-              currentCalendar.render()
-            }, 0)
-          } else {
-            eventEl1 = $('.fc-event', calendarEl)
-            expect(eventEl1.length).toBe(1)
-            expect(eventEl1[0]).not.toBe(eventEl0[0]) // ensure it a rerender
-            expect(scrollEl.scrollTop()).toBe(scroll0)
-            done()
-          }
-        }
+        } ]
       }, calendarEl)
-      scrollEl = $('.fc-scroller', calendarEl)
+
+      let scrollEl = $('.fc-scroller', calendarEl)
+      let eventEl0 = $('.fc-event', calendarEl)
+      expect(eventEl0.length).toBe(1)
+
+      scrollEl.scrollTop(9999) // all the way
+      let scroll0 = scrollEl.scrollTop()
+      currentCalendar.render()
+
+      let eventEl1 = $('.fc-event', calendarEl)
+      expect(eventEl1.length).toBe(1)
+      expect(eventEl1[0]).not.toBe(eventEl0[0]) // ensure it a rerender
+      expect(scrollEl.scrollTop()).toBe(scroll0)
     })
   }
 })

+ 24 - 44
packages/__tests__/src/legacy/timeZone.js

@@ -26,14 +26,11 @@ describe('timeZone', function() {
   })
 
 
-  it('receives events correctly when local timezone', function(done) {
+  it('receives events correctly when local timezone', function() {
     initCalendar({
-      timeZone: 'local',
-      _eventsPositioned: function() {
-        expectLocalTimezone()
-        done()
-      }
+      timeZone: 'local'
     })
+    expectLocalTimezone()
   })
 
   function expectLocalTimezone() {
@@ -49,14 +46,11 @@ describe('timeZone', function() {
   }
 
 
-  it('receives events correctly when UTC timezone', function(done) {
+  it('receives events correctly when UTC timezone', function() {
     initCalendar({
-      timeZone: 'UTC',
-      _eventsPositioned: function() {
-        expectUtcTimezone()
-        done()
-      }
+      timeZone: 'UTC'
     })
+    expectUtcTimezone()
   })
 
   function expectUtcTimezone() {
@@ -72,14 +66,11 @@ describe('timeZone', function() {
   }
 
 
-  it('receives events correctly when custom timezone', function(done) {
+  it('receives events correctly when custom timezone', function() {
     initCalendar({
-      timeZone: 'America/Chicago',
-      _eventsPositioned: function() {
-        expectCustomTimezone()
-        done()
-      }
+      timeZone: 'America/Chicago'
     })
+    expectCustomTimezone()
   })
 
   function expectCustomTimezone() {
@@ -95,34 +86,23 @@ describe('timeZone', function() {
   }
 
 
-  it('can be set dynamically', function(done) {
-    var callCnt = 0
-
+  it('can be set dynamically', function() {
     initCalendar({
-      timeZone: 'local',
-      _eventsPositioned: function() {
-        callCnt++
-        if (callCnt === 1) {
-
-          expectLocalTimezone()
-          currentCalendar.setOption('timeZone', 'UTC') // will cause second call...
-
-        } else if (callCnt === 2) {
-
-          var allDayEvent = currentCalendar.getEventById('1')
-          var timedEvent = currentCalendar.getEventById('2')
-          var zonedEvent = currentCalendar.getEventById('3')
-          expect(allDayEvent.allDay).toEqual(true)
-          expect(allDayEvent.start).toEqualDate('2014-05-02')
-          expect(timedEvent.allDay).toEqual(false)
-          expect(timedEvent.start).toEqualLocalDate('2014-05-10T12:00:00') // was parsed as LOCAL originally
-          expect(zonedEvent.allDay).toEqual(false)
-          expect(zonedEvent.start).toEqualDate('2014-05-10T14:00:00+11:00')
-
-          done()
-        }
-      }
+      timeZone: 'local'
     })
+
+    expectLocalTimezone()
+
+    currentCalendar.setOption('timeZone', 'UTC')
+    var allDayEvent = currentCalendar.getEventById('1')
+    var timedEvent = currentCalendar.getEventById('2')
+    var zonedEvent = currentCalendar.getEventById('3')
+    expect(allDayEvent.allDay).toEqual(true)
+    expect(allDayEvent.start).toEqualDate('2014-05-02')
+    expect(timedEvent.allDay).toEqual(false)
+    expect(timedEvent.start).toEqualLocalDate('2014-05-10T12:00:00') // was parsed as LOCAL originally
+    expect(zonedEvent.allDay).toEqual(false)
+    expect(zonedEvent.start).toEqualDate('2014-05-10T14:00:00+11:00')
   })
 
 })

+ 4 - 3
packages/__tests__/src/lib/time-grid.js

@@ -96,6 +96,7 @@ export function getTimeGridLine(date) { // not in Scheduler
 export function getTimeGridTop(targetTimeMs) {
   const topBorderWidth = 1 // TODO: kill
   let slotEls = getSlotElByTime(targetTimeMs)
+  let $slotEl // used within loop, but we access last val
 
   // exact slot match
   if (slotEls.length === 1) {
@@ -108,7 +109,7 @@ export function getTimeGridTop(targetTimeMs) {
 
   for (let i = 0; i < slotEls.length; i++) { // traverse earlier to later
     let slotEl = slotEls[i]
-    let $slotEl = $(slotEl)
+    $slotEl = $(slotEl)
 
     prevSlotTimeMs = slotTimeMs
     slotTimeMs = createDuration(slotEl.getAttribute('data-time')).milliseconds
@@ -134,9 +135,9 @@ export function getTimeGridTop(targetTimeMs) {
   // guess the duration of the last slot, based on previous duration
   const slotMsDuration = slotTimeMs - prevSlotTimeMs
 
-  return slotEl.offset().top + // last slot's top
+  return $slotEl.offset().top + // last slot's top
     topBorderWidth +
-    (slotEl.outerHeight() *
+    ($slotEl.outerHeight() *
     Math.min(1, (targetTimeMs - slotTimeMs) / slotMsDuration)) // don't go past end of last slot
 }
 

+ 22 - 38
packages/__tests__/src/view-type/changeView.js

@@ -32,46 +32,30 @@ describe('changeView', function() {
   describe('when switching away from view, then back', function() {
 
     // serves as a smoke test too
-    it('correctly renders original view again', function(done) {
-      var renderCalls = 0
-
+    it('correctly renders original view again', function() {
       initCalendar({
-        defaultView: 'dayGridMonth',
-        _eventsPositioned: function(arg) {
-          var view = currentCalendar.view
-
-          renderCalls++
-
-          switch (renderCalls) {
-            case 1:
-              expect(view.type).toBe('dayGridMonth')
-              checkViewIntegrity()
-              currentCalendar.changeView('timeGridWeek')
-              break
-            case 2:
-              expect(view.type).toBe('timeGridWeek')
-              checkViewIntegrity()
-              expect(TimeGridRenderUtils.isStructureValid()).toBe(true)
-              currentCalendar.changeView('dayGridWeek')
-              break
-            case 3:
-              expect(view.type).toBe('dayGridWeek')
-              checkViewIntegrity()
-              currentCalendar.changeView('listWeek')
-              break
-            case 4:
-              expect(view.type).toBe('listWeek')
-              checkViewIntegrity()
-              currentCalendar.changeView('dayGridMonth')
-              break
-            case 5:
-              expect(view.type).toBe('dayGridMonth')
-              checkViewIntegrity()
-              done()
-              break
-          }
-        }
+        defaultView: 'dayGridMonth'
       })
+
+      expect(currentCalendar.view.type).toBe('dayGridMonth')
+      checkViewIntegrity()
+      currentCalendar.changeView('timeGridWeek')
+
+      expect(currentCalendar.view.type).toBe('timeGridWeek')
+      checkViewIntegrity()
+      expect(TimeGridRenderUtils.isStructureValid()).toBe(true)
+      currentCalendar.changeView('dayGridWeek')
+
+      expect(currentCalendar.view.type).toBe('dayGridWeek')
+      checkViewIntegrity()
+      currentCalendar.changeView('listWeek')
+
+      expect(currentCalendar.view.type).toBe('listWeek')
+      checkViewIntegrity()
+      currentCalendar.changeView('dayGridMonth')
+
+      expect(currentCalendar.view.type).toBe('dayGridMonth')
+      checkViewIntegrity()
     })
   })