Skip to content

Commit

Permalink
manual lint test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Nov 10, 2020
1 parent 4f348e4 commit 9a0e1ec
Show file tree
Hide file tree
Showing 55 changed files with 440 additions and 430 deletions.
8 changes: 4 additions & 4 deletions packages/__tests__/src/date-selection/implicit-unselect.ts
Expand Up @@ -11,10 +11,10 @@ describe('implicit unselection', () => {

initCalendar({
select() {
selectFired++
selectFired += 1
},
unselect() {
unselectFired++
unselectFired += 1
},
})

Expand All @@ -33,10 +33,10 @@ describe('implicit unselection', () => {

initCalendar({
select() {
selectFired++
selectFired += 1
},
unselect() {
unselectFired++
unselectFired += 1
},
})

Expand Down
18 changes: 13 additions & 5 deletions packages/__tests__/src/datelib/main.ts
@@ -1,5 +1,13 @@
import { DateEnv, createFormatter, createDuration, startOfDay, diffWholeWeeks, diffWholeDays, diffDayAndTime, Calendar } from '@fullcalendar/core'

import {
DateEnv,
createFormatter,
createDuration,
startOfDay,
diffWholeWeeks,
diffWholeDays,
diffDayAndTime,
Calendar,
} from '@fullcalendar/core'
import dayGridPlugin from '@fullcalendar/daygrid'
import { getDSTDeadZone } from '../lib/dst-dead-zone'
import { formatPrettyTimeZoneOffset, formatIsoTimeZoneOffset, formatIsoWithoutTz } from '../lib/datelib-utils'
Expand Down Expand Up @@ -230,13 +238,13 @@ describe('datelib', () => {
})

it('works with different days of same month, with inprecise formatter', () => {
let formatter = createFormatter({
let otherFormatter = createFormatter({
month: 'long',
year: 'numeric',
})
let m0 = env.createMarker('2018-06-08')
let m1 = env.createMarker('2018-06-09')
let s = env.formatRange(m0, m1, formatter)
let s = env.formatRange(m0, m1, otherFormatter)
expect(s).toBe('June 2018')
})

Expand Down Expand Up @@ -518,7 +526,7 @@ describe('datelib', () => {
let deadZone = getDSTDeadZone()

if (!deadZone) {
console.log('could not determine DST dead zone')
console.log('could not determine DST dead zone') // eslint-disable-line no-console
} else {
// use a utc date to get a ISO8601 string representation of the start of the dead zone
let utcDate = new Date(Date.UTC(
Expand Down
2 changes: 1 addition & 1 deletion packages/__tests__/src/event-data/Event.mutation.ts
Expand Up @@ -12,7 +12,7 @@ describe('event mutations on non-instances', () => {
let renderCnt = 0
let calendar = initCalendar({
eventContent(arg) {
renderCnt++
renderCnt += 1
if (renderCnt === 2) {
arg.event.setStart('2018-08-04')
arg.event.setEnd('2018-10-04')
Expand Down
2 changes: 1 addition & 1 deletion packages/__tests__/src/event-data/dynamic-options.ts
Expand Up @@ -5,7 +5,7 @@ describe('setting option dynamically', () => {
initCalendar({
initialView: 'dayGridMonth',
events(arg, callback) {
fetchCnt++
fetchCnt += 1
callback([])
},
})
Expand Down
6 changes: 3 additions & 3 deletions packages/__tests__/src/event-data/eventDataTransform.ts
@@ -1,9 +1,9 @@
describe('eventDataTransform', () => {
let transform = function (raw) {
return $.extend({}, raw, {
let transform = (raw) => (
$.extend({}, raw, {
was_processed: true,
})
}
)

describeOptions({
'when on the calendar': {
Expand Down
4 changes: 2 additions & 2 deletions packages/__tests__/src/event-data/events-function.ts
Expand Up @@ -86,12 +86,12 @@ describe('events as a function', () => {
loadingCallArgs.push(bool)
},
eventSources: [
function (arg, callback) {
(arg, callback) => {
setTimeout(() => {
callback([])
}, 0)
},
function (arg, callback) {
(arg, callback) => {
setTimeout(() => {
callback([])
}, 10)
Expand Down
10 changes: 4 additions & 6 deletions packages/__tests__/src/event-data/lazyFetching.ts
Expand Up @@ -11,9 +11,8 @@ describe('lazyFetching', () => {
})

it('won\'t fetch weeks already queried', () => {
let arg
let options = {
events(arg, callback) {
events(fetchInfo, callback) {
callback([])
},
}
Expand All @@ -27,7 +26,7 @@ describe('lazyFetching', () => {

expect(options.events.calls.count()).toBe(1)

arg = options.events.calls.argsFor(0)[0]
let arg = options.events.calls.argsFor(0)[0]
expect(arg.start).toEqualDate('2017-10-01T00:00:00Z')
expect(arg.end).toEqualDate('2017-11-12T00:00:00Z')
})
Expand All @@ -39,9 +38,8 @@ describe('lazyFetching', () => {
})

it('will fetch each new week range', () => {
let arg
let options = {
events(arg, callback) {
events(fetchInfo, callback) {
callback([])
},
}
Expand All @@ -55,7 +53,7 @@ describe('lazyFetching', () => {

expect(options.events.calls.count()).toBe(5)

arg = options.events.calls.argsFor(0)[0]
let arg = options.events.calls.argsFor(0)[0]
expect(arg.start).toEqualDate('2017-10-01T00:00:00Z')
expect(arg.end).toEqualDate('2017-11-12T00:00:00Z')

Expand Down
3 changes: 2 additions & 1 deletion packages/__tests__/src/event-drag/between-calendars.ts
Expand Up @@ -41,6 +41,7 @@ describe('dragging events between calendars', () => {
it('fires all triggers', (done) => {
let triggerNames = []
let eventAllowCalled = false
let eventEl

calendar0 = new Calendar(el0, {
plugins: [interactionPlugin, dayGridPlugin],
Expand Down Expand Up @@ -93,7 +94,7 @@ describe('dragging events between calendars', () => {
let dayGridWrapper0 = new DayGridViewWrapper(calendar0).dayGrid
let dayGridWrapper1 = new DayGridViewWrapper(calendar1).dayGrid

let eventEl = dayGridWrapper0.getEventEls()[0]
eventEl = dayGridWrapper0.getEventEls()[0]
let dayEl = dayGridWrapper1.getDayEls('2019-01-05')[0]
let point1 = getRectCenter(dayEl.getBoundingClientRect())

Expand Down
6 changes: 4 additions & 2 deletions packages/__tests__/src/event-drag/repeating.ts
Expand Up @@ -42,6 +42,7 @@ describe('event dragging on repeating events', () => {
})

it('hides other repeating events when dragging', (done) => {
let dayGridWrapper
let calendar = initCalendar({
eventDragStart() {
setTimeout(() => { // try go execute DURING the drag
Expand All @@ -55,8 +56,8 @@ describe('event dragging on repeating events', () => {
}, 10)
},
})
let dayGridWrapper = new DayGridViewWrapper(calendar).dayGrid

dayGridWrapper = new DayGridViewWrapper(calendar).dayGrid
$(dayGridWrapper.getFirstEventEl()).simulate('drag', {
dx: 100,
duration: 100, // ample time for separate eventDragStart/eventDrop
Expand All @@ -65,6 +66,7 @@ describe('event dragging on repeating events', () => {

// inverse of above test
it('doesnt accidentally hide all non-id events when dragging', (done) => {
let dayGridWrapper
let calendar = initCalendar({
events: [
{
Expand All @@ -90,8 +92,8 @@ describe('event dragging on repeating events', () => {
}, 10)
},
})
let dayGridWrapper = new DayGridViewWrapper(calendar).dayGrid

dayGridWrapper = new DayGridViewWrapper(calendar).dayGrid
$(dayGridWrapper.getFirstEventEl()).simulate('drag', {
dx: 100,
duration: 100, // ample time for separate eventDragStart/eventDrop
Expand Down
12 changes: 6 additions & 6 deletions packages/__tests__/src/event-resize/mirror-hooks.ts
Expand Up @@ -26,17 +26,17 @@ describe('event resize mirror', () => {
let calendar = initCalendar({
eventDidMount(info) {
if (info.isMirror) {
mirrorMountCalls++
mirrorMountCalls += 1
}
},
eventContent(info) {
if (info.isMirror) {
mirrorContentCalls++
mirrorContentCalls += 1
}
},
eventWillUnmount(info) {
if (info.isMirror) {
mirrorUnmountCalls++
mirrorUnmountCalls += 1
}
},
})
Expand Down Expand Up @@ -76,17 +76,17 @@ describe('event resize mirror', () => {
let calendar = initCalendar({
eventDidMount(info) {
if (info.isMirror) {
mirrorMountCalls++
mirrorMountCalls += 1
}
},
eventContent(info) {
if (info.isMirror) {
mirrorContentCalls++
mirrorContentCalls += 1
}
},
eventWillUnmount(info) {
if (info.isMirror) {
mirrorUnmountCalls++
mirrorUnmountCalls += 1
}
},
})
Expand Down
6 changes: 2 additions & 4 deletions packages/__tests__/src/event-source/eventSourceSuccess.ts
@@ -1,15 +1,13 @@
describe('eventSourceSuccess', () => {
const FETCH_FUNC = function (info, successCallback) {
const FETCH_FUNC = (info, successCallback) => {
successCallback({
something: [
{ title: 'hi', start: '2018-10-01' },
],
})
}

const TRANSFORM = function (input) {
return input.something
}
const TRANSFORM = (input) => input.something

pushOptions({
initialDate: '2018-10-01',
Expand Down
4 changes: 2 additions & 2 deletions packages/__tests__/src/event-source/refetch.ts
Expand Up @@ -108,10 +108,10 @@ describe('event source refetch', () => {
}

function createEventGenerator(classNamePrefix, fetchConfig) {
return function (arg, callback) {
return (arg, callback) => {
let events = []

for (let i = 0; i < fetchConfig.eventCount; i++) {
for (let i = 0; i < fetchConfig.eventCount; i += 1) {
events.push({
start: '2015-08-07T02:00:00',
end: '2015-08-07T03:00:00',
Expand Down
4 changes: 2 additions & 2 deletions packages/__tests__/src/legacy/ListView.ts
Expand Up @@ -45,7 +45,7 @@ describe('ListView rendering', () => {

initCalendar({
eventDidMount() {
eventMountCnt++
eventMountCnt += 1
},
})

Expand All @@ -57,7 +57,7 @@ describe('ListView rendering', () => {

initCalendar({
eventWillUnmount() {
callCnt++
callCnt += 1
},
})

Expand Down
10 changes: 5 additions & 5 deletions packages/__tests__/src/legacy/aspectRatio.ts
Expand Up @@ -46,7 +46,7 @@ describe('aspectRatio', () => {
let viewContainerEl = new CalendarWrapper(calendar).getViewContainerEl()

let rect = viewContainerEl.getBoundingClientRect()
let ratio = Math.round(rect.width / rect.height * 100)
let ratio = Math.round((rect.width / rect.height) * 100)
expect(Math.round(ratio)).toEqual(200)
})
})
Expand All @@ -69,7 +69,7 @@ describe('aspectRatio', () => {
let viewContainerEl = new CalendarWrapper(calendar).getViewContainerEl()

let rect = viewContainerEl.getBoundingClientRect()
let ratio = Math.round(rect.width / rect.height * 100)
let ratio = Math.round((rect.width / rect.height) * 100)
expect(Math.round(ratio)).toEqual(100)
})
})
Expand All @@ -92,7 +92,7 @@ describe('aspectRatio', () => {
let viewContainerEl = new CalendarWrapper(calendar).getViewContainerEl()

let rect = viewContainerEl.getBoundingClientRect()
let ratio = Math.round(rect.width / rect.height * 100)
let ratio = Math.round((rect.width / rect.height) * 100)
expect(Math.round(ratio)).toEqual(50)
})
})
Expand All @@ -115,7 +115,7 @@ describe('aspectRatio', () => {
let viewContainerEl = new CalendarWrapper(calendar).getViewContainerEl()

let rect = viewContainerEl.getBoundingClientRect()
let ratio = Math.round(rect.width / rect.height * 100)
let ratio = Math.round((rect.width / rect.height) * 100)
expect(Math.round(ratio)).toEqual(50)
})
})
Expand All @@ -138,7 +138,7 @@ describe('aspectRatio', () => {
let viewContainerEl = new CalendarWrapper(calendar).getViewContainerEl()

let rect = viewContainerEl.getBoundingClientRect()
let ratio = Math.round(rect.width / rect.height * 100)
let ratio = Math.round((rect.width / rect.height) * 100)
expect(Math.round(ratio)).toEqual(50)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/__tests__/src/legacy/dayNames.ts
Expand Up @@ -38,7 +38,7 @@ describe('day names', () => {
})
})

$.each(locales, (index, locale) => {
$.each(locales, (localeIndex, locale) => {
describe('when locale is ' + locale, () => {
CalendarWrapper.DOW_CLASSNAMES.forEach((dowClassName, index) => {
let dayDate = addDays(sundayDate, index)
Expand Down
2 changes: 1 addition & 1 deletion packages/__tests__/src/legacy/dayRender.ts
Expand Up @@ -75,7 +75,7 @@ describe('dayCellDidMount', () => { // TODO: rename file
expect(arg.date instanceof Date).toBe(true)
expect(arg.el instanceof HTMLElement).toBe(true)
expect(typeof arg.view).toBe('object')
callCnt++
callCnt += 1
},
}

Expand Down
2 changes: 1 addition & 1 deletion packages/__tests__/src/legacy/destroy.ts
Expand Up @@ -70,7 +70,7 @@ describe('destroy', () => {

// Issue 2432
it('preserves existing window handlers when handleWindowResize is off', () => {
let resizeHandler = function () {}
let resizeHandler = () => {}
let windowListenerCounter = new ListenerCounter(window)
windowListenerCounter.startWatching()

Expand Down
4 changes: 2 additions & 2 deletions packages/__tests__/src/legacy/event-dnd.ts
Expand Up @@ -17,12 +17,12 @@ describe('eventDrop', () => {
describe('when in month view', () => {
pushOptions({
initialView: 'dayGridMonth',
})
});

// TODO: test that event's dragged via touch that don't wait long enough for longPressDelay
// SHOULD NOT drag

;[false, true].forEach((isTouch) => {
[false, true].forEach((isTouch) => {
describe('with ' + (isTouch ? 'touch' : 'mouse'), () => {
describe('when dragging an all-day event to another day', () => {
it('should be given correct arguments, with whole-day delta', (done) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/__tests__/src/legacy/eventDestroy.ts
Expand Up @@ -11,7 +11,8 @@ describe('eventWillUnmount', () => { // TODO: rename file
let calendar = initCalendar({
events: [singleEventData],
eventWillUnmount(arg) {
if (callCnt++ === 0) { // only care about the first call. gets called again when calendar is destroyed
callCnt += 1
if (callCnt === 1) { // only care about the first call. gets called again when calendar is destroyed
expect(arg.event.id).toBe(singleEventData.id)
done()
}
Expand Down

0 comments on commit 9a0e1ec

Please sign in to comment.