@klinking/colander 0.0.0 → 2.0.1
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/dist/formats/date.cjs +51 -48
- package/dist/formats/date.d.cts +10 -37
- package/dist/formats/date.d.mts +10 -37
- package/dist/formats/date.mjs +6 -2
- package/dist/formats/object.cjs +51 -48
- package/dist/formats/object.d.cts +10 -37
- package/dist/formats/object.d.mts +10 -37
- package/dist/formats/object.mjs +6 -2
- package/dist/formats/plain-date-time.cjs +51 -48
- package/dist/formats/plain-date-time.d.cts +10 -37
- package/dist/formats/plain-date-time.d.mts +10 -37
- package/dist/formats/plain-date-time.mjs +6 -2
- package/dist/formats/plain-date.cjs +51 -48
- package/dist/formats/plain-date.d.cts +10 -37
- package/dist/formats/plain-date.d.mts +10 -37
- package/dist/formats/plain-date.mjs +6 -2
- package/dist/formats/plain-month-day.cjs +51 -48
- package/dist/formats/plain-month-day.d.cts +10 -37
- package/dist/formats/plain-month-day.d.mts +10 -37
- package/dist/formats/plain-month-day.mjs +6 -2
- package/dist/formats/plain-year-month.cjs +51 -48
- package/dist/formats/plain-year-month.d.cts +10 -37
- package/dist/formats/plain-year-month.d.mts +10 -37
- package/dist/formats/plain-year-month.mjs +6 -2
- package/dist/formats/zoned-date-time.cjs +51 -48
- package/dist/formats/zoned-date-time.d.cts +10 -37
- package/dist/formats/zoned-date-time.d.mts +10 -37
- package/dist/formats/zoned-date-time.mjs +6 -2
- package/dist/index.cjs +47 -48
- package/dist/index.d.cts +11 -2
- package/dist/index.d.mts +11 -2
- package/dist/index.mjs +2 -2
- package/dist/{temporal-polyfill-DTx0VIX5.mjs → weeks-navigation-B-Nch3LS.mjs} +357 -562
- package/dist/{temporal-polyfill-DU8VfleL.cjs → weeks-navigation-FxcECgCR.cjs} +357 -568
- package/dist/{weeks-view-context-BN6qR-83.d.mts → weeks-view-context-BZeWx9N8.d.cts} +275 -258
- package/dist/{weeks-view-context-aHGgYkpt.d.cts → weeks-view-context-MVe1b-BS.d.mts} +275 -258
- package/package.json +20 -20
- package/src/calendar-context.ts +12 -5
- package/src/calendar-provider.test.tsx +18 -4
- package/src/calendar-provider.tsx +130 -35
- package/src/calendar-types.ts +21 -4
- package/src/compute-weeks-in-window.test.ts +9 -7
- package/src/context.ts +1 -1
- package/src/day-cell.test.tsx +109 -0
- package/src/day-cell.tsx +132 -49
- package/src/drag-handle.tsx +23 -24
- package/src/formats/date.ts +120 -56
- package/src/formats/formats.test.ts +8 -4
- package/src/formats/object.ts +120 -56
- package/src/formats/plain-date-time.ts +120 -56
- package/src/formats/plain-date.ts +120 -56
- package/src/formats/plain-month-day.ts +120 -56
- package/src/formats/plain-year-month.ts +120 -56
- package/src/formats/zoned-date-time.ts +120 -56
- package/src/grid-header.tsx +24 -18
- package/src/grid.event-perf.test.tsx +30 -13
- package/src/grid.perf.test.tsx +97 -33
- package/src/grid.tsx +75 -43
- package/src/index.ts +16 -4
- package/src/keyboard.test.ts +110 -42
- package/src/keyboard.ts +18 -7
- package/src/month-separator.test.tsx +3 -1
- package/src/month-separator.tsx +30 -9
- package/src/month-view-context.ts +8 -3
- package/src/month-view-types.ts +14 -10
- package/src/month-view.test.tsx +687 -68
- package/src/month-view.tsx +176 -71
- package/src/navigation.tsx +77 -47
- package/src/overflow.test.ts +15 -13
- package/src/overflow.ts +10 -2
- package/src/range-preview.tsx +37 -12
- package/src/resolve-first-week.test.ts +14 -10
- package/src/resolve-first-week.ts +6 -2
- package/src/root-selection.ts +185 -101
- package/src/selected-range.tsx +47 -22
- package/src/test-temporal.ts +0 -2
- package/src/types.ts +126 -103
- package/src/utils.bench.ts +30 -6
- package/src/utils.test.ts +203 -55
- package/src/utils.ts +156 -54
- package/src/view-context.ts +4 -1
- package/src/week-number.tsx +5 -8
- package/src/weeks-grid.tsx +45 -19
- package/src/weeks-keyboard.test.ts +6 -7
- package/src/weeks-keyboard.ts +8 -3
- package/src/weeks-navigation.tsx +21 -9
- package/src/weeks-view-context.ts +8 -3
- package/src/weeks-view-state.ts +100 -33
- package/src/weeks-view-types.ts +14 -8
- package/src/weeks-view.test.tsx +127 -19
- package/src/weeks-view.tsx +30 -12
- package/src/temporal-polyfill.test.ts +0 -317
- package/src/temporal-polyfill.ts +0 -566
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
// @generated by scripts/generate-formats.ts — do not edit manually
|
|
2
2
|
type F = "ZonedDateTime";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { CalendarProvider as _CalendarProvider } from "../calendar-provider";
|
|
5
|
+
const CalendarProvider = _CalendarProvider<F>;
|
|
6
|
+
export { CalendarProvider };
|
|
7
|
+
|
|
8
|
+
import { MonthView as _MonthView } from "../month-view";
|
|
9
|
+
const MonthView = _MonthView<F>;
|
|
10
|
+
export { MonthView };
|
|
11
|
+
export { MonthViewRoot } from "../month-view";
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
Grid,
|
|
15
|
+
GridBody,
|
|
16
|
+
WeekTemplate,
|
|
17
|
+
DayCellTemplate,
|
|
18
|
+
DayButton,
|
|
19
|
+
} from "../grid";
|
|
9
20
|
|
|
10
21
|
export { GridHeader, GridHeaderCell } from "../grid-header";
|
|
11
22
|
|
|
12
|
-
export {
|
|
23
|
+
export {
|
|
24
|
+
DateString,
|
|
25
|
+
TimeString,
|
|
26
|
+
MonthYearString,
|
|
27
|
+
PrevMonthButton,
|
|
28
|
+
NextMonthButton,
|
|
29
|
+
} from "../navigation";
|
|
13
30
|
|
|
14
31
|
export { RangeSelected } from "../selected-range";
|
|
15
32
|
|
|
@@ -21,9 +38,20 @@ export { WeekNumberCell, WeekNumberHeader } from "../week-number";
|
|
|
21
38
|
|
|
22
39
|
export { WeeksView, WeeksViewRoot } from "../weeks-view";
|
|
23
40
|
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
export {
|
|
42
|
+
PrevWeeksButton,
|
|
43
|
+
NextWeeksButton,
|
|
44
|
+
WeekCount,
|
|
45
|
+
} from "../weeks-navigation";
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
MonthSeparator,
|
|
49
|
+
MonthSeparatorRow,
|
|
50
|
+
MonthSeparatorCell,
|
|
51
|
+
MonthSeparatorMonth,
|
|
52
|
+
MonthSeparatorYear,
|
|
53
|
+
MonthSeparatorWeekCount,
|
|
54
|
+
} from "../month-separator";
|
|
27
55
|
|
|
28
56
|
export { computePreviewRange } from "../root-selection";
|
|
29
57
|
|
|
@@ -31,8 +59,6 @@ export { computeWeeksInWindow } from "../compute-weeks-in-window";
|
|
|
31
59
|
|
|
32
60
|
export { resolveFirstWeek, resolveFirstWeekSpec } from "../resolve-first-week";
|
|
33
61
|
|
|
34
|
-
export { Temporal } from "../temporal-polyfill";
|
|
35
|
-
|
|
36
62
|
export { useCalendarStable, useCalendarState } from "../calendar-context";
|
|
37
63
|
|
|
38
64
|
export { useMonthViewStable, useMonthViewState } from "../month-view-context";
|
|
@@ -41,63 +67,101 @@ export { useViewContext } from "../view-context";
|
|
|
41
67
|
|
|
42
68
|
export { DayCellDataContext, WeekDataContext, GridContext } from "../context";
|
|
43
69
|
|
|
44
|
-
import type {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export type GridHeaderState = _GridHeaderState<F>;
|
|
50
|
-
export type GridHeaderCellProps = _GridHeaderCellProps<F>;
|
|
51
|
-
export type GridHeaderCellState = _GridHeaderCellState<F>;
|
|
52
|
-
export type GridBodyProps = _GridBodyProps<F>;
|
|
53
|
-
export type GridBodyState = _GridBodyState<F>;
|
|
54
|
-
export type WeekTemplateProps = _WeekTemplateProps<F>;
|
|
55
|
-
export type WeekTemplateState = _WeekTemplateState<F>;
|
|
56
|
-
export type DayCellTemplateProps = _DayCellTemplateProps<F>;
|
|
57
|
-
export type DayCellTemplateState = _DayCellTemplateState<F>;
|
|
58
|
-
export type DayButtonProps = _DayButtonProps<F>;
|
|
59
|
-
export type DayButtonState = _DayButtonState<F>;
|
|
60
|
-
export type RangeSelectedProps = _RangeSelectedProps<F>;
|
|
61
|
-
export type RangeSelectedState = _RangeSelectedState<F>;
|
|
62
|
-
export type RangePreviewProps = _RangePreviewProps<F>;
|
|
63
|
-
export type RangePreviewState = _RangePreviewState<F>;
|
|
64
|
-
export type DragHandleState = _DragHandleState<F>;
|
|
65
|
-
export type RangeStartDragHandleProps = _RangeStartDragHandleProps<F>;
|
|
66
|
-
export type RangeEndDragHandleProps = _RangeEndDragHandleProps<F>;
|
|
67
|
-
export type DateStringProps = _DateStringProps<F>;
|
|
68
|
-
export type DateStringState = _DateStringState<F>;
|
|
69
|
-
export type TimeStringProps = _TimeStringProps<F>;
|
|
70
|
-
export type TimeStringState = _TimeStringState<F>;
|
|
71
|
-
export type MonthYearStringProps = _MonthYearStringProps<F>;
|
|
72
|
-
export type MonthYearStringState = _MonthYearStringState<F>;
|
|
73
|
-
export type PrevMonthButtonProps = _PrevMonthButtonProps<F>;
|
|
74
|
-
export type NextMonthButtonProps = _NextMonthButtonProps<F>;
|
|
75
|
-
export type NavButtonState = _NavButtonState<F>;
|
|
70
|
+
import type {
|
|
71
|
+
DateRange as _DateRange,
|
|
72
|
+
ValueForFormat as _ValueForFormat,
|
|
73
|
+
RawValueForFormat as _RawValueForFormat,
|
|
74
|
+
} from "../types";
|
|
76
75
|
export type DateRange = _DateRange<F>;
|
|
77
76
|
export type ValueForFormat = _ValueForFormat<F>;
|
|
78
77
|
export type RawValueForFormat = _RawValueForFormat<F>;
|
|
79
|
-
export type
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
export type {
|
|
79
|
+
RootState,
|
|
80
|
+
GridProps,
|
|
81
|
+
GridState,
|
|
82
|
+
GridHeaderProps,
|
|
83
|
+
GridHeaderState,
|
|
84
|
+
GridHeaderCellProps,
|
|
85
|
+
GridHeaderCellState,
|
|
86
|
+
GridBodyProps,
|
|
87
|
+
GridBodyState,
|
|
88
|
+
WeekTemplateProps,
|
|
89
|
+
WeekTemplateState,
|
|
90
|
+
DayCellTemplateProps,
|
|
91
|
+
DayCellTemplateState,
|
|
92
|
+
DayButtonProps,
|
|
93
|
+
DayButtonState,
|
|
94
|
+
RangeSelectedProps,
|
|
95
|
+
RangeSelectedState,
|
|
96
|
+
RangePreviewProps,
|
|
97
|
+
RangePreviewState,
|
|
98
|
+
DragHandleOwnProps,
|
|
99
|
+
DragHandleState,
|
|
100
|
+
RangeStartDragHandleProps,
|
|
101
|
+
RangeEndDragHandleProps,
|
|
102
|
+
DateStringProps,
|
|
103
|
+
DateStringState,
|
|
104
|
+
TimeStringProps,
|
|
105
|
+
TimeStringState,
|
|
106
|
+
MonthYearStringProps,
|
|
107
|
+
MonthYearStringState,
|
|
108
|
+
PrevMonthButtonProps,
|
|
109
|
+
NextMonthButtonProps,
|
|
110
|
+
NavButtonState,
|
|
111
|
+
ValueFormat,
|
|
112
|
+
DateValueObject,
|
|
113
|
+
PlainDateObject,
|
|
114
|
+
TemporalNamespace,
|
|
115
|
+
WeekStartDay,
|
|
116
|
+
RangeMode,
|
|
117
|
+
OutsideDays,
|
|
118
|
+
ValueChangeMeta,
|
|
119
|
+
WeekNumberCellProps,
|
|
120
|
+
WeekNumberCellState,
|
|
121
|
+
WeekNumberHeaderProps,
|
|
122
|
+
WeekNumberHeaderState,
|
|
123
|
+
MonthData,
|
|
124
|
+
} from "../types";
|
|
84
125
|
|
|
85
126
|
import type { CalendarProviderProps as _CalendarProviderProps } from "../calendar-types";
|
|
86
127
|
export type CalendarProviderProps = _CalendarProviderProps<F>;
|
|
87
128
|
|
|
88
|
-
export type {
|
|
129
|
+
export type {
|
|
130
|
+
CalendarStableContextValue,
|
|
131
|
+
CalendarStateContextValue,
|
|
132
|
+
} from "../calendar-types";
|
|
89
133
|
|
|
90
|
-
export type {
|
|
134
|
+
export type {
|
|
135
|
+
MonthViewRootProps,
|
|
136
|
+
MonthViewStableContextValue,
|
|
137
|
+
MonthViewStateContextValue,
|
|
138
|
+
} from "../month-view-types";
|
|
91
139
|
|
|
92
|
-
|
|
140
|
+
import type { MonthViewProps as _MonthViewProps } from "../month-view";
|
|
141
|
+
export type MonthViewProps = _MonthViewProps<F>;
|
|
93
142
|
|
|
94
143
|
export type { ViewContextValue } from "../view-context";
|
|
95
144
|
|
|
96
|
-
export type {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
145
|
+
export type {
|
|
146
|
+
WeeksViewRootProps,
|
|
147
|
+
WeeksViewStableContextValue,
|
|
148
|
+
WeeksViewStateContextValue,
|
|
149
|
+
WindowInfo,
|
|
150
|
+
VisibleMonth,
|
|
151
|
+
} from "../weeks-view-types";
|
|
152
|
+
|
|
153
|
+
import type { WeeksViewProps as _WeeksViewProps } from "../weeks-view";
|
|
154
|
+
export type WeeksViewProps = _WeeksViewProps<F>;
|
|
155
|
+
export type { WeeksViewRootHandle } from "../weeks-view";
|
|
156
|
+
|
|
157
|
+
export type {
|
|
158
|
+
WeeksNavButtonState,
|
|
159
|
+
WeeksNavButtonOwnProps,
|
|
160
|
+
PrevWeeksButtonProps,
|
|
161
|
+
NextWeeksButtonProps,
|
|
162
|
+
WeekCountState,
|
|
163
|
+
WeekCountProps,
|
|
164
|
+
} from "../weeks-navigation";
|
|
101
165
|
|
|
102
166
|
export { useWeeksViewStable, useWeeksViewState } from "../weeks-view-context";
|
|
103
167
|
|
package/src/grid-header.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import { useCalendarStable } from "./calendar-context";
|
|
|
5
5
|
import { useMonthViewState } from "./month-view-context";
|
|
6
6
|
import type { StateAttributesMapping } from "./types";
|
|
7
7
|
import type {
|
|
8
|
-
ValueFormat,
|
|
9
8
|
GridHeaderCellProps,
|
|
10
9
|
GridHeaderState,
|
|
11
10
|
GridHeaderProps,
|
|
@@ -22,16 +21,22 @@ function useGridHeaderCellState(index: number) {
|
|
|
22
21
|
[locale, T, weekStartDay],
|
|
23
22
|
);
|
|
24
23
|
|
|
25
|
-
const state = useMemo<GridHeaderCellState>(
|
|
26
|
-
|
|
24
|
+
const state = useMemo<GridHeaderCellState>(() => {
|
|
25
|
+
// getWeekdayNames always returns one entry per weekday
|
|
26
|
+
const names = weekdayNames[index];
|
|
27
|
+
if (names === undefined) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`GridHeaderCell: index must be between 0 and ${weekdayNames.length - 1}, got ${index}.`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
27
33
|
root: rootState as unknown as GridHeaderCellState["root"],
|
|
28
34
|
dayOfWeek: index,
|
|
29
|
-
long:
|
|
30
|
-
short:
|
|
31
|
-
narrow:
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
+
long: names.long,
|
|
36
|
+
short: names.short,
|
|
37
|
+
narrow: names.narrow,
|
|
38
|
+
};
|
|
39
|
+
}, [rootState, index, weekdayNames]);
|
|
35
40
|
|
|
36
41
|
const defaultProps: Record<string, unknown> = {
|
|
37
42
|
scope: "col",
|
|
@@ -72,10 +77,8 @@ function GridHeaderCellInstanceFn(
|
|
|
72
77
|
});
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
const GridHeaderCellInstance = forwardRef(GridHeaderCellInstanceFn) as
|
|
76
|
-
|
|
77
|
-
>(
|
|
78
|
-
props: Omit<GridHeaderCellProps<F>, "index"> & {
|
|
80
|
+
const GridHeaderCellInstance = forwardRef(GridHeaderCellInstanceFn) as (
|
|
81
|
+
props: Omit<GridHeaderCellProps, "index"> & {
|
|
79
82
|
index: number;
|
|
80
83
|
} & React.RefAttributes<HTMLTableCellElement>,
|
|
81
84
|
) => React.ReactElement | null;
|
|
@@ -108,11 +111,14 @@ function GridHeaderCellFn(
|
|
|
108
111
|
* renders all 7 days (Sunday–Saturday). Each cell includes `abbr` and
|
|
109
112
|
* `aria-label` with the full weekday name.
|
|
110
113
|
*/
|
|
111
|
-
export const GridHeaderCell = forwardRef(GridHeaderCellFn) as
|
|
112
|
-
props: GridHeaderCellProps
|
|
114
|
+
export const GridHeaderCell = forwardRef(GridHeaderCellFn) as (
|
|
115
|
+
props: GridHeaderCellProps & React.RefAttributes<HTMLTableCellElement>,
|
|
113
116
|
) => React.ReactElement | null;
|
|
114
117
|
|
|
115
|
-
function GridHeaderFn(
|
|
118
|
+
function GridHeaderFn(
|
|
119
|
+
props: GridHeaderProps,
|
|
120
|
+
ref: React.ForwardedRef<HTMLTableSectionElement>,
|
|
121
|
+
) {
|
|
116
122
|
const { render, children, ...otherProps } = props;
|
|
117
123
|
const { rootState } = useMonthViewState();
|
|
118
124
|
|
|
@@ -136,6 +142,6 @@ function GridHeaderFn(props: GridHeaderProps, ref: React.ForwardedRef<HTMLTableS
|
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
/** Table header section (`<thead>`) wrapping a row of {@link GridHeaderCell}s. */
|
|
139
|
-
export const GridHeader = forwardRef(GridHeaderFn) as
|
|
140
|
-
props: GridHeaderProps
|
|
145
|
+
export const GridHeader = forwardRef(GridHeaderFn) as (
|
|
146
|
+
props: GridHeaderProps & React.RefAttributes<HTMLTableSectionElement>,
|
|
141
147
|
) => React.ReactElement | null;
|
|
@@ -2,7 +2,9 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import { render, act, fireEvent } from "@testing-library/react";
|
|
3
3
|
import { Profiler, type ProfilerOnRenderCallback } from "react";
|
|
4
4
|
// @vitest-environment jsdom
|
|
5
|
-
import { describe, it, expect, beforeAll } from "vitest";
|
|
5
|
+
import { describe, it, expect, beforeAll, type TestOptions } from "vitest";
|
|
6
|
+
|
|
7
|
+
const perfOptions: TestOptions = { retry: 3 };
|
|
6
8
|
import { Grid } from "./grid";
|
|
7
9
|
import { MonthView } from "./month-view";
|
|
8
10
|
|
|
@@ -15,7 +17,12 @@ type RenderEntry = {
|
|
|
15
17
|
|
|
16
18
|
function createProfiler() {
|
|
17
19
|
const entries: RenderEntry[] = [];
|
|
18
|
-
const onRender: ProfilerOnRenderCallback = (
|
|
20
|
+
const onRender: ProfilerOnRenderCallback = (
|
|
21
|
+
id,
|
|
22
|
+
phase,
|
|
23
|
+
actualDuration,
|
|
24
|
+
baseDuration,
|
|
25
|
+
) => {
|
|
19
26
|
entries.push({
|
|
20
27
|
id,
|
|
21
28
|
phase: phase as RenderEntry["phase"],
|
|
@@ -46,25 +53,27 @@ const march10 = Temporal.PlainDate.from("2026-03-10");
|
|
|
46
53
|
const march20 = Temporal.PlainDate.from("2026-03-20");
|
|
47
54
|
|
|
48
55
|
// Generous thresholds — for comparison, not regression.
|
|
49
|
-
const CLICK_THRESHOLD_MS =
|
|
50
|
-
const HOVER_THRESHOLD_MS =
|
|
51
|
-
const SWEEP_THRESHOLD_MS =
|
|
52
|
-
const MOUNT_THRESHOLD_MS =
|
|
56
|
+
const CLICK_THRESHOLD_MS = 120;
|
|
57
|
+
const HOVER_THRESHOLD_MS = 80;
|
|
58
|
+
const SWEEP_THRESHOLD_MS = 400;
|
|
59
|
+
const MOUNT_THRESHOLD_MS = 200;
|
|
53
60
|
|
|
54
61
|
const ITERATIONS = 5;
|
|
55
62
|
|
|
56
63
|
function median(values: number[]): number {
|
|
57
64
|
const sorted = [...values].sort((a, b) => a - b);
|
|
58
65
|
const mid = Math.floor(sorted.length / 2);
|
|
59
|
-
return sorted.length % 2 === 0
|
|
66
|
+
return sorted.length % 2 === 0
|
|
67
|
+
? (sorted[mid - 1]! + sorted[mid]!) / 2
|
|
68
|
+
: sorted[mid]!;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
function p95(values: number[]): number {
|
|
63
72
|
const sorted = [...values].sort((a, b) => a - b);
|
|
64
|
-
return sorted[Math.ceil(sorted.length * 0.95) - 1]
|
|
73
|
+
return sorted[Math.ceil(sorted.length * 0.95) - 1]!;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
describe("Grid event dispatch profiling", () => {
|
|
76
|
+
describe("Grid event dispatch profiling", perfOptions, () => {
|
|
68
77
|
beforeAll(() => {
|
|
69
78
|
const { unmount } = render(
|
|
70
79
|
<MonthView {...defaultProps} defaultValue={march15}>
|
|
@@ -90,7 +99,9 @@ describe("Grid event dispatch profiling", () => {
|
|
|
90
99
|
|
|
91
100
|
entries.length = 0;
|
|
92
101
|
|
|
93
|
-
const button = container.querySelector<HTMLElement>(
|
|
102
|
+
const button = container.querySelector<HTMLElement>(
|
|
103
|
+
'button[data-date="2026-03-20"]',
|
|
104
|
+
)!;
|
|
94
105
|
expect(button).toBeTruthy();
|
|
95
106
|
|
|
96
107
|
act(() => {
|
|
@@ -133,7 +144,9 @@ describe("Grid event dispatch profiling", () => {
|
|
|
133
144
|
|
|
134
145
|
entries.length = 0;
|
|
135
146
|
|
|
136
|
-
const button = container.querySelector<HTMLElement>(
|
|
147
|
+
const button = container.querySelector<HTMLElement>(
|
|
148
|
+
'button[data-date="2026-03-25"]',
|
|
149
|
+
)!;
|
|
137
150
|
expect(button).toBeTruthy();
|
|
138
151
|
|
|
139
152
|
act(() => {
|
|
@@ -178,7 +191,9 @@ describe("Grid event dispatch profiling", () => {
|
|
|
178
191
|
|
|
179
192
|
const days = Array.from({ length: 7 }, (_, i) => {
|
|
180
193
|
const day = String(i + 16).padStart(2, "0");
|
|
181
|
-
return container.querySelector<HTMLElement>(
|
|
194
|
+
return container.querySelector<HTMLElement>(
|
|
195
|
+
`button[data-date="2026-03-${day}"]`,
|
|
196
|
+
)!;
|
|
182
197
|
});
|
|
183
198
|
|
|
184
199
|
for (const d of days) expect(d).toBeTruthy();
|
|
@@ -227,7 +242,9 @@ describe("Grid event dispatch profiling", () => {
|
|
|
227
242
|
entries.length = 0;
|
|
228
243
|
|
|
229
244
|
// Click a day outside the current range to trigger a new range selection
|
|
230
|
-
const button = container.querySelector<HTMLElement>(
|
|
245
|
+
const button = container.querySelector<HTMLElement>(
|
|
246
|
+
'button[data-date="2026-03-25"]',
|
|
247
|
+
)!;
|
|
231
248
|
expect(button).toBeTruthy();
|
|
232
249
|
|
|
233
250
|
act(() => {
|