@moltenship/calendar-testing 0.0.0-stage → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/index.d.mts +664 -0
- package/dist/index.mjs +1643 -0
- package/package.json +52 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import { RecurrenceDate, RecurrencePeriod, RecurrenceRule, RecurringCalendarEvent } from "@moltenship/calendar-recurrence";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
|
+
import { AllDayCalendarEvent, AnyCalendarView, CalendarAnnouncementMessages, CalendarAvailability, CalendarClock, CalendarDiagnostic, CalendarDirection, CalendarEvent, CalendarEventChange, CalendarEventChangeHandler, CalendarEventProposal, CalendarFactory, CalendarFocus, CalendarMeta, CalendarPendingChanges, CalendarProposalDetail, CalendarPublicState, CalendarResource, CalendarRootProps, CalendarSelection, CalendarSemanticActions, CalendarTransactionResult, CalendarWeekRules, EventId, IsoDayOfWeek, ResourceAvailability, ResourceId, TimedCalendarEvent } from "@moltenship/calendar";
|
|
4
|
+
//#region src/environment.d.ts
|
|
5
|
+
/** A point in time: an `Instant`, a `ZonedDateTime`, or ISO text. */
|
|
6
|
+
type DateTimeInput = Temporal.Instant | Temporal.ZonedDateTime | string;
|
|
7
|
+
/** A date: a `PlainDate` or ISO text such as `"2026-10-08"`. */
|
|
8
|
+
type DateInput = Temporal.PlainDate | string;
|
|
9
|
+
interface TestEnvironmentOptions {
|
|
10
|
+
/** The current instant: exact, or a wall time on `timeZone`. Defaults to 8 October 2026, noon UTC. */
|
|
11
|
+
readonly now?: DateTimeInput;
|
|
12
|
+
/** The display time zone. Defaults to `"UTC"`. */
|
|
13
|
+
readonly timeZone?: string;
|
|
14
|
+
readonly locale?: string;
|
|
15
|
+
readonly weekRules?: CalendarWeekRules;
|
|
16
|
+
readonly direction?: CalendarDirection;
|
|
17
|
+
/** The date the calendar opens on. Defaults to `today`. */
|
|
18
|
+
readonly anchorDate?: DateInput;
|
|
19
|
+
}
|
|
20
|
+
/** The `Root` props a test environment fixes. */
|
|
21
|
+
interface TestEnvironmentRootProps {
|
|
22
|
+
readonly defaultAnchorDate: Temporal.PlainDate;
|
|
23
|
+
readonly defaultTimeZone: string;
|
|
24
|
+
readonly direction: CalendarDirection;
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
readonly now: Temporal.Instant;
|
|
27
|
+
readonly weekRules: CalendarWeekRules;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A fixed now, time zone, locale, week rules and direction. `Root` reads the current time only
|
|
31
|
+
* from `now` or `clock` and the zone from `timeZone`, so passing `rootProps` makes a calendar
|
|
32
|
+
* deterministic without patching any global.
|
|
33
|
+
*/
|
|
34
|
+
interface TestEnvironment {
|
|
35
|
+
readonly anchorDate: Temporal.PlainDate;
|
|
36
|
+
readonly direction: CalendarDirection;
|
|
37
|
+
readonly locale: string;
|
|
38
|
+
readonly now: Temporal.Instant;
|
|
39
|
+
readonly rootProps: TestEnvironmentRootProps;
|
|
40
|
+
readonly timeZone: string;
|
|
41
|
+
/** `now`'s date in `timeZone`. */
|
|
42
|
+
readonly today: Temporal.PlainDate;
|
|
43
|
+
readonly weekRules: CalendarWeekRules;
|
|
44
|
+
/**
|
|
45
|
+
* An instant on the environment's clock: a time such as `"09:00"` is today's, a date and time
|
|
46
|
+
* such as `"2026-10-09T09:00"` a wall time in `timeZone`, and exact text stays as it is.
|
|
47
|
+
*/
|
|
48
|
+
at(value: DateTimeInput): Temporal.Instant;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Builds a deterministic environment. Every option has a default: Thursday 8 October 2026 at noon
|
|
52
|
+
* UTC, `"en-US"`, weeks from Monday (`{ firstDay: 1, minimalDays: 4, weekend: [6, 7] }`), left to
|
|
53
|
+
* right.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createTestEnvironment(options?: TestEnvironmentOptions): TestEnvironment;
|
|
56
|
+
/** A `CalendarClock` a test moves by hand. */
|
|
57
|
+
interface TestClock extends CalendarClock {
|
|
58
|
+
/** Moves the clock by a duration of hours or smaller units, such as `{ minutes: 5 }`. */
|
|
59
|
+
advance(duration: Temporal.DurationLike | string): Temporal.Instant;
|
|
60
|
+
set(instant: DateTimeInput): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A clock for `Root`'s `clock` prop, or the harness's `clock` option, starting at `start`
|
|
64
|
+
* (8 October 2026 at noon UTC by default). Text without a zone or offset is a UTC wall time. `Root`
|
|
65
|
+
* and `useNow` sample a clock on an interval, a minute by default, so a test that moves it also
|
|
66
|
+
* advances fake timers; to show a new time at once, use a fixed `now` and the harness's `setNow`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createTestClock(start?: DateTimeInput): TestClock;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/builders.d.ts
|
|
71
|
+
interface EventBaseInput<TData, TEventId extends EventId, TResourceId extends ResourceId> {
|
|
72
|
+
/** Defaults to the title. */
|
|
73
|
+
readonly id?: TEventId;
|
|
74
|
+
/** Defaults to the ID, or `"Event"`. */
|
|
75
|
+
readonly title?: string;
|
|
76
|
+
readonly resourceIds?: readonly TResourceId[];
|
|
77
|
+
/** Defaults to `null`. */
|
|
78
|
+
readonly data?: TData;
|
|
79
|
+
}
|
|
80
|
+
/** A timed event: `start` and `end`, or `start` and `duration`. */
|
|
81
|
+
interface TimedEventInput<TData = null, TEventId extends EventId = string, TResourceId extends ResourceId = string> extends EventBaseInput<TData, TEventId, TResourceId> {
|
|
82
|
+
/** Exact, or a wall time on `timeZone`. Defaults to 09:00 on 8 October 2026. */
|
|
83
|
+
readonly start?: DateTimeInput;
|
|
84
|
+
/** Exact, or a wall time on `timeZone`. Defaults to `start` plus `duration`. */
|
|
85
|
+
readonly end?: DateTimeInput;
|
|
86
|
+
/** Added on `timeZone`'s wall clock, so a day stays a day across DST. Defaults to an hour. */
|
|
87
|
+
readonly duration?: Temporal.DurationLike | string;
|
|
88
|
+
/**
|
|
89
|
+
* The zone wall times are read on, and the event's `sourceTimeZone`. Without it, wall times are
|
|
90
|
+
* UTC and the event has no source zone.
|
|
91
|
+
*/
|
|
92
|
+
readonly timeZone?: string;
|
|
93
|
+
}
|
|
94
|
+
/** An all-day event over whole dates, `end` exclusive. */
|
|
95
|
+
interface AllDayEventInput<TData = null, TEventId extends EventId = string, TResourceId extends ResourceId = string> extends EventBaseInput<TData, TEventId, TResourceId> {
|
|
96
|
+
/** Defaults to 8 October 2026. */
|
|
97
|
+
readonly start?: DateInput;
|
|
98
|
+
/** The day after the last one. Defaults to `start` plus `days`. */
|
|
99
|
+
readonly end?: DateInput;
|
|
100
|
+
/** Defaults to 1. */
|
|
101
|
+
readonly days?: number;
|
|
102
|
+
}
|
|
103
|
+
/** A timed event in the canonical shape `createCanonicalEventAdapter` reads. */
|
|
104
|
+
export declare function buildEvent<TData = null, TEventId extends EventId = string, TResourceId extends ResourceId = string>(input?: TimedEventInput<TData, TEventId, TResourceId>): TimedCalendarEvent<NoInfer<TData>, NoInfer<TEventId>, NoInfer<TResourceId>>;
|
|
105
|
+
/** An all-day event in the canonical shape. */
|
|
106
|
+
export declare function buildAllDayEvent<TData = null, TEventId extends EventId = string, TResourceId extends ResourceId = string>(input?: AllDayEventInput<TData, TEventId, TResourceId>): AllDayCalendarEvent<NoInfer<TData>, NoInfer<TEventId>, NoInfer<TResourceId>>;
|
|
107
|
+
interface ResourceInput<TData = null, TResourceId extends ResourceId = string> {
|
|
108
|
+
/** Defaults to the title. */
|
|
109
|
+
readonly id?: TResourceId;
|
|
110
|
+
/** Defaults to the ID, or `"Resource"`. */
|
|
111
|
+
readonly title?: string;
|
|
112
|
+
readonly parentId?: TResourceId;
|
|
113
|
+
readonly timeZone?: string;
|
|
114
|
+
readonly availability?: ResourceAvailability;
|
|
115
|
+
/** Defaults to `null`. */
|
|
116
|
+
readonly data?: TData;
|
|
117
|
+
}
|
|
118
|
+
/** A resource in the canonical `CalendarResource` shape. */
|
|
119
|
+
export declare function buildResource<TData = null, TResourceId extends ResourceId = string>(input?: ResourceInput<TData, TResourceId>): CalendarResource<NoInfer<TData>, NoInfer<TResourceId>>;
|
|
120
|
+
/** Open hours: `"09:00-17:00"`, or `{ start, end }` as `PlainTime`s or text. */
|
|
121
|
+
type HoursInput = string | {
|
|
122
|
+
readonly start: Temporal.PlainTime | string;
|
|
123
|
+
readonly end: Temporal.PlainTime | string;
|
|
124
|
+
};
|
|
125
|
+
interface AvailabilityExceptionInput {
|
|
126
|
+
readonly date: DateInput;
|
|
127
|
+
/** Hours that replace the weekly ones on `date`; none closes it. */
|
|
128
|
+
readonly hours?: HoursInput | readonly HoursInput[];
|
|
129
|
+
readonly label?: string;
|
|
130
|
+
}
|
|
131
|
+
interface AvailabilityInput {
|
|
132
|
+
/** Days the weekly hours start on, `1` Monday to `7` Sunday. Defaults to Monday to Friday. */
|
|
133
|
+
readonly days?: readonly IsoDayOfWeek[];
|
|
134
|
+
/** Defaults to `"09:00-17:00"`. An empty list opens only the exceptions' hours. */
|
|
135
|
+
readonly hours?: HoursInput | readonly HoursInput[];
|
|
136
|
+
readonly exceptions?: readonly AvailabilityExceptionInput[];
|
|
137
|
+
/** The zone the hours are on; the display time zone when absent. */
|
|
138
|
+
readonly timeZone?: string;
|
|
139
|
+
}
|
|
140
|
+
/** Working hours for `Root`'s `availability` or a resource's: Monday to Friday, 9 to 5 by default. */
|
|
141
|
+
export declare function buildAvailability(input?: AvailabilityInput): CalendarAvailability;
|
|
142
|
+
/** What makes an event a series; dates are text or Temporal values in the series' kind. */
|
|
143
|
+
interface RecurrenceInput {
|
|
144
|
+
/** RRULE text, such as `"FREQ=WEEKLY;BYDAY=MO,WE"`, or a parsed rule. */
|
|
145
|
+
readonly rule?: string | RecurrenceRule;
|
|
146
|
+
/** EXDATE: original starts of occurrences that don't happen. */
|
|
147
|
+
readonly exceptionDates?: readonly (RecurrenceDate | string)[];
|
|
148
|
+
/** RDATE: extra occurrences. */
|
|
149
|
+
readonly recurrenceDates?: readonly (RecurrenceDate | RecurrencePeriod | string)[];
|
|
150
|
+
/** DURATION, which keeps each occurrence's wall-clock length across DST. */
|
|
151
|
+
readonly duration?: Temporal.Duration | string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Makes `event` the master of a series. Dates given as text take the event's kind: instants (wall
|
|
155
|
+
* times on its `sourceTimeZone`, or UTC) for a timed event, date-times for a floating one, dates
|
|
156
|
+
* for an all-day one. A date alone on a timed or floating series, such as `"2026-10-28"`, stays a
|
|
157
|
+
* date in `exceptionDates`, which drops every occurrence that day; in `recurrenceDates` it throws,
|
|
158
|
+
* as an extra occurrence of such a series needs a time.
|
|
159
|
+
*/
|
|
160
|
+
export declare function withRecurrence<TData, TEventId extends EventId, TResourceId extends ResourceId>(event: CalendarEvent<TData, TEventId, TResourceId>, recurrence: RecurrenceInput): RecurringCalendarEvent<TData, TEventId, TResourceId>;
|
|
161
|
+
/**
|
|
162
|
+
* A timed recurring series: `buildEvent`'s input, where `duration` sizes the first occurrence,
|
|
163
|
+
* plus the rule and dates. Give `timeZone`, so the series repeats on that zone's wall clock.
|
|
164
|
+
*/
|
|
165
|
+
export declare function buildRecurringEvent<TData = null, TEventId extends EventId = string, TResourceId extends ResourceId = string>(input: TimedEventInput<TData, TEventId, TResourceId> & Omit<RecurrenceInput, "duration">): RecurringCalendarEvent<NoInfer<TData>, NoInfer<TEventId>, NoInfer<TResourceId>>;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/changes.d.ts
|
|
168
|
+
interface ApplyChangeOptions<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
169
|
+
/**
|
|
170
|
+
* The record a new event gets, from its change and the first `new-<n>` ID no event has; the
|
|
171
|
+
* proposed placement is applied over it. Defaults to `{ id, title: "New event", data: null }`.
|
|
172
|
+
*/
|
|
173
|
+
readonly createEvent?: (change: Extract<CalendarEventChange<TEvent, TEventId, TResourceId>, {
|
|
174
|
+
cause: "create";
|
|
175
|
+
}>, id: string) => TEvent;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Applies a change `onEventChange` received to canonical events (`CalendarEvent`), as an app
|
|
179
|
+
* that saves at once would: a move or resize takes the proposed placement, a delete drops the
|
|
180
|
+
* event, and a create adds `createEvent`'s record placed where it was proposed, or the record the
|
|
181
|
+
* change carries, as an undone delete does. Returns a new array.
|
|
182
|
+
*/
|
|
183
|
+
export declare function applyCanonicalChange<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId>(events: readonly TEvent[], change: CalendarEventChange<TEvent, TEventId, TResourceId>, options?: ApplyChangeOptions<TEvent, TEventId, TResourceId>): readonly TEvent[];
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/queries.d.ts
|
|
186
|
+
/**
|
|
187
|
+
* Names an event: its ID or title as text (an ID wins), its ID as a number, or `{ id }`,
|
|
188
|
+
* `{ title }` or `{ start }`. A `start` is a date for an all-day event, a date and time for a
|
|
189
|
+
* floating one, or a time for a timed one: exact, or a wall time on the calendar's time zone.
|
|
190
|
+
*/
|
|
191
|
+
type EventQuery<TEventId extends EventId = EventId> = string | number | {
|
|
192
|
+
readonly id: TEventId;
|
|
193
|
+
} | {
|
|
194
|
+
readonly title: string;
|
|
195
|
+
} | {
|
|
196
|
+
readonly start: DateTimeInput | Temporal.PlainDate | Temporal.PlainDateTime;
|
|
197
|
+
};
|
|
198
|
+
/** A day, or a slot when `time` is given, in a resource when the view has them. */
|
|
199
|
+
interface CellQuery<TResourceId extends ResourceId = ResourceId> {
|
|
200
|
+
readonly date: DateInput;
|
|
201
|
+
/** The slot's start on the display time zone's wall clock, such as `"09:30"`. */
|
|
202
|
+
readonly time?: Temporal.PlainTime | string;
|
|
203
|
+
/** The resource the cell is in; `null` for the unassigned row. */
|
|
204
|
+
readonly resourceId?: TResourceId | null;
|
|
205
|
+
}
|
|
206
|
+
/** Thrown when a query finds nothing, or more than one thing where it needs one. */
|
|
207
|
+
export declare class CalendarQueryError extends Error {
|
|
208
|
+
constructor(message: string);
|
|
209
|
+
}
|
|
210
|
+
/** Text with the thin and no-break spaces `Intl` output uses made plain, and trimmed. */
|
|
211
|
+
export declare function normalizeText(text: string | null | undefined): string;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/keyboard.d.ts
|
|
214
|
+
/** Modifier keys held with a key. */
|
|
215
|
+
interface KeyModifiers {
|
|
216
|
+
readonly altKey?: boolean;
|
|
217
|
+
readonly ctrlKey?: boolean;
|
|
218
|
+
readonly metaKey?: boolean;
|
|
219
|
+
readonly shiftKey?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Arrow-key steps through a view, by direction rather than key. What a step is depends on the
|
|
223
|
+
* view: in a time grid, `across` is a day and `down` a slot; in a month, a day and a week; in
|
|
224
|
+
* resource columns, a column (the next resource, then the next day) and a slot; in a timeline,
|
|
225
|
+
* `across` is a slot, or a day over days, and `down` the next resource.
|
|
226
|
+
*/
|
|
227
|
+
interface KeyboardSteps {
|
|
228
|
+
/**
|
|
229
|
+
* Steps toward the inline end, or back when negative: Arrow Right in a left-to-right calendar,
|
|
230
|
+
* Arrow Left in a right-to-left one, from `Root`'s `direction`.
|
|
231
|
+
*/
|
|
232
|
+
readonly across?: number;
|
|
233
|
+
/** Steps down, or up when negative: Arrow Down or Arrow Up. */
|
|
234
|
+
readonly down?: number;
|
|
235
|
+
}
|
|
236
|
+
/** Arrow keys to press, each a number of times, in this order. */
|
|
237
|
+
interface ArrowPresses {
|
|
238
|
+
readonly up?: number;
|
|
239
|
+
readonly down?: number;
|
|
240
|
+
readonly left?: number;
|
|
241
|
+
readonly right?: number;
|
|
242
|
+
}
|
|
243
|
+
/** Which part of an event to focus: the one on `date`, in `resourceId`. */
|
|
244
|
+
interface EventFocusOptions<TResourceId extends ResourceId = ResourceId> {
|
|
245
|
+
/** The day whose part takes focus; by default the day it starts, or the first day shown. */
|
|
246
|
+
readonly date?: DateInput;
|
|
247
|
+
/** The resource whose copy takes focus, in a resource view. */
|
|
248
|
+
readonly resourceId?: TResourceId | null;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Drives a calendar's keyboard model as a person would: focus, arrows, and the grab mode, where
|
|
252
|
+
* Space picks up the focused event (Shift+Space its end, again its start) or starts a create on
|
|
253
|
+
* the focused cell, arrows step it, Enter drops it and Escape cancels it. Keys go to the focused
|
|
254
|
+
* element inside `act`, so they work in jsdom, happy-dom and a browser alike.
|
|
255
|
+
*/
|
|
256
|
+
interface KeyboardDriver<TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
257
|
+
/**
|
|
258
|
+
* Focuses an event through the calendar's focus, as arrow keys would: its part on `date`, in
|
|
259
|
+
* `resourceId`. Throws when the view doesn't show that part, and leaves focus as it was.
|
|
260
|
+
*/
|
|
261
|
+
focusEvent(event: EventQuery<TEventId>, options?: EventFocusOptions<TResourceId>): Promise<HTMLElement>;
|
|
262
|
+
/**
|
|
263
|
+
* Focuses a day, or a slot when `time` is given, through the calendar's focus; a slot renders
|
|
264
|
+
* only while it has focus. Throws when the view doesn't show the cell, and leaves focus as it
|
|
265
|
+
* was.
|
|
266
|
+
*/
|
|
267
|
+
focusCell(cell: CellQuery<TResourceId>): Promise<HTMLElement>;
|
|
268
|
+
/** Presses a key on the focused element, as `keydown`. */
|
|
269
|
+
press(key: string, modifiers?: KeyModifiers): Promise<void>;
|
|
270
|
+
/** Presses arrow keys by count: up, down, left, then right. */
|
|
271
|
+
arrows(presses: ArrowPresses): Promise<void>;
|
|
272
|
+
/** Presses arrow keys for `down` steps, then `across` ones; during a grab they move it. */
|
|
273
|
+
step(steps: KeyboardSteps): Promise<void>;
|
|
274
|
+
/** Space: picks up the focused event, or starts a create on the focused cell. */
|
|
275
|
+
grab(): Promise<void>;
|
|
276
|
+
/** Shift+Space: picks up the focused event's end; during a resize, switches to the other edge. */
|
|
277
|
+
grabEdge(): Promise<void>;
|
|
278
|
+
/** Enter: drops what's grabbed, proposing the change. */
|
|
279
|
+
drop(): Promise<void>;
|
|
280
|
+
/** Escape: cancels a grab. */
|
|
281
|
+
cancel(): Promise<void>;
|
|
282
|
+
/** Focuses the event, grabs it, steps and drops it. */
|
|
283
|
+
moveEvent(event: EventQuery<TEventId>, steps: KeyboardSteps & EventFocusOptions<TResourceId>): Promise<void>;
|
|
284
|
+
/** Focuses the event, grabs its end (or start), steps it and drops it. */
|
|
285
|
+
resizeEvent(event: EventQuery<TEventId>, steps: KeyboardSteps & EventFocusOptions<TResourceId> & {
|
|
286
|
+
readonly edge?: "end" | "start";
|
|
287
|
+
}): Promise<void>;
|
|
288
|
+
/** Focuses the cell, starts a create, grows it by steps and drops it. */
|
|
289
|
+
createEvent(cell: CellQuery<TResourceId>, steps?: KeyboardSteps): Promise<void>;
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/placement.d.ts
|
|
293
|
+
/** Where an event shows, as text that compares with `===` and `toEqual`. */
|
|
294
|
+
interface EventPlacementSummary<TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
295
|
+
readonly id: TEventId;
|
|
296
|
+
readonly title: string;
|
|
297
|
+
readonly kind: "timed" | "all-day" | "floating";
|
|
298
|
+
/** ISO text: an instant for a timed event, a date for an all-day one, a date and time for a floating one. */
|
|
299
|
+
readonly start: string;
|
|
300
|
+
readonly end: string;
|
|
301
|
+
/** `start/end`. */
|
|
302
|
+
readonly range: string;
|
|
303
|
+
/**
|
|
304
|
+
* The ends on the display time zone's wall clock to the minute, such as
|
|
305
|
+
* `2026-10-08T11:00/2026-10-08T12:00`; the same as `range` for all-day and floating events.
|
|
306
|
+
*/
|
|
307
|
+
readonly wallRange: string;
|
|
308
|
+
readonly resourceIds: readonly TResourceId[];
|
|
309
|
+
/** Whether it shows a change that isn't saved and in the events yet. */
|
|
310
|
+
readonly isPending: boolean;
|
|
311
|
+
}
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/pointer.d.ts
|
|
314
|
+
/** A point in the viewport, in CSS pixels. */
|
|
315
|
+
interface Point {
|
|
316
|
+
readonly x: number;
|
|
317
|
+
readonly y: number;
|
|
318
|
+
}
|
|
319
|
+
interface PointerOptions {
|
|
320
|
+
/** `"mouse"` by default. A touch holds still until its drag starts, as a long press does. */
|
|
321
|
+
readonly pointerType?: "mouse" | "pen" | "touch";
|
|
322
|
+
/** Moves between the press and the release. 4 by default. */
|
|
323
|
+
readonly steps?: number;
|
|
324
|
+
/** How long a touch waits for its drag to start, in milliseconds. 2000 by default. */
|
|
325
|
+
readonly timeout?: number;
|
|
326
|
+
}
|
|
327
|
+
/** Thrown where pointer drivers need a layout the environment doesn't have, as in jsdom. */
|
|
328
|
+
export declare class PointerLayoutError extends Error {
|
|
329
|
+
constructor(what: string);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Drives the pointer layer with Pointer Events at measured points, as a mouse, pen or finger
|
|
333
|
+
* would. It needs a laid-out page and real timers; in jsdom and happy-dom every box is empty, so
|
|
334
|
+
* it throws a `PointerLayoutError` there. Where it presses and lets go has to be on screen.
|
|
335
|
+
*/
|
|
336
|
+
interface PointerDriver<TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
337
|
+
/** Presses at `from`, moves to `to` and lets go. An element stands for its middle. */
|
|
338
|
+
drag(from: Element | Point, to: Element | Point, options?: PointerOptions): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* Drags an event by its middle so it starts on `to`'s date, at `time` in a time column, in
|
|
341
|
+
* `to`'s resource or the one it's pressed in. Without `time`, it moves by whole days and keeps
|
|
342
|
+
* its time.
|
|
343
|
+
*/
|
|
344
|
+
moveEvent(event: EventQuery<TEventId>, to: CellQuery<TResourceId>, options?: PointerOptions): Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* Drags an event's end (or start) handle so that edge lands at `time`, or, in a view that
|
|
347
|
+
* resizes by days, as a timeline over days does, on `date`.
|
|
348
|
+
*/
|
|
349
|
+
resizeEvent(event: EventQuery<TEventId>, to: CellQuery<TResourceId> & {
|
|
350
|
+
readonly edge?: "end" | "start";
|
|
351
|
+
}, options?: PointerOptions): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* Drags across empty cells to create an event: from `from`'s slot to the end of `to`'s, or from
|
|
354
|
+
* one day to another, both included.
|
|
355
|
+
*/
|
|
356
|
+
createEvent(from: CellQuery<TResourceId>, to: CellQuery<TResourceId>, options?: PointerOptions): Promise<void>;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/inspect.d.ts
|
|
360
|
+
/** A resource: its ID, `null` for the unassigned row, or `{ title }`. */
|
|
361
|
+
type ResourceQuery<TResourceId extends ResourceId = ResourceId> = TResourceId | null | {
|
|
362
|
+
readonly title: string;
|
|
363
|
+
};
|
|
364
|
+
interface SettleOptions {
|
|
365
|
+
/** How long to wait, in milliseconds of real time. 5000 by default. */
|
|
366
|
+
readonly timeout?: number;
|
|
367
|
+
}
|
|
368
|
+
/** Finds what a calendar shows, drives it, and reads what it said. */
|
|
369
|
+
interface CalendarInspection<TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
370
|
+
/**
|
|
371
|
+
* The first element showing an event, found by its ID, title or start through the calendar's
|
|
372
|
+
* own events, so it holds in any language. Throws when the query names no event, several, or
|
|
373
|
+
* one the view doesn't show.
|
|
374
|
+
*/
|
|
375
|
+
getEvent(event: EventQuery<TEventId>): HTMLElement;
|
|
376
|
+
/**
|
|
377
|
+
* Every element showing an event, in document order: one per part the view draws, such as a
|
|
378
|
+
* time grid's day column, a month's week row, or a resource's column.
|
|
379
|
+
*/
|
|
380
|
+
getAllEvents(event: EventQuery<TEventId>): HTMLElement[];
|
|
381
|
+
/**
|
|
382
|
+
* The first element showing an event, or `null` when the view doesn't show it or there's no
|
|
383
|
+
* such event. Throws when the query names several events.
|
|
384
|
+
*/
|
|
385
|
+
queryEvent(event: EventQuery<TEventId>): HTMLElement | null;
|
|
386
|
+
/**
|
|
387
|
+
* A day's cell, in a resource: a time grid's all-day cell (`data-all-day`), or else a month's
|
|
388
|
+
* day, the first `data-date` element that isn't a timeline's strip.
|
|
389
|
+
*/
|
|
390
|
+
getDayCell(date: DateInput, options?: {
|
|
391
|
+
readonly resourceId?: TResourceId | null;
|
|
392
|
+
}): HTMLElement;
|
|
393
|
+
/**
|
|
394
|
+
* The column of a date's hours in a time grid, a `data-date` element without `data-all-day`, or
|
|
395
|
+
* its strip along a timeline row (`data-axis="inline"`). In a month, which has no hours, that's
|
|
396
|
+
* the day itself.
|
|
397
|
+
*/
|
|
398
|
+
getTimeColumn(date: DateInput, options?: {
|
|
399
|
+
readonly resourceId?: TResourceId | null;
|
|
400
|
+
}): HTMLElement;
|
|
401
|
+
/** The first element a resource's column or row carries `resourceIdAttributes` on. */
|
|
402
|
+
getResource(resource: ResourceQuery<TResourceId>): HTMLElement;
|
|
403
|
+
/** Where an event shows now, pending changes included, as text. */
|
|
404
|
+
placementOf(event: EventQuery<TEventId>): EventPlacementSummary<TEventId, TResourceId>;
|
|
405
|
+
/**
|
|
406
|
+
* Waits until no change is pending: every proposal validated, saved and in the events. It
|
|
407
|
+
* advances no fake timers: a save that waits on one needs them advanced.
|
|
408
|
+
*/
|
|
409
|
+
settled(options?: SettleOptions): Promise<void>;
|
|
410
|
+
/** Every message the `Announcer` spoke, oldest first. */
|
|
411
|
+
announcements(): readonly string[];
|
|
412
|
+
/** What the `Announcer` says now; `undefined` when it's silent or there's none. */
|
|
413
|
+
lastAnnouncement(): string | undefined;
|
|
414
|
+
readonly keyboard: KeyboardDriver<TEventId, TResourceId>;
|
|
415
|
+
readonly pointer: PointerDriver<TEventId, TResourceId>;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/harness.d.ts
|
|
419
|
+
/**
|
|
420
|
+
* Root props the harness owns; set the others through `rootProps`. The environment's `now`, or
|
|
421
|
+
* the `clock` option, gives the time.
|
|
422
|
+
*/
|
|
423
|
+
type HarnessOwnedProp = "children" | "clock" | "events" | "now" | "onEventChange" | "onEventChangeResult";
|
|
424
|
+
/** Any other `Root` prop, such as `policies`, `availability` or a controlled `timeZone`. */
|
|
425
|
+
type CalendarHarnessRootProps<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId> = Partial<Omit<CalendarRootProps<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>, HarnessOwnedProp>>;
|
|
426
|
+
/** An `onEventChangeResult` call, as the harness recorded it. */
|
|
427
|
+
interface CalendarChangeResult<TEvent, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> {
|
|
428
|
+
readonly detail: CalendarProposalDetail;
|
|
429
|
+
readonly result: CalendarTransactionResult<TEvent, TEventId, TResourceId>;
|
|
430
|
+
}
|
|
431
|
+
interface RenderCalendarOptions<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends ApplyChangeOptions<TEvent, TEventId, TResourceId> {
|
|
432
|
+
/** The events the calendar starts with. The harness owns them and applies saved changes. */
|
|
433
|
+
readonly events?: readonly TEvent[];
|
|
434
|
+
/** The view to open; the first registered one by default. */
|
|
435
|
+
readonly view?: TViewDef["name"];
|
|
436
|
+
/** `createTestEnvironment()` by default. */
|
|
437
|
+
readonly environment?: TestEnvironment;
|
|
438
|
+
/**
|
|
439
|
+
* A clock `Root` reads the time from instead of the environment's fixed `now`, such as
|
|
440
|
+
* `createTestClock()`. `setNow` doesn't work with one: move the clock.
|
|
441
|
+
*/
|
|
442
|
+
readonly clock?: CalendarClock;
|
|
443
|
+
readonly resources?: readonly TResource[];
|
|
444
|
+
/** Renders `Root` without `onEventChange`, so the calendar is read-only. */
|
|
445
|
+
readonly readOnly?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Called with each accepted change before the harness applies it. Return a promise to keep the
|
|
448
|
+
* change pending until it settles; throw or reject to roll it back, and the harness applies
|
|
449
|
+
* nothing.
|
|
450
|
+
*/
|
|
451
|
+
readonly onEventChange?: CalendarEventChangeHandler<TEvent, TEventId, TResourceId>;
|
|
452
|
+
/** Called after the harness records the result. */
|
|
453
|
+
readonly onEventChangeResult?: (result: CalendarTransactionResult<TEvent, TEventId, TResourceId>, detail: CalendarProposalDetail) => void;
|
|
454
|
+
/**
|
|
455
|
+
* Applies a saved change to the events. Defaults to `applyCanonicalChange`, which needs
|
|
456
|
+
* canonical `CalendarEvent` records; pass your own for app records.
|
|
457
|
+
*/
|
|
458
|
+
readonly applyChange?: (events: readonly TEvent[], change: CalendarEventChange<TEvent, TEventId, TResourceId>) => readonly TEvent[];
|
|
459
|
+
readonly rootProps?: CalendarHarnessRootProps<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>;
|
|
460
|
+
/** What `Root` renders; `<Calendar.ActiveView />` by default. */
|
|
461
|
+
readonly children?: ReactNode;
|
|
462
|
+
/** Renders `<Calendar.Announcer messages={messages} />`, so moves are announced. */
|
|
463
|
+
readonly messages?: CalendarAnnouncementMessages;
|
|
464
|
+
/** Wraps the calendar, as a provider it needs does. */
|
|
465
|
+
readonly wrapper?: ComponentType<{
|
|
466
|
+
readonly children: ReactNode;
|
|
467
|
+
}>;
|
|
468
|
+
readonly strictMode?: boolean;
|
|
469
|
+
/** `useId`'s prefix, which a server render and its hydration share. */
|
|
470
|
+
readonly identifierPrefix?: string;
|
|
471
|
+
/** Where to render; a new `div` in `document.body` by default, removed on unmount. */
|
|
472
|
+
readonly container?: HTMLElement;
|
|
473
|
+
}
|
|
474
|
+
/** Options `rerender` changes; the others apply only to the first render. */
|
|
475
|
+
type CalendarHarnessUpdate<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> = Partial<Pick<RenderCalendarOptions<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>, "applyChange" | "children" | "createEvent" | "events" | "messages" | "onEventChange" | "onEventChangeResult" | "readOnly" | "resources" | "rootProps">>;
|
|
476
|
+
/** A rendered calendar, with what it reported and ways to drive it. */
|
|
477
|
+
interface CalendarHarness<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends CalendarInspection<TEventId, TResourceId> {
|
|
478
|
+
readonly container: HTMLElement;
|
|
479
|
+
readonly environment: TestEnvironment;
|
|
480
|
+
/** Every change `onEventChange` received, in order, applied or not. */
|
|
481
|
+
readonly changes: readonly CalendarEventChange<TEvent, TEventId, TResourceId>[];
|
|
482
|
+
/** Every `onEventChangeResult` call, in order. */
|
|
483
|
+
readonly results: readonly CalendarChangeResult<TEvent, TEventId, TResourceId>[];
|
|
484
|
+
/** What `onDiagnosticsChange` last reported. */
|
|
485
|
+
readonly diagnostics: readonly CalendarDiagnostic<TEvent, TEventId>[];
|
|
486
|
+
/** Errors React recovered from, such as a hydration mismatch. */
|
|
487
|
+
readonly recoverableErrors: readonly unknown[];
|
|
488
|
+
/** The calendar's actions, read from inside `Root`. Call them through `act`. */
|
|
489
|
+
readonly actions: CalendarSemanticActions<TViewDef["name"], TSelection, TFocus, TResourceId, TEvent, TEventId>;
|
|
490
|
+
/** The events `Root` has now, with every applied change. */
|
|
491
|
+
events(): readonly TEvent[];
|
|
492
|
+
/** The calendar's public state: view, anchor date, time zone, focus and selection. */
|
|
493
|
+
state(): CalendarPublicState<TViewDef["name"], TSelection, TFocus, TResourceId>;
|
|
494
|
+
/** `useCalendarMeta()`: the visible event snapshot, environment, resources and diagnostics. */
|
|
495
|
+
meta(): CalendarMeta<TEvent, TResource, TViewDef, TEventId, TResourceId>;
|
|
496
|
+
/** `useCalendarPendingChanges()`: proposals still validating, saving or awaiting events. */
|
|
497
|
+
pendingChanges(): CalendarPendingChanges<TEvent, TEventId, TResourceId>;
|
|
498
|
+
/** Runs `callback` with the actions inside React's `act`, and waits for what it returns. */
|
|
499
|
+
act<TResult>(callback: (actions: CalendarSemanticActions<TViewDef["name"], TSelection, TFocus, TResourceId, TEvent, TEventId>) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
|
500
|
+
/** `proposeEventChange` inside `act`, resolving with its result once it settles. */
|
|
501
|
+
propose(proposal: CalendarEventProposal<TEventId, TResourceId, TEvent>, detail?: CalendarProposalDetail): Promise<CalendarTransactionResult<TEvent, TEventId, TResourceId>>;
|
|
502
|
+
/** Replaces the events, as an app's store would. */
|
|
503
|
+
setEvents(events: readonly TEvent[]): Promise<void>;
|
|
504
|
+
/**
|
|
505
|
+
* Moves the fixed `now`, so today and the current time move with it: exact text, a wall time on
|
|
506
|
+
* the environment's zone, or a time such as `"10:00"` on the current date. Throws for a
|
|
507
|
+
* calendar on a `clock`.
|
|
508
|
+
*/
|
|
509
|
+
setNow(now: DateTimeInput): Promise<void>;
|
|
510
|
+
/**
|
|
511
|
+
* Renders again with some options changed; `events` replaces the events. `view` and the
|
|
512
|
+
* environment set where the calendar starts, so change those through `act` and its actions.
|
|
513
|
+
*/
|
|
514
|
+
rerender(options: CalendarHarnessUpdate<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>): Promise<void>;
|
|
515
|
+
unmount(): Promise<void>;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* The harness type for a calendar factory, so tests can name it without its type parameters:
|
|
519
|
+
* `let calendar: CalendarHarnessFor<typeof Calendar>`.
|
|
520
|
+
*/
|
|
521
|
+
type CalendarHarnessFor<TCalendar> = TCalendar extends CalendarFactory<infer TEvent, infer TResource, infer TViewDef, infer TSelection, infer TFocus, infer TEventId, infer TResourceId> ? CalendarHarness<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId> : never;
|
|
522
|
+
/** The server markup and hydration of `hydrateCalendar`. */
|
|
523
|
+
interface HydratedCalendarHarness<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection = CalendarSelection, TFocus = CalendarFocus, TEventId extends EventId = EventId, TResourceId extends ResourceId = ResourceId> extends CalendarHarness<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId> {
|
|
524
|
+
/** What `renderToString` gave, before hydration. */
|
|
525
|
+
readonly serverMarkup: string;
|
|
526
|
+
}
|
|
527
|
+
/** Thrown when a client render doesn't match the server's markup. */
|
|
528
|
+
export declare class HydrationMismatchError extends Error {
|
|
529
|
+
/** What React reported: recoverable errors and hydration warnings. */
|
|
530
|
+
readonly errors: readonly unknown[];
|
|
531
|
+
readonly serverMarkup: string;
|
|
532
|
+
constructor(errors: readonly unknown[], serverMarkup: string);
|
|
533
|
+
}
|
|
534
|
+
/** Unmounts every calendar the harness rendered and removes the containers it made. */
|
|
535
|
+
export declare function cleanup(): Promise<void>;
|
|
536
|
+
/**
|
|
537
|
+
* Renders `Calendar.Root` with a deterministic environment and controlled events, inside `act`.
|
|
538
|
+
* Saved changes are applied to the events; every change and result is recorded. Unmount it with
|
|
539
|
+
* `unmount()`, or every one at once with `cleanup()` after each test.
|
|
540
|
+
*/
|
|
541
|
+
export declare function renderCalendar<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId>(Calendar: CalendarFactory<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>, options?: RenderCalendarOptions<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>): Promise<CalendarHarness<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>>;
|
|
542
|
+
/**
|
|
543
|
+
* Renders the calendar with `renderToString`, puts that markup in a container and hydrates it,
|
|
544
|
+
* as a server-rendered page does. Throws a `HydrationMismatchError` when React reports a
|
|
545
|
+
* mismatch: a recoverable error, or a hydration warning such as a differing attribute, which
|
|
546
|
+
* React only logs. The console is watched while hydration runs, then restored; any `console.error`
|
|
547
|
+
* then that mentions hydration counts. React's development build logs those warnings and its
|
|
548
|
+
* production build doesn't, so test with the development build. The server render runs in the
|
|
549
|
+
* test's own environment, so code that checks for `window` takes its browser branch there too.
|
|
550
|
+
*/
|
|
551
|
+
export declare function hydrateCalendar<TEvent, TResource, TViewDef extends AnyCalendarView, TSelection, TFocus, TEventId extends EventId, TResourceId extends ResourceId>(Calendar: CalendarFactory<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>, options?: RenderCalendarOptions<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>): Promise<HydratedCalendarHarness<TEvent, TResource, TViewDef, TSelection, TFocus, TEventId, TResourceId>>;
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/fixtures.d.ts
|
|
554
|
+
/**
|
|
555
|
+
* A ready dataset of canonical events for contract tests, with the environment, resources and
|
|
556
|
+
* `Root` props it's meant for. Each field is a harness option, so
|
|
557
|
+
* `renderCalendar(Calendar, { ...fixture, view })` renders it; merge `rootProps` when you pass
|
|
558
|
+
* your own. Every call builds new records. A fixture's IDs, titles, times and counts are part of
|
|
559
|
+
* the API: they change only in a major version.
|
|
560
|
+
*/
|
|
561
|
+
interface CalendarFixture<TEvent, TResource = never> {
|
|
562
|
+
readonly environment: TestEnvironment;
|
|
563
|
+
readonly events: readonly TEvent[];
|
|
564
|
+
readonly resources?: readonly TResource[];
|
|
565
|
+
/** `Root` props the dataset needs: its working hours, the resources it opens expanded. */
|
|
566
|
+
readonly rootProps?: {
|
|
567
|
+
readonly availability?: CalendarAvailability;
|
|
568
|
+
readonly defaultExpandedResourceIds?: readonly string[];
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Series masters, which a calendar shows only once they're expanded into occurrences, with the
|
|
573
|
+
* environment they're meant for. Expand them with `@moltenship/calendar-recurrence`'s
|
|
574
|
+
* `createOccurrenceExpander` and show them through `createOccurrenceAdapter`.
|
|
575
|
+
*/
|
|
576
|
+
interface SeriesFixture<TEvent> {
|
|
577
|
+
readonly environment: TestEnvironment;
|
|
578
|
+
readonly series: readonly TEvent[];
|
|
579
|
+
}
|
|
580
|
+
/** The canonical event shape the fixtures use: `group` names what an event is part of. */
|
|
581
|
+
type FixtureEvent = CalendarEvent<{
|
|
582
|
+
readonly group: string;
|
|
583
|
+
}>;
|
|
584
|
+
/** A series master of `multiZoneSeriesFixture`. */
|
|
585
|
+
type FixtureSeriesEvent = RecurringCalendarEvent<{
|
|
586
|
+
readonly group: string;
|
|
587
|
+
}>;
|
|
588
|
+
/** A fixture resource: `group` names its team or room kind. */
|
|
589
|
+
type FixtureResource = CalendarResource<{
|
|
590
|
+
readonly group: string;
|
|
591
|
+
}>;
|
|
592
|
+
/**
|
|
593
|
+
* Thursday 8 October 2026 in UTC, as busy as a day gets: 30 timed events and 3 all-day ones.
|
|
594
|
+
*
|
|
595
|
+
* - `b1`–`b8` ("Back-to-back"): half hours from 08:00 to 12:00 whose ends touch, overlapping none.
|
|
596
|
+
* - `l1` ("Long"): 12:00–18:00, under everything from noon to six.
|
|
597
|
+
* - `m1`–`m3` ("Lunch"): 12:00–13:00; with `l1`, four at once.
|
|
598
|
+
* - `s1`–`s4` ("Stack"): from 13:00, 60, 45, 90 and 30 minutes long; with `l1`, five at once.
|
|
599
|
+
* - `c1`–`c8` ("Staircase"): 45 minutes each, from 15:00 every 15 minutes, each overlapping the two
|
|
600
|
+
* before it, and `l1`.
|
|
601
|
+
* - `q1`–`q3` ("Short"): 5, 10 and 15 minutes, at 18:00, 18:15 and 18:30.
|
|
602
|
+
* - `n1` ("Overnight", 22:30–00:30 the next day) under `e1` ("Late", 23:45–24:00), and `n2`
|
|
603
|
+
* ("Overnight", from 23:00 the day before to 01:00).
|
|
604
|
+
* - `a1` "Holiday" and `a2` "On call" on the day, `a3` "Conference week" from Monday 5 to Sunday
|
|
605
|
+
* 11 October ("All day").
|
|
606
|
+
*
|
|
607
|
+
* For overlap layouts, "+N more", lists and performance budgets.
|
|
608
|
+
*/
|
|
609
|
+
export declare function denseDayFixture(): CalendarFixture<FixtureEvent>;
|
|
610
|
+
interface DstWeekOptions {
|
|
611
|
+
/**
|
|
612
|
+
* `"fall"`, the default: the week to Sunday 1 November 2026, when New York's clocks go back
|
|
613
|
+
* from 02:00 to 01:00. `"spring"`: the week to Sunday 8 March 2026, when they go forward from
|
|
614
|
+
* 02:00 to 03:00.
|
|
615
|
+
*/
|
|
616
|
+
readonly change?: "fall" | "spring";
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* A week in New York, Monday to Sunday, with a DST change on the Sunday. The calendar opens on the
|
|
620
|
+
* Monday at noon.
|
|
621
|
+
*
|
|
622
|
+
* - `d1`–`d7` ("Daily", "Standup <date>"): 09:00–09:30 every day, the same on the wall clock
|
|
623
|
+
* before and after the change.
|
|
624
|
+
* - `t1` ("Change", "In the changing hour"): in the fall, 30 minutes from the first 01:30, EDT,
|
|
625
|
+
* to 01:00 EST, when the clocks go back (05:30Z–06:00Z); in the spring, 02:30, a time that
|
|
626
|
+
* doesn't exist, so 03:30–04:00 EDT (07:30Z–08:00Z).
|
|
627
|
+
* - `t2` ("Change", "Across the change"): 00:30–04:00 on the wall clock, 4½ hours in the fall and
|
|
628
|
+
* 2½ in the spring.
|
|
629
|
+
* - `a1` ("All day", "Weekend away"): Saturday to Monday.
|
|
630
|
+
*/
|
|
631
|
+
export declare function dstWeekFixture(options?: DstWeekOptions): CalendarFixture<FixtureEvent>;
|
|
632
|
+
/**
|
|
633
|
+
* Three series in three zones, for a calendar in UTC that opens on Monday 19 October 2026. Berlin's
|
|
634
|
+
* clocks go back on 25 October and Los Angeles' on 1 November, so in the week of 26 October
|
|
635
|
+
* Berlin's occurrences have moved an hour later in UTC and Los Angeles' haven't yet; each stays put
|
|
636
|
+
* on its own wall clock. Tokyo has no DST.
|
|
637
|
+
*
|
|
638
|
+
* - `berlin-standup` ("Berlin", "Standup (Berlin)"): 09:00–09:15 in Berlin on weekdays, from
|
|
639
|
+
* Monday 19 October.
|
|
640
|
+
* - `la-review` ("Los Angeles", "Review (Los Angeles)"): 10:00–11:00 in Los Angeles every Tuesday,
|
|
641
|
+
* from 20 October.
|
|
642
|
+
* - `tokyo-check-in` ("Tokyo", "Check-in (Tokyo)"): 08:00–08:30 in Tokyo for ten days from Tuesday
|
|
643
|
+
* 20 October, but not on the 24th; COUNT counts the skipped day, so nine occurrences.
|
|
644
|
+
*
|
|
645
|
+
* The masters are series, not events a calendar shows: expand them first.
|
|
646
|
+
*/
|
|
647
|
+
export declare function multiZoneSeriesFixture(): SeriesFixture<FixtureSeriesEvent>;
|
|
648
|
+
/**
|
|
649
|
+
* Thursday 8 October 2026 for a team and two rooms, in UTC, with working hours from 09:00 to 18:00
|
|
650
|
+
* on weekdays and the rooms' parent expanded.
|
|
651
|
+
*
|
|
652
|
+
* - Resources ("Team"): `ana` in Lisbon, `ben` in New York with his own hours, 08:00–16:00 there
|
|
653
|
+
* (12:00–20:00 UTC), and `chen` in Shanghai. ("Rooms"): `rooms`, the parent of `orchid` and
|
|
654
|
+
* `lotus`.
|
|
655
|
+
* - `ana-1` "Design review" (Ana, 09:00–10:00), `ben-1` "Planning" (Ben, 14:00–16:00) and `chen-1`
|
|
656
|
+
* "Early sync" (Chen, 02:00–02:30), all "Work".
|
|
657
|
+
* - `meet-1` "Interview" (Ana and Orchid, 11:00–12:00) and `meet-2` "All hands" (Ben, Chen and
|
|
658
|
+
* Lotus, 15:00–16:30), "Meeting".
|
|
659
|
+
* - `open-1` "Unassigned task" (no resource, 10:00–11:00), and `leave-1` "Chen away" (Chen, all
|
|
660
|
+
* day).
|
|
661
|
+
*/
|
|
662
|
+
export declare function resourceDayFixture(): CalendarFixture<FixtureEvent, FixtureResource>;
|
|
663
|
+
//#endregion
|
|
664
|
+
export type { AllDayEventInput, ApplyChangeOptions, ArrowPresses, AvailabilityExceptionInput, AvailabilityInput, CalendarChangeResult, CalendarFixture, CalendarHarness, CalendarHarnessFor, CalendarHarnessRootProps, CalendarHarnessUpdate, CalendarInspection, CellQuery, DateInput, DateTimeInput, DstWeekOptions, EventFocusOptions, EventPlacementSummary, EventQuery, FixtureEvent, FixtureResource, FixtureSeriesEvent, HoursInput, HydratedCalendarHarness, KeyModifiers, KeyboardDriver, KeyboardSteps, Point, PointerDriver, PointerOptions, RecurrenceInput, RenderCalendarOptions, ResourceInput, ResourceQuery, SeriesFixture, SettleOptions, TestClock, TestEnvironment, TestEnvironmentOptions, TestEnvironmentRootProps, TimedEventInput };
|