Răsfoiți Sursa

linting, and chamged names for a number of functions

kyle roux 7 ani în urmă
părinte
comite
d24212136c

+ 2 - 2
tests/automated/event-data/refetchEvents.js

@@ -1,5 +1,5 @@
-import { getScrollerEl} from '../lib/MonthViewUtils'
-import {getEventEls} from '../event-render/EventRenderUtils'
+import { getScrollerEl } from '../lib/MonthViewUtils'
+import { getEventEls } from '../event-render/EventRenderUtils'
 
 
 describe('refetchEvents', function() {
 describe('refetchEvents', function() {
 
 

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

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

+ 3 - 3
tests/automated/event-drag/repeating.js

@@ -1,5 +1,5 @@
 import * as TimeGridEventDragUtils from './TimeGridEventDragUtils'
 import * as TimeGridEventDragUtils from './TimeGridEventDragUtils'
-import {getEventEls, getVisibleEventEls} from '../event-render/EventRenderUtils'
+import { getVisibleEventEls, getFirstEventEl } from '../event-render/EventRenderUtils'
 
 
 describe('event dragging on repeating events', function() {
 describe('event dragging on repeating events', function() {
   pushOptions({
   pushOptions({
@@ -54,7 +54,7 @@ describe('event dragging on repeating events', function() {
       }
       }
     })
     })
 
 
-    getEventEls().first().simulate('drag', {
+    getFirstEventEl().simulate('drag', {
       dx: 100,
       dx: 100,
       duration: 100 // ample time for separate eventDragStart/eventDrop
       duration: 100 // ample time for separate eventDragStart/eventDrop
     })
     })
@@ -90,7 +90,7 @@ describe('event dragging on repeating events', function() {
       }
       }
     })
     })
 
 
-    getEventEls().first().simulate('drag', {
+    getFirstEventEl().simulate('drag', {
       dx: 100,
       dx: 100,
       duration: 100 // ample time for separate eventDragStart/eventDrop
       duration: 100 // ample time for separate eventDragStart/eventDrop
     })
     })

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

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

+ 4 - 4
tests/automated/event-render/TimeGridEventRenderUtils.js

@@ -1,6 +1,6 @@
-import {getDayEls} from '../view-render/DayGridRenderUtils'
-import {getTimeGridSlotEls} from '../lib/time-grid'
-import {getEventEls, getEventElTimeText} from './EventRenderUtils'
+import { getDayEls } from '../view-render/DayGridRenderUtils'
+import { getSlotEls } from '../lib/time-grid'
+import { getEventEls, getEventElTimeText } from './EventRenderUtils'
 
 
 export function getTimeTexts() {
 export function getTimeTexts() {
   return getEventEls().map(function(i, eventEl) {
   return getEventEls().map(function(i, eventEl) {
@@ -146,7 +146,7 @@ function computeDays() {
 
 
 
 
 function computeSlots() {
 function computeSlots() {
-  var slotEls = getTimeGridSlotEls()
+  var slotEls = getSlotEls()
 
 
   var slots = slotEls.map(function(i, node) {
   var slots = slotEls.map(function(i, node) {
     var rect = node.getBoundingClientRect()
     var rect = node.getBoundingClientRect()

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

@@ -1,4 +1,4 @@
-import {getEventEls} from './EventRenderUtils'
+import { getEventEls } from './EventRenderUtils'
 
 
 describe('eventOrder', function() {
 describe('eventOrder', function() {
   pushOptions({
   pushOptions({

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

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

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

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

+ 11 - 11
tests/automated/lib/dnd-resize-utils.js

@@ -1,6 +1,6 @@
 // this function has been mangled to work with external jqui draggables as well
 // this function has been mangled to work with external jqui draggables as well
-import {getEventElTimeEl, getTimeGridDayEls, getTimeGridSlotElByIndex} from './time-grid'
-import {getSingleDayEl} from '../view-render/DayGridRenderUtils'
+import { getEventElTimeEl, getTimeGridDayEls, getSlotElByIndex } from './time-grid'
+import { getDayEl } from '../view-render/DayGridRenderUtils'
 import {
 import {
   getEventElResizerEl,
   getEventElResizerEl,
   getEventElTitleEl,
   getEventElTitleEl,
@@ -35,12 +35,12 @@ export function testEventDrag(options, dropDate, expectSuccess, callback, eventC
       dragEl = getEventElTimeEl(eventEl)
       dragEl = getEventElTimeEl(eventEl)
       dayEl = getTimeGridDayEls(dropDate)
       dayEl = getTimeGridDayEls(dropDate)
       slatIndex = dropDate.hours() * 2 + (dropDate.minutes() / 30) // assumes slotDuration:'30:00'
       slatIndex = dropDate.hours() * 2 + (dropDate.minutes() / 30) // assumes slotDuration:'30:00'
-      slatEl = getTimeGridSlotElByIndex(slatIndex)
+      slatEl = getSlotElByIndex(slatIndex)
       expect(slatEl.length).toBe(1)
       expect(slatEl.length).toBe(1)
       dy = slatEl.offset().top - eventEl.offset().top
       dy = slatEl.offset().top - eventEl.offset().top
     } else {
     } else {
       dragEl = getEventElTitleEl(eventEl)
       dragEl = getEventElTitleEl(eventEl)
-      dayEl = getSingleDayEl(dropDate.clone())
+      dayEl = getDayEl(dropDate.clone())
       dy = dayEl.offset().top - eventEl.offset().top
       dy = dayEl.offset().top - eventEl.offset().top
     }
     }
 
 
@@ -117,11 +117,11 @@ export function testEventResize(options, resizeDate, expectSuccess, callback, ev
     if (resizeDate.hasTime()) {
     if (resizeDate.hasTime()) {
       lastDayEl = getTimeGridDayEls(resizeDate.clone())
       lastDayEl = getTimeGridDayEls(resizeDate.clone())
       lastSlatIndex = resizeDate.hours() * 2 + (resizeDate.minutes() / 30) // assumes slotDuration:'30:00'
       lastSlatIndex = resizeDate.hours() * 2 + (resizeDate.minutes() / 30) // assumes slotDuration:'30:00'
-      lastSlatEl = getTimeGridSlotElByIndex(lastSlatIndex - 1)
+      lastSlatEl = getSlotElByIndex(lastSlatIndex - 1)
       expect(lastSlatEl.length).toBe(1)
       expect(lastSlatEl.length).toBe(1)
-      dy = lastSlatEl.offset().top + lastSlatEl.outerHeight() - (eventEl.offset().top + eventEl.outerHeight())      
+      dy = lastSlatEl.offset().top + lastSlatEl.outerHeight() - (eventEl.offset().top + eventEl.outerHeight())
     } else {
     } else {
-      lastDayEl = getSingleDayEl(resizeDate.clone().add(-1, 'day'))
+      lastDayEl = getDayEl(resizeDate.clone().add(-1, 'day'))
       dy = lastDayEl.offset().top - eventEl.offset().top
       dy = lastDayEl.offset().top - eventEl.offset().top
     }
     }
 
 
@@ -193,16 +193,16 @@ export function testSelection(options, startTime, end, expectSuccess, callback)
     lastDayEl = getTimeGridDayEls(end)
     lastDayEl = getTimeGridDayEls(end)
     firstSlatIndex = start.hours() * 2 + (start.minutes() / 30) // assumes slotDuration:'30:00'
     firstSlatIndex = start.hours() * 2 + (start.minutes() / 30) // assumes slotDuration:'30:00'
     lastSlatIndex = end.hours() * 2 + (end.minutes() / 30) - 1 // assumes slotDuration:'30:00'
     lastSlatIndex = end.hours() * 2 + (end.minutes() / 30) - 1 // assumes slotDuration:'30:00'
-    firstSlatEl = getTimeGridSlotElByIndex(firstSlatIndex)
-    lastSlatEl = getTimeGridSlotElByIndex(lastSlatIndex)
+    firstSlatEl = getSlotElByIndex(firstSlatIndex)
+    lastSlatEl = getSlotElByIndex(lastSlatIndex)
     expect(firstSlatEl.length).toBe(1)
     expect(firstSlatEl.length).toBe(1)
     expect(lastSlatEl.length).toBe(1)
     expect(lastSlatEl.length).toBe(1)
     dy = lastSlatEl.offset().top - firstSlatEl.offset().top
     dy = lastSlatEl.offset().top - firstSlatEl.offset().top
     dragEl = firstSlatEl
     dragEl = firstSlatEl
   } else {
   } else {
     end.stripTime()
     end.stripTime()
-    firstDayEl = getSingleDayEl(start)
-    lastDayEl = getSingleDayEl(end.clone().add(-1, 'day'))
+    firstDayEl = getDayEl(start)
+    lastDayEl = getDayEl(end.clone().add(-1, 'day'))
     dy = lastDayEl.offset().top - firstDayEl.offset().top
     dy = lastDayEl.offset().top - firstDayEl.offset().top
     dragEl = firstDayEl
     dragEl = firstDayEl
   }
   }

+ 5 - 5
tests/automated/lib/time-grid.js

@@ -83,7 +83,7 @@ targetTime is a time (duration) that can be in between slots
 export function getTimeGridTop(targetTime) {
 export function getTimeGridTop(targetTime) {
   let slotEl
   let slotEl
   targetTime = moment.duration(targetTime)
   targetTime = moment.duration(targetTime)
-  let slotEls = getTimeGridDurationSlotEls(targetTime)
+  let slotEls = getSlotElByTime(targetTime)
   const topBorderWidth = 1 // TODO: kill
   const topBorderWidth = 1 // TODO: kill
 
 
   // exact slot match
   // exact slot match
@@ -91,7 +91,7 @@ export function getTimeGridTop(targetTime) {
     return slotEls.eq(0).offset().top + topBorderWidth
     return slotEls.eq(0).offset().top + topBorderWidth
   }
   }
 
 
-  slotEls = getTimeGridSlotEls() // all slots
+  slotEls = getSlotEls() // all slots
   let slotTime = null
   let slotTime = null
   let prevSlotTime = null
   let prevSlotTime = null
 
 
@@ -139,16 +139,16 @@ export function getTimeGridDayEls(date) {
   return $('.fc-time-grid .fc-day[data-date="' + date.format('YYYY-MM-DD') + '"]')
   return $('.fc-time-grid .fc-day[data-date="' + date.format('YYYY-MM-DD') + '"]')
 }
 }
 
 
-export function getTimeGridSlotEls() {
+export function getSlotEls() {
   return $('.fc-time-grid .fc-slats tr[data-time]')
   return $('.fc-time-grid .fc-slats tr[data-time]')
 }
 }
 
 
 
 
-export function getTimeGridSlotElByIndex(index) {
+export function getSlotElByIndex(index) {
   return $(`.fc-slats tr:eq(${index})`)
   return $(`.fc-slats tr:eq(${index})`)
 }
 }
 
 
-export function getTimeGridDurationSlotEls(timeDuration) {
+export function getSlotElByTime(timeDuration) {
   timeDuration = moment.duration(timeDuration)
   timeDuration = moment.duration(timeDuration)
   const date = FullCalendar.moment.utc('2016-01-01').time(timeDuration)
   const date = FullCalendar.moment.utc('2016-01-01').time(timeDuration)
   if (date.date() === 1) { // ensure no time overflow/underflow
   if (date.date() === 1) { // ensure no time overflow/underflow

+ 4 - 5
tests/automated/view-render/DayGridRenderUtils.js

@@ -1,9 +1,8 @@
 
 
-export function getSingleDayEl(date) {
+export function getDayEl(date) {
   date = date.isMoment ? date : FullCalendar.moment.parseZone(date)
   date = date.isMoment ? date : FullCalendar.moment.parseZone(date)
-  var els = $(`.fc-day-grid .fc-bg .fc-day[data-date="${date.format('YYYY-MM-DD')}"]`)
-  expect(els).toHaveLength(1)
-  return els
+  var el = $(`.fc-day-grid .fc-bg .fc-day[data-date="${date.format('YYYY-MM-DD')}"]`)
+  return el
 }
 }
 
 
 
 
@@ -19,4 +18,4 @@ export function getDayEls() {
 
 
 export function getDayTdEls(date) {
 export function getDayTdEls(date) {
   return $(`td[data-date="${date}"]`)
   return $(`td[data-date="${date}"]`)
-}
+}