cronofy-elements
Advanced tools
Comparing version 1.42.0 to 1.42.1
{ | ||
"name": "cronofy-elements", | ||
"version": "1.42.0", | ||
"version": "1.42.1", | ||
"description": "Fast track scheduling with Cronofy's embeddable UI Elements", | ||
@@ -5,0 +5,0 @@ "main": "build/npm/CronofyElements.js", |
@@ -94,3 +94,8 @@ import moment from "moment-timezone"; | ||
if (!action.slots.length > 0) { | ||
return state; | ||
const monthsLoading = removeMonthFromLoading(state.monthsLoading, action.month); | ||
return { | ||
...state, | ||
monthsLoading, | ||
slotFetchCount: state.slotFetchCount + 1, | ||
}; | ||
} | ||
@@ -97,0 +102,0 @@ |
@@ -80,3 +80,3 @@ import moment from "moment-timezone"; | ||
const currentMonth = | ||
current && moment(current, "YYYY-MM").isBetween(startMonth, endMonth) | ||
current && moment(current, "YYYY-MM").isBetween(startMonth, endMonth, "month", "[]") | ||
? current | ||
@@ -83,0 +83,0 @@ : monthStrings[0]; |
@@ -343,2 +343,41 @@ import { statusReducer } from "../../../src/js/components/DateTimePicker/contexts/status-reducer"; | ||
it("sets slots when there are no slots", () => { | ||
const oldState = { | ||
...startingState, | ||
slots: {}, | ||
availableDays: [], | ||
slotFetchCount: 0, | ||
slotInjectionPoint: undefined, | ||
}; | ||
const result = statusReducer(oldState, { | ||
type: "SET_SLOTS", | ||
slots: [], | ||
month: "2021-09", | ||
tzid: "Europe/London", | ||
}); | ||
delete oldState.slots; | ||
delete oldState.availableDays; | ||
delete oldState.slotFetchCount; | ||
delete oldState.slotInjectionPoint; | ||
const { | ||
slots, | ||
availableDays, | ||
slotFetchCount, | ||
slotInjectionPoint, | ||
...newState | ||
} = result; | ||
// These values have been updated | ||
expect(slots).toStrictEqual({}); | ||
expect(availableDays).toStrictEqual([]); | ||
expect(slotFetchCount).toBe(1); | ||
expect(slotInjectionPoint).toBe(undefined); | ||
// All other values are unchanged | ||
expect(newState).toStrictEqual(oldState); | ||
}); | ||
it("sets additional slots", () => { | ||
@@ -345,0 +384,0 @@ const oldState = { |
import * as utils from "../../src/js/components/DateTimePicker/utils/slots"; | ||
import { rawSlots } from "./dummy-data"; | ||
import moment from "moment-timezone"; | ||
@@ -432,4 +433,49 @@ describe("DateTimePicker utils", () => { | ||
}); | ||
it("returns with the correct month set to current when selectedDay is set", () => { | ||
const selectedDay = "2021-07"; | ||
const query = { | ||
query_periods, | ||
}; | ||
const expected = [ | ||
{ | ||
month: "2021-06", | ||
current: false, | ||
query: { | ||
query_periods: [ | ||
{ | ||
end: "2021-06-12T23:00:00Z", | ||
start: "2021-06-11T00:00:00Z", | ||
}, | ||
{ | ||
end: "2021-06-30T23:59:00Z", | ||
start: "2021-06-13T00:00:00Z", | ||
}, | ||
], | ||
max_results: 512, | ||
}, | ||
}, | ||
{ | ||
month: "2021-07", | ||
current: true, | ||
query: { | ||
query_periods: [ | ||
{ | ||
end: "2021-07-14T23:00:00Z", | ||
start: "2021-07-01T00:00:00Z", | ||
}, | ||
], | ||
max_results: 512, | ||
}, | ||
}, | ||
]; | ||
const actual = utils.getMonthObjectsFromQuery(query, tzid, selectedDay); | ||
expect(actual).toEqual(expected); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3242377
26507