Explorar o código

Update legacy tests

acerix %!s(int64=7) %!d(string=hai) anos
pai
achega
258692f139

+ 36 - 37
tests/automated/legacy/events-gcal.js

@@ -24,7 +24,6 @@ describe('Google Calendar plugin', function() {
   var oldConsoleWarn
   var oldConsoleWarn
 
 
   beforeEach(function() {
   beforeEach(function() {
-    affix('#cal')
 
 
     options = {
     options = {
       defaultView: 'month',
       defaultView: 'month',
@@ -48,7 +47,7 @@ describe('Google Calendar plugin', function() {
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.timezone = 'local'
     options.timezone = 'local'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       var i
       var i
 
 
       expect(events.length).toBe(NUM_EVENTS)
       expect(events.length).toBe(NUM_EVENTS)
@@ -58,7 +57,7 @@ describe('Google Calendar plugin', function() {
 
 
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('request/receives correctly when UTC timezone', function(done) {
   it('request/receives correctly when UTC timezone', function(done) {
@@ -66,7 +65,7 @@ describe('Google Calendar plugin', function() {
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.timezone = 'UTC'
     options.timezone = 'UTC'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       var i
       var i
 
 
       expect(events.length).toBe(NUM_EVENTS)
       expect(events.length).toBe(NUM_EVENTS)
@@ -76,7 +75,7 @@ describe('Google Calendar plugin', function() {
 
 
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('request/receives correctly when custom timezone', function(done) {
   it('request/receives correctly when custom timezone', function(done) {
@@ -84,7 +83,7 @@ describe('Google Calendar plugin', function() {
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.timezone = 'America/New York'
     options.timezone = 'America/New York'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       var i
       var i
 
 
       expect(events.length).toBe(NUM_EVENTS)
       expect(events.length).toBe(NUM_EVENTS)
@@ -94,14 +93,14 @@ describe('Google Calendar plugin', function() {
 
 
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('requests/receives correctly when no timezone, defaults to not editable', function(done) {
   it('requests/receives correctly when no timezone, defaults to not editable', function(done) {
     options.googleCalendarApiKey = API_KEY
     options.googleCalendarApiKey = API_KEY
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.events = { googleCalendarId: HOLIDAY_CALENDAR_ID }
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       var eventEls = $('.fc-event')
       var eventEls = $('.fc-event')
       var i
       var i
 
 
@@ -115,7 +114,7 @@ describe('Google Calendar plugin', function() {
 
 
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('allows editable to explicitly be set to true', function(done) {
   it('allows editable to explicitly be set to true', function(done) {
@@ -130,7 +129,7 @@ describe('Google Calendar plugin', function() {
       expect(eventEls.find('.fc-resizer').length).toBeGreaterThan(0) // editable!
       expect(eventEls.find('.fc-resizer').length).toBeGreaterThan(0) // editable!
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('fetches events correctly when API key is in the event source', function(done) {
   it('fetches events correctly when API key is in the event source', function(done) {
@@ -139,11 +138,11 @@ describe('Google Calendar plugin', function() {
       googleCalendarApiKey: API_KEY
       googleCalendarApiKey: API_KEY
     }
     }
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   describe('when not given an API key', function() {
   describe('when not given an API key', function() {
@@ -158,7 +157,7 @@ describe('Google Calendar plugin', function() {
         googleCalendarId: HOLIDAY_CALENDAR_ID
         googleCalendarId: HOLIDAY_CALENDAR_ID
       }
       }
       options.eventAfterAllRender = function() {
       options.eventAfterAllRender = function() {
-        var events = $('#cal').fullCalendar('clientEvents')
+        var events = currentCalendar.clientEvents()
 
 
         expect(events.length).toBe(0)
         expect(events.length).toBe(0)
         expect(currentWarnArgs.length).toBeGreaterThan(0)
         expect(currentWarnArgs.length).toBeGreaterThan(0)
@@ -169,7 +168,7 @@ describe('Google Calendar plugin', function() {
       }
       }
       spyOn(options, 'googleCalendarError').and.callThrough()
       spyOn(options, 'googleCalendarError').and.callThrough()
       spyOn(options.events, 'googleCalendarError').and.callThrough()
       spyOn(options.events, 'googleCalendarError').and.callThrough()
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
     })
     })
   })
   })
 
 
@@ -186,7 +185,7 @@ describe('Google Calendar plugin', function() {
         googleCalendarId: HOLIDAY_CALENDAR_ID
         googleCalendarId: HOLIDAY_CALENDAR_ID
       }
       }
       options.eventAfterAllRender = function() {
       options.eventAfterAllRender = function() {
-        var events = $('#cal').fullCalendar('clientEvents')
+        var events = currentCalendar.clientEvents()
 
 
         expect(events.length).toBe(0)
         expect(events.length).toBe(0)
         expect(currentWarnArgs.length).toBeGreaterThan(0)
         expect(currentWarnArgs.length).toBeGreaterThan(0)
@@ -197,7 +196,7 @@ describe('Google Calendar plugin', function() {
       }
       }
       spyOn(options, 'googleCalendarError').and.callThrough()
       spyOn(options, 'googleCalendarError').and.callThrough()
       spyOn(options.events, 'googleCalendarError').and.callThrough()
       spyOn(options.events, 'googleCalendarError').and.callThrough()
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
     })
     })
   })
   })
 
 
@@ -205,11 +204,11 @@ describe('Google Calendar plugin', function() {
     options.googleCalendarApiKey = API_KEY
     options.googleCalendarApiKey = API_KEY
     options.events = HOLIDAY_CALENDAR_ID
     options.events = HOLIDAY_CALENDAR_ID
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('detects a gcal when `events` is the actual calendar ID, with complicated characters (1)', function(done) {
   it('detects a gcal when `events` is the actual calendar ID, with complicated characters (1)', function(done) {
@@ -220,7 +219,7 @@ describe('Google Calendar plugin', function() {
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('detects a gcal when `events` is the actual calendar ID, with complicated characters (2)', function(done) {
   it('detects a gcal when `events` is the actual calendar ID, with complicated characters (2)', function(done) {
@@ -231,7 +230,7 @@ describe('Google Calendar plugin', function() {
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('detects a gcal when `events` is the actual calendar ID, person gmail', function(done) {
   it('detects a gcal when `events` is the actual calendar ID, person gmail', function(done) {
@@ -242,7 +241,7 @@ describe('Google Calendar plugin', function() {
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('detects a gcal when `events` is the actual calendar ID, person googlemail', function(done) {
   it('detects a gcal when `events` is the actual calendar ID, person googlemail', function(done) {
@@ -253,29 +252,29 @@ describe('Google Calendar plugin', function() {
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       expect(typeof currentWarnArgs[1]).toBe('object') // sent the request to google, but not-found warning
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('works with requesting an HTTP V1 API feed URL', function(done) {
   it('works with requesting an HTTP V1 API feed URL', function(done) {
     options.googleCalendarApiKey = API_KEY
     options.googleCalendarApiKey = API_KEY
     options.events = 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'
     options.events = 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('works with requesting an HTTPS V1 API feed URL', function(done) {
   it('works with requesting an HTTPS V1 API feed URL', function(done) {
     options.googleCalendarApiKey = API_KEY
     options.googleCalendarApiKey = API_KEY
     options.events = 'https://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'
     options.events = 'https://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('works with requesting an V3 API feed URL', function(done) {
   it('works with requesting an V3 API feed URL', function(done) {
@@ -283,11 +282,11 @@ describe('Google Calendar plugin', function() {
     options.events =
     options.events =
       'https://www.googleapis.com/calendar/v3/calendars/usa__en%40holiday.calendar.google.com/events'
       'https://www.googleapis.com/calendar/v3/calendars/usa__en%40holiday.calendar.google.com/events'
     options.eventAfterAllRender = function() {
     options.eventAfterAllRender = function() {
-      var events = $('#cal').fullCalendar('clientEvents')
+      var events = currentCalendar.clientEvents()
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
       done()
       done()
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   it('calls loading with true then false', function(done) {
   it('calls loading with true then false', function(done) {
@@ -307,7 +306,7 @@ describe('Google Calendar plugin', function() {
         done()
         done()
       }
       }
     }
     }
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   })
   })
 
 
   describe('removeEventSource', function() {
   describe('removeEventSource', function() {
@@ -323,18 +322,18 @@ describe('Google Calendar plugin', function() {
         if (called) { return } // only the first time
         if (called) { return } // only the first time
         called = true
         called = true
 
 
-        events = $('#cal').fullCalendar('clientEvents')
+        events = currentCalendar.clientEvents()
         expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
         expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
 
 
         setTimeout(function() {
         setTimeout(function() {
-          $('#cal').fullCalendar('removeEventSource', HOLIDAY_CALENDAR_ID)
-          events = $('#cal').fullCalendar('clientEvents')
+          currentCalendar.removeEventSource(HOLIDAY_CALENDAR_ID)
+          events = currentCalendar.clientEvents()
           expect(events.length).toBe(0)
           expect(events.length).toBe(0)
           done()
           done()
         }, 0)
         }, 0)
       }
       }
 
 
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
     })
     })
 
 
     it('works when specifying a raw Google Calendar source object', function(done) {
     it('works when specifying a raw Google Calendar source object', function(done) {
@@ -349,18 +348,18 @@ describe('Google Calendar plugin', function() {
         if (called) { return } // only the first time
         if (called) { return } // only the first time
         called = true
         called = true
 
 
-        events = $('#cal').fullCalendar('clientEvents')
+        events = currentCalendar.clientEvents()
         expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
         expect(events.length).toBe(NUM_EVENTS) // 5 holidays in November 2016 (and end of Oct)
 
 
         setTimeout(function() {
         setTimeout(function() {
-          $('#cal').fullCalendar('removeEventSource', googleSource)
-          events = $('#cal').fullCalendar('clientEvents')
+          currentCalendar.removeEventSource(googleSource)
+          events = currentCalendar.clientEvents()
           expect(events.length).toBe(0)
           expect(events.length).toBe(0)
           done()
           done()
         }, 0)
         }, 0)
       }
       }
 
 
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
     })
     })
   })
   })
 
 

+ 11 - 11
tests/automated/legacy/external-dnd.js

@@ -1,6 +1,6 @@
 import ListenerCounter from '../lib/ListenerCounter'
 import ListenerCounter from '../lib/ListenerCounter'
 
 
-describe('external drag and drop', function() {
+fdescribe('external drag and drop', function() {
 
 
   // TODO: fill out tests for droppable/drop, with RTL
   // TODO: fill out tests for droppable/drop, with RTL
 
 
@@ -25,8 +25,9 @@ describe('external drag and drop', function() {
   })
   })
 
 
   afterEach(function() {
   afterEach(function() {
-    $('#cal').fullCalendar('destroy')
-    $('#cal').remove()
+    var el = currentCalendar.el
+    currentCalendar.destroy()
+    $(el).remove()
     $('#sidebar').remove()
     $('#sidebar').remove()
   })
   })
 
 
@@ -36,8 +37,7 @@ describe('external drag and drop', function() {
     } else {
     } else {
       $('#sidebar a').draggable()
       $('#sidebar a').draggable()
     }
     }
-
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
   }
   }
 
 
   function getMonthCell(row, col) {
   function getMonthCell(row, col) {
@@ -63,8 +63,8 @@ describe('external drag and drop', function() {
             if (callCnt === 0) {
             if (callCnt === 0) {
               expect(date).toEqualMoment('2014-08-06')
               expect(date).toEqualMoment('2014-08-06')
 
 
-              $('#cal').fullCalendar('next')
-              $('#cal').fullCalendar('prev')
+              currentCalendar.next()
+              currentCalendar.prev()
 
 
               setTimeout(function() {
               setTimeout(function() {
                 $('#sidebar .event1').remove()
                 $('#sidebar .event1').remove()
@@ -186,8 +186,8 @@ describe('external drag and drop', function() {
             if (callCnt === 0) {
             if (callCnt === 0) {
               expect(date).toEqualMoment('2014-08-20T01:00:00')
               expect(date).toEqualMoment('2014-08-20T01:00:00')
 
 
-              $('#cal').fullCalendar('next')
-              $('#cal').fullCalendar('prev')
+              currentCalendar.next()
+              currentCalendar.prev()
 
 
               setTimeout(function() { // needed for IE8, for firing the second time, for some reason
               setTimeout(function() { // needed for IE8, for firing the second time, for some reason
                 $('#sidebar .event1').remove()
                 $('#sidebar .event1').remove()
@@ -329,14 +329,14 @@ describe('external drag and drop', function() {
       // Issue 2433
       // Issue 2433
       it('should not have drag handlers cleared when other calendar navigates', function() {
       it('should not have drag handlers cleared when other calendar navigates', function() {
         init()
         init()
-        var el1 = $('#cal')
+        var el1 = currentCalendar.el
         var el2 = $('<div id="cal2"/>').insertAfter(el1)
         var el2 = $('<div id="cal2"/>').insertAfter(el1)
         el2.fullCalendar(options)
         el2.fullCalendar(options)
 
 
         var docListenerCounter = new ListenerCounter(document)
         var docListenerCounter = new ListenerCounter(document)
         docListenerCounter.startWatching()
         docListenerCounter.startWatching()
 
 
-        el1.fullCalendar('next')
+        currentCalendar.next()
         expect(docListenerCounter.stopWatching()).toBe(0)
         expect(docListenerCounter.stopWatching()).toBe(0)
 
 
         el2.fullCalendar('destroy')
         el2.fullCalendar('destroy')

+ 33 - 58
tests/automated/legacy/firstDay.js

@@ -1,28 +1,19 @@
-
 describe('First Day', function() {
 describe('First Day', function() {
 
 
-  beforeEach(function() {
-    affix('#cal')
-  })
-
   describe('when using default settings', function() {
   describe('when using default settings', function() {
-    beforeEach(function() {
-      $('#cal').fullCalendar()
-    })
     it('should make Sunday the first day of the week', function() {
     it('should make Sunday the first day of the week', function() {
+      initCalendar()
       var dayFirst = $('.fc-day-header')[0]
       var dayFirst = $('.fc-day-header')[0]
       expect(dayFirst).toHaveClass('fc-sun')
       expect(dayFirst).toHaveClass('fc-sun')
     })
     })
   })
   })
 
 
   describe('when setting firstDay to 0', function() {
   describe('when setting firstDay to 0', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 0
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 0
     })
     })
     it('should make Sunday the first day of the week', function() {
     it('should make Sunday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-sun')
       expect(daysOfWeek[0]).toHaveClass('fc-sun')
       expect(daysOfWeek[1]).toHaveClass('fc-mon')
       expect(daysOfWeek[1]).toHaveClass('fc-mon')
@@ -35,13 +26,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 1', function() {
   describe('when setting firstDay to 1', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 1
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 1
     })
     })
     it('should make Monday the first day of the week', function() {
     it('should make Monday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[1]).toHaveClass('fc-tue')
       expect(daysOfWeek[1]).toHaveClass('fc-tue')
@@ -54,13 +43,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting weekNumberCalculation to ISO', function() {
   describe('when setting weekNumberCalculation to ISO', function() {
-    beforeEach(function() {
-      var options = {
-        weekNumberCalculation: 'ISO'
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      weekNumberCalculation: 'ISO'
     })
     })
     it('should make Monday the first day of the week', function() {
     it('should make Monday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[1]).toHaveClass('fc-tue')
       expect(daysOfWeek[1]).toHaveClass('fc-tue')
@@ -73,13 +60,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 2', function() {
   describe('when setting firstDay to 2', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 2
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 2
     })
     })
     it('should make Tuesday the first day of the week', function() {
     it('should make Tuesday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-tue')
       expect(daysOfWeek[0]).toHaveClass('fc-tue')
       expect(daysOfWeek[1]).toHaveClass('fc-wed')
       expect(daysOfWeek[1]).toHaveClass('fc-wed')
@@ -92,13 +77,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 3', function() {
   describe('when setting firstDay to 3', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 3
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 3
     })
     })
     it('should make Wednesday the first day of the week', function() {
     it('should make Wednesday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-wed')
       expect(daysOfWeek[0]).toHaveClass('fc-wed')
       expect(daysOfWeek[1]).toHaveClass('fc-thu')
       expect(daysOfWeek[1]).toHaveClass('fc-thu')
@@ -111,13 +94,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 4', function() {
   describe('when setting firstDay to 4', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 4
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 4
     })
     })
     it('should make Thursday the first day of the week', function() {
     it('should make Thursday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-thu')
       expect(daysOfWeek[0]).toHaveClass('fc-thu')
       expect(daysOfWeek[1]).toHaveClass('fc-fri')
       expect(daysOfWeek[1]).toHaveClass('fc-fri')
@@ -130,13 +111,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 5', function() {
   describe('when setting firstDay to 5', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 5
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 5
     })
     })
     it('should make Friday the first day of the week', function() {
     it('should make Friday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-fri')
       expect(daysOfWeek[0]).toHaveClass('fc-fri')
       expect(daysOfWeek[1]).toHaveClass('fc-sat')
       expect(daysOfWeek[1]).toHaveClass('fc-sat')
@@ -149,13 +128,11 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when setting firstDay to 6', function() {
   describe('when setting firstDay to 6', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 6
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 6
     })
     })
     it('should make Saturday the first day of the week', function() {
     it('should make Saturday the first day of the week', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-sat')
       expect(daysOfWeek[0]).toHaveClass('fc-sat')
       expect(daysOfWeek[1]).toHaveClass('fc-sun')
       expect(daysOfWeek[1]).toHaveClass('fc-sun')
@@ -169,13 +146,13 @@ describe('First Day', function() {
 
 
   describe('when new firstDay options are set', function() {
   describe('when new firstDay options are set', function() {
     it('should change the first day of week to Monday', function() {
     it('should change the first day of week to Monday', function() {
-      $('#cal').fullCalendar({
+      initCalendar({
         firstDay: 1
         firstDay: 1
       })
       })
       expect($('.fc-day-header')[0]).toHaveClass('fc-mon')
       expect($('.fc-day-header')[0]).toHaveClass('fc-mon')
     })
     })
-    it('shoule change the first day of week to Thursday', function() {
-      $('#cal').fullCalendar({
+    it('should change the first day of week to Thursday', function() {
+      initCalendar({
         firstDay: 4
         firstDay: 4
       })
       })
       expect($('.fc-day-header')[0]).toHaveClass('fc-thu')
       expect($('.fc-day-header')[0]).toHaveClass('fc-thu')
@@ -183,14 +160,12 @@ describe('First Day', function() {
   })
   })
 
 
   describe('when first day is set to Tuesday and isRTL is true', function() {
   describe('when first day is set to Tuesday and isRTL is true', function() {
-    beforeEach(function() {
-      var options = {
-        firstDay: 2,
-        isRTL: true
-      }
-      $('#cal').fullCalendar(options)
+    pushOptions({
+      firstDay: 2,
+      isRTL: true
     })
     })
     it('should put days mon, sun, sat ...', function() {
     it('should put days mon, sun, sat ...', function() {
+      initCalendar()
       var daysOfWeek = $('.fc-day-header')
       var daysOfWeek = $('.fc-day-header')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[0]).toHaveClass('fc-mon')
       expect(daysOfWeek[1]).toHaveClass('fc-sun')
       expect(daysOfWeek[1]).toHaveClass('fc-sun')
@@ -203,7 +178,7 @@ describe('First Day', function() {
   })
   })
 
 
   it('should have a different default value based on the locale', function() {
   it('should have a different default value based on the locale', function() {
-    $('#cal').fullCalendar({
+    initCalendar({
       locale: 'en-gb'
       locale: 'en-gb'
     })
     })
     // firstDay will be 1 (Monday) in Great Britain
     // firstDay will be 1 (Monday) in Great Britain

+ 12 - 13
tests/automated/legacy/select-callback.js

@@ -3,7 +3,6 @@ describe('select callback', function() {
   var options
   var options
 
 
   beforeEach(function() {
   beforeEach(function() {
-    affix('#cal')
     options = {
     options = {
       defaultDate: '2014-05-25',
       defaultDate: '2014-05-25',
       selectable: true,
       selectable: true,
@@ -12,7 +11,7 @@ describe('select callback', function() {
   })
   })
 
 
   afterEach(function() {
   afterEach(function() {
-    $('#cal').fullCalendar('destroy')
+    currentCalendar.destroy()
   });
   });
 
 
   [ false, true ].forEach(function(isRTL) {
   [ false, true ].forEach(function(isRTL) {
@@ -36,7 +35,7 @@ describe('select callback', function() {
             expect(end).toEqualMoment('2014-05-07')
             expect(end).toEqualMoment('2014-05-07')
           }
           }
           spyOn(options, 'select').and.callThrough()
           spyOn(options, 'select').and.callThrough()
-          $('#cal').fullCalendar(options)
+          initCalendar(options)
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
             end: '.fc-day[data-date="2014-05-06"]',
             end: '.fc-day[data-date="2014-05-06"]',
             callback: function() {
             callback: function() {
@@ -57,7 +56,7 @@ describe('select callback', function() {
             expect(end).toEqualMoment('2014-05-07')
             expect(end).toEqualMoment('2014-05-07')
           }
           }
           spyOn(options, 'select').and.callThrough()
           spyOn(options, 'select').and.callThrough()
-          $('#cal').fullCalendar(options)
+          initCalendar(options)
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
             isTouch: true,
             isTouch: true,
             delay: 200,
             delay: 200,
@@ -80,7 +79,7 @@ describe('select callback', function() {
             expect(end).toEqualMoment('2014-04-29')
             expect(end).toEqualMoment('2014-04-29')
           }
           }
           spyOn(options, 'select').and.callThrough()
           spyOn(options, 'select').and.callThrough()
-          $('#cal').fullCalendar(options)
+          initCalendar(options)
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
           $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
             end: '.fc-day[data-date="2014-04-28"]',
             end: '.fc-day[data-date="2014-04-28"]',
             callback: function() {
             callback: function() {
@@ -108,7 +107,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-30')
               expect(end).toEqualMoment('2014-05-30')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag', { // will be 2014-05-28 for LTR and RTL
             $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag', { // will be 2014-05-28 for LTR and RTL
               dx: $('.fc-sun').outerWidth() * (isRTL ? -1 : 1), // the width of one column
               dx: $('.fc-sun').outerWidth() * (isRTL ? -1 : 1), // the width of one column
               callback: function() {
               callback: function() {
@@ -129,7 +128,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-29')
               expect(end).toEqualMoment('2014-05-29')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag', { // will be 2014-05-28 for LTR and RTL
             $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag', { // will be 2014-05-28 for LTR and RTL
               callback: function() {
               callback: function() {
                 expect(options.select).toHaveBeenCalled()
                 expect(options.select).toHaveBeenCalled()
@@ -151,7 +150,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-28T10:30:00')
               expect(end).toEqualMoment('2014-05-28T10:30:00')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
               dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots
               dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots
               callback: function() {
               callback: function() {
@@ -172,7 +171,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-28T10:30:00')
               expect(end).toEqualMoment('2014-05-28T10:30:00')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             setTimeout(function() { // prevent scroll from being triggered, killing the select interaction
             setTimeout(function() { // prevent scroll from being triggered, killing the select interaction
               $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
               $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
                 isTouch: true,
                 isTouch: true,
@@ -197,7 +196,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-29T10:30:00')
               expect(end).toEqualMoment('2014-05-29T10:30:00')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
               dx: $('.fc-day-header:first').outerWidth() * 0.9 * (isRTL ? -1 : 1), // one day ahead
               dx: $('.fc-day-header:first').outerWidth() * 0.9 * (isRTL ? -1 : 1), // one day ahead
               dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots
               dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots
@@ -219,7 +218,7 @@ describe('select callback', function() {
               expect(end).toEqualMoment('2014-05-28T09:30:00')
               expect(end).toEqualMoment('2014-05-28T09:30:00')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
+            initCalendar(options)
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
             $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag', { // middle will be 2014-05-28T09:00:00
               callback: function() {
               callback: function() {
                 expect(options.select).toHaveBeenCalled()
                 expect(options.select).toHaveBeenCalled()
@@ -241,7 +240,7 @@ describe('select callback', function() {
       options.select = function() {}
       options.select = function() {}
       spyOn(options, 'select').and.callThrough()
       spyOn(options, 'select').and.callThrough()
 
 
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
 
 
       $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
       $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
         dx: 12,
         dx: 12,
@@ -257,7 +256,7 @@ describe('select callback', function() {
       options.select = function() {}
       options.select = function() {}
       spyOn(options, 'select').and.callThrough()
       spyOn(options, 'select').and.callThrough()
 
 
-      $('#cal').fullCalendar(options)
+      initCalendar(options)
 
 
       $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
       $('.fc-day[data-date="2014-04-28"]').simulate('drag', {
         dx: 8,
         dx: 8,

+ 31 - 32
tests/automated/legacy/select-method.js

@@ -3,7 +3,6 @@ describe('select method', function() {
   var options
   var options
 
 
   beforeEach(function() {
   beforeEach(function() {
-    affix('#cal')
     options = {
     options = {
       defaultDate: '2014-05-25',
       defaultDate: '2014-05-25',
       selectable: true
       selectable: true
@@ -11,7 +10,7 @@ describe('select method', function() {
   })
   })
 
 
   afterEach(function() {
   afterEach(function() {
-    $('#cal').fullCalendar('destroy')
+    currentCalendar.destroy()
   });
   });
 
 
   /*
   /*
@@ -34,13 +33,13 @@ describe('select method', function() {
         describe('when called with all-day moments', function() {
         describe('when called with all-day moments', function() {
           describe('when in bounds', function() {
           describe('when in bounds', function() {
             it('renders a selection', function() {
             it('renders a selection', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-07', '2014-05-09')
+              initCalendar(options)
+              currentCalendar.select('2014-05-07', '2014-05-09')
               expect($('.fc-highlight')).toBeVisible()
               expect($('.fc-highlight')).toBeVisible()
             })
             })
             it('renders a selection when called with one argument', function() {
             it('renders a selection when called with one argument', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-07')
+              initCalendar(options)
+              currentCalendar.select('2014-05-07')
               expect($('.fc-highlight')).toBeVisible()
               expect($('.fc-highlight')).toBeVisible()
             })
             })
             it('fires a selection event', function() {
             it('fires a selection event', function() {
@@ -51,15 +50,15 @@ describe('select method', function() {
                 expect(end).toEqualMoment('2014-05-09')
                 expect(end).toEqualMoment('2014-05-09')
               }
               }
               spyOn(options, 'select').and.callThrough()
               spyOn(options, 'select').and.callThrough()
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-07', '2014-05-09')
+              initCalendar(options)
+              currentCalendar.select('2014-05-07', '2014-05-09')
               expect(options.select).toHaveBeenCalled()
               expect(options.select).toHaveBeenCalled()
             })
             })
           })
           })
           describe('when out of bounds', function() {
           describe('when out of bounds', function() {
             it('doesn\'t render a selection', function() {
             it('doesn\'t render a selection', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2015-05-07', '2015-05-09')
+              initCalendar(options)
+              currentCalendar.select('2015-05-07', '2015-05-09')
               expect($('.fc-highlight')).not.toBeVisible()
               expect($('.fc-highlight')).not.toBeVisible()
             })
             })
             /*
             /*
@@ -70,8 +69,8 @@ describe('select method', function() {
                 expect(end).toEqualMoment('2014-05-09');
                 expect(end).toEqualMoment('2014-05-09');
               };
               };
               spyOn(options, 'select').and.callThrough();
               spyOn(options, 'select').and.callThrough();
-              $('#cal').fullCalendar(options);
-              $('#cal').fullCalendar('select', '2015-05-07', '2015-05-09');
+              initCalendar(options);
+              currentCalendar.select('2015-05-07', '2015-05-09');
               expect(options.select).not.toHaveBeenCalled();
               expect(options.select).not.toHaveBeenCalled();
             });
             });
             */
             */
@@ -79,8 +78,8 @@ describe('select method', function() {
         })
         })
         describe('when called with timed moments', function() {
         describe('when called with timed moments', function() {
           it('renders a selection', function() {
           it('renders a selection', function() {
-            $('#cal').fullCalendar(options)
-            $('#cal').fullCalendar('select', '2014-05-07T06:00:00', '2014-05-09T07:00:00')
+            initCalendar(options)
+            currentCalendar.select('2014-05-07T06:00:00', '2014-05-09T07:00:00')
             expect($('.fc-highlight')).toBeVisible()
             expect($('.fc-highlight')).toBeVisible()
           })
           })
           it('fires a selection event', function() {
           it('fires a selection event', function() {
@@ -91,8 +90,8 @@ describe('select method', function() {
               expect(end).toEqualMoment('2014-05-09T06:00:00')
               expect(end).toEqualMoment('2014-05-09T06:00:00')
             }
             }
             spyOn(options, 'select').and.callThrough()
             spyOn(options, 'select').and.callThrough()
-            $('#cal').fullCalendar(options)
-            $('#cal').fullCalendar('select', '2014-05-07T06:00:00', '2014-05-09T06:00:00')
+            initCalendar(options)
+            currentCalendar.select('2014-05-07T06:00:00', '2014-05-09T06:00:00')
             expect(options.select).toHaveBeenCalled()
             expect(options.select).toHaveBeenCalled()
           })
           })
         })
         })
@@ -106,13 +105,13 @@ describe('select method', function() {
         describe('when called with timed moments', function() {
         describe('when called with timed moments', function() {
           describe('when in bounds', function() {
           describe('when in bounds', function() {
             it('renders a selection when called with one argument', function() {
             it('renders a selection when called with one argument', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-26T06:00:00')
+              initCalendar(options)
+              currentCalendar.select('2014-05-26T06:00:00')
               expect($('.fc-highlight')).toBeVisible()
               expect($('.fc-highlight')).toBeVisible()
             })
             })
             it('renders a selection over the slot area', function() {
             it('renders a selection over the slot area', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-26T06:00:00', '2014-05-26T08:00:00')
+              initCalendar(options)
+              currentCalendar.select('2014-05-26T06:00:00', '2014-05-26T08:00:00')
               expect($('.fc-highlight')).toBeVisible()
               expect($('.fc-highlight')).toBeVisible()
               var slotAreaTop = $('.fc-time-grid-container').offset().top
               var slotAreaTop = $('.fc-time-grid-container').offset().top
               var overlayTop = $('.fc-highlight').offset().top
               var overlayTop = $('.fc-highlight').offset().top
@@ -121,8 +120,8 @@ describe('select method', function() {
           })
           })
           describe('when out of bounds', function() {
           describe('when out of bounds', function() {
             it('doesn\'t render a selection', function() {
             it('doesn\'t render a selection', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2015-05-26T06:00:00', '2015-05-26T07:00:00')
+              initCalendar(options)
+              currentCalendar.select('2015-05-26T06:00:00', '2015-05-26T07:00:00')
               expect($('.fc-highlight')).not.toBeVisible()
               expect($('.fc-highlight')).not.toBeVisible()
             })
             })
             /*
             /*
@@ -133,8 +132,8 @@ describe('select method', function() {
                 expect(end).toEqualMoment('2015-05-09T07:00:00');
                 expect(end).toEqualMoment('2015-05-09T07:00:00');
               };
               };
               spyOn(options, 'select').and.callThrough();
               spyOn(options, 'select').and.callThrough();
-              $('#cal').fullCalendar(options);
-              $('#cal').fullCalendar('select', '2015-05-07T06:00:00', '2015-05-09T07:00:00');
+              initCalendar(options);
+              currentCalendar.select('2015-05-07T06:00:00', '2015-05-09T07:00:00');
               expect(options.select).not.toHaveBeenCalled();
               expect(options.select).not.toHaveBeenCalled();
             });
             });
             */
             */
@@ -146,8 +145,8 @@ describe('select method', function() {
               options.allDaySlot = true
               options.allDaySlot = true
             })
             })
             it('renders a selection over the day area', function() {
             it('renders a selection over the day area', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28')
+              initCalendar(options)
+              currentCalendar.select('2014-05-26', '2014-05-28')
               expect($('.fc-highlight')).toBeVisible()
               expect($('.fc-highlight')).toBeVisible()
               var slotAreaTop = $('.fc-time-grid-container').offset().top
               var slotAreaTop = $('.fc-time-grid-container').offset().top
               var overlayTop = $('.fc-highlight').offset().top
               var overlayTop = $('.fc-highlight').offset().top
@@ -161,8 +160,8 @@ describe('select method', function() {
                 expect(end).toEqualMoment('2014-05-28')
                 expect(end).toEqualMoment('2014-05-28')
               }
               }
               spyOn(options, 'select').and.callThrough()
               spyOn(options, 'select').and.callThrough()
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28')
+              initCalendar(options)
+              currentCalendar.select('2014-05-26', '2014-05-28')
               expect(options.select).toHaveBeenCalled()
               expect(options.select).toHaveBeenCalled()
             })
             })
           })
           })
@@ -171,8 +170,8 @@ describe('select method', function() {
               options.allDaySlot = false
               options.allDaySlot = false
             })
             })
             it('doesn\'t render', function() {
             it('doesn\'t render', function() {
-              $('#cal').fullCalendar(options)
-              $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28')
+              initCalendar(options)
+              currentCalendar.select('2014-05-26', '2014-05-28')
               expect($('.fc-highlight')).not.toBeVisible()
               expect($('.fc-highlight')).not.toBeVisible()
             })
             })
             /*
             /*
@@ -185,8 +184,8 @@ describe('select method', function() {
                 expect(end).toEqualMoment('2014-05-28');
                 expect(end).toEqualMoment('2014-05-28');
               };
               };
               spyOn(options, 'select').and.callThrough();
               spyOn(options, 'select').and.callThrough();
-              $('#cal').fullCalendar(options);
-              $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28');
+              initCalendar(options);
+              currentCalendar.select('2014-05-26', '2014-05-28');
               expect(options.select).not.toHaveBeenCalled();
               expect(options.select).not.toHaveBeenCalled();
             });
             });
             */
             */