acerix 8 лет назад
Родитель
Сommit
69f20576be
2 измененных файлов с 20 добавлено и 21 удалено
  1. 19 19
      tests/legacy/selectAllow.js
  2. 1 2
      tests/lib/time-grid.js

+ 19 - 19
tests/legacy/selectAllow.js

@@ -1,28 +1,26 @@
 import { selectTimeGrid } from '../lib/time-grid'
 
 describe('selectAllow', function() {
-  var options
-
-  beforeEach(function() {
-    options = {
-      now: '2016-09-04',
-      defaultView: 'agendaWeek',
-      scrollTime: '00:00',
-      selectable: true
-    }
-    affix('#cal')
+
+  pushOptions({
+    now: '2016-09-04',
+    defaultView: 'agendaWeek',
+    scrollTime: '00:00',
+    selectable: true
   })
 
   it('disallows selecting when returning false', function(done) { // and given correct params
-    options.selectAllow = function(selectInfo) {
-      expect(typeof selectInfo).toBe('object')
-      expect(moment.isMoment(selectInfo.start)).toBe(true)
-      expect(moment.isMoment(selectInfo.end)).toBe(true)
-      return false
+    var options = {
+      selectAllow: function(selectInfo) {
+        expect(typeof selectInfo).toBe('object')
+        expect(moment.isMoment(selectInfo.start)).toBe(true)
+        expect(moment.isMoment(selectInfo.end)).toBe(true)
+        return false
+      }
     }
     spyOn(options, 'selectAllow').and.callThrough()
 
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
 
     selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
       .then(function(selectInfo) {
@@ -33,12 +31,14 @@ describe('selectAllow', function() {
   })
 
   it('allows selecting when returning true', function(done) {
-    options.selectAllow = function(selectInfo) {
-      return true
+    var options = {
+      selectAllow: function(selectInfo) {
+        return true
+      }
     }
     spyOn(options, 'selectAllow').and.callThrough()
 
-    $('#cal').fullCalendar(options)
+    initCalendar(options)
 
     selectTimeGrid('2016-09-04T01:00:00', '2016-09-04T05:00:00')
       .then(function(selectInfo) {

+ 1 - 2
tests/lib/time-grid.js

@@ -24,10 +24,9 @@ export function dragTimeGridEvent(eventEl, dropDate) {
 
 export function selectTimeGrid(start, inclusiveEnd) {
   return new Promise(function(resolve) {
-    var calendar = $('#cal').fullCalendar('getCalendar')
     var selectInfo = null
 
-    calendar.on('select', function(start, end) {
+    currentCalendar.on('select', function(start, end) {
       selectInfo = { start: start, end: end }
     })