@marimo-team/frontend 0.25.2 → 0.25.3-dev10
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/assets/{CellStatus-BP2mavAq.js → CellStatus-nZpuDkm7.js} +1 -1
- package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-B4n9EnHB.js} +2 -2
- package/dist/assets/JsonOutput-BxB0NL8w.js +11 -0
- package/dist/assets/MarimoErrorOutput-BTy4MOzX.js +10 -0
- package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-9bMgbYmo.js} +1 -1
- package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-CFQUNN5c.js} +1 -1
- package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-f_MnLCwI.js} +9 -9
- package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-CoE_PhuD.js} +1 -1
- package/dist/assets/{agent-panel-D7kMZLG-.js → agent-panel-BWZz24jK.js} +5 -5
- package/dist/assets/ai-model-dropdown-zm-2fXzf.js +13 -0
- package/dist/assets/{app-config-button-BKEG4x9u.js → app-config-button-BhU0ulYs.js} +1 -1
- package/dist/assets/{blob-D5nfNHOo.js → blob-iOBwGaP9.js} +1 -1
- package/dist/assets/{cell-editor-ADVfycpN.js → cell-editor-CAj1UKxx.js} +9 -9
- package/dist/assets/{cell-link-LSth_8hT.js → cell-link-1CynTVGQ.js} +1 -1
- package/dist/assets/{cells-BRkCaSsh.js → cells-rA_jsZCj.js} +1 -1
- package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-BmEPmhDP.js} +1 -1
- package/dist/assets/{chat-panel-DQ6HkWEF.js → chat-panel-Ce2Xh7dM.js} +2 -2
- package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-DTy98rP3.js} +1 -1
- package/dist/assets/{column-preview-Cm2D6vyX.js → column-preview-DU6dT80y.js} +1 -1
- package/dist/assets/{command-palette-DTSQ7gOC.js → command-palette-BMqFKXVr.js} +1 -1
- package/dist/assets/{common-Cu6CDbuw.js → common-lisZ0l6a.js} +1 -1
- package/dist/assets/{components-CGw16R_N.js → components-Dvd1GnD6.js} +1 -1
- package/dist/assets/config-DJLAC21v.js +1 -0
- package/dist/assets/{datasource-Cq6x_5ML.js → datasource-Dr1xNKUn.js} +1 -1
- package/dist/assets/{dates-BbFQ2oE4.js → dates-CfmdTL6B.js} +1 -1
- package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-B0uP-_id.js} +1 -1
- package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-DVl_ebWy.js} +1 -1
- package/dist/assets/{download-DCJXy66H.js → download-Bx55LMki.js} +1 -1
- package/dist/assets/edit-page-DlfCLUaq.js +9 -0
- package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-DOWpdGvI.js} +1 -1
- package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-DpbNKSLs.js} +1 -1
- package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-B99ThNJW.js} +1 -1
- package/dist/assets/feedback-button-DlqZkJwz.js +1 -0
- package/dist/assets/{file-explorer-panel-BEEK5lcl.js → file-explorer-panel-Bo9eN3rW.js} +1 -1
- package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-ChnBsDE_.js} +1 -1
- package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-MYqQW4Vp.js} +1 -1
- package/dist/assets/{gallery-page-Dm6mGwBi.js → gallery-page-DSL0J4md.js} +1 -1
- package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-B1MWlKeM.js} +1 -1
- package/dist/assets/{home-page-DMHnsRxm.js → home-page-KrhQ55Vg.js} +1 -1
- package/dist/assets/{hooks-93IwHd2u.js → hooks-BIogTGCr.js} +1 -1
- package/dist/assets/index-6b4mf8Ai.css +2 -0
- package/dist/assets/{index-s-M1OXjs.js → index-B3fcrmuf.js} +8 -7
- package/dist/assets/{layout-DmcNEu3P.js → layout-DOpdUwym.js} +3 -3
- package/dist/assets/{logs-panel-ABM16htT.js → logs-panel-y0XnfulJ.js} +1 -1
- package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-Q5AhbRU3.js} +1 -1
- package/dist/assets/{name-cell-input-BgEBmqyL.js → name-cell-input-BNOnF6-0.js} +1 -1
- package/dist/assets/{outline-panel-DCXQ3_F6.js → outline-panel-Be7stWwv.js} +1 -1
- package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-ClxOAEGy.js} +1 -1
- package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-GeMEdCPw.js} +1 -1
- package/dist/assets/panels-DfCmzLtT.js +4 -0
- package/dist/assets/{process-output-D0KGq04R.js → process-output-DNFKMODr.js} +1 -1
- package/dist/assets/{readonly-code-display-Do50PHI8.js → readonly-code-display-YULOXf4h.js} +1 -1
- package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-CadgXgRu.js} +1 -1
- package/dist/assets/{reveal-component-ltaepAqw.js → reveal-component-BVAR7ayZ.js} +1 -1
- package/dist/assets/{run-page-DF3c5cDk.js → run-page-Cxu1yV8Q.js} +1 -1
- package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-DuChzsA6.js} +1 -1
- package/dist/assets/{scratchpad-panel-Dwd6W5PE.js → scratchpad-panel-By-ybhjg.js} +1 -1
- package/dist/assets/session-panel-BmW6PH4z.js +1 -0
- package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-CQ1dn3lA.js} +1 -1
- package/dist/assets/{state-XsPO8hNi.js → state-Bfh_2SLl.js} +1 -1
- package/dist/assets/state-z3dlofZB.js +3 -0
- package/dist/assets/{tracing-Di6pUmX8.js → tracing-BARlJ_Dk.js} +1 -1
- package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-dgnr2fIN.js} +2 -2
- package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-DAd80MbP.js} +1 -1
- package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-DGstJK0S.js} +1 -1
- package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-DY9RlJTb.js} +1 -1
- package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-DFBGlSQk.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-DydxsE5d.js} +1 -1
- package/dist/assets/{useNotebookActions-NHN6A-cN.js → useNotebookActions-DfvB7RD_.js} +1 -1
- package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-BFjFX3hz.js} +1 -1
- package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-Tqv5pPtL.js} +1 -1
- package/dist/index.html +24 -25
- package/package.json +5 -2
- package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
- package/src/__tests__/host-imports.test.ts +100 -0
- package/src/__tests__/mount.test.ts +8 -8
- package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
- package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
- package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
- package/src/components/data-table/context-menu.tsx +125 -26
- package/src/components/data-table/date-filter-inputs.tsx +15 -42
- package/src/components/data-table/export-actions.tsx +192 -116
- package/src/components/data-table/schemas.ts +14 -36
- package/src/components/data-table/utils.ts +18 -0
- package/src/components/editor/Output.tsx +9 -2
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
- package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
- package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
- package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
- package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
- package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
- package/src/components/editor/errors/send-error-report-button.tsx +69 -0
- package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
- package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
- package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/core/attachments/__tests__/toast.test.tsx +58 -0
- package/src/core/attachments/state.ts +21 -0
- package/src/core/attachments/toast.ts +15 -0
- package/src/core/cells/__tests__/cells.test.ts +52 -0
- package/src/core/cells/__tests__/error-report.test.ts +139 -0
- package/src/core/cells/__tests__/session.test.ts +50 -1
- package/src/core/cells/error-report.ts +63 -0
- package/src/core/cells/session.ts +28 -1
- package/src/core/config/pair.ts +5 -3
- package/src/core/host/AGENTS.md +6 -0
- package/src/core/host/__tests__/protocol.test.ts +214 -0
- package/src/core/host/protocol.ts +1943 -0
- package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
- package/src/core/islands/bootstrap.ts +1 -0
- package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
- package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
- package/src/mount.tsx +3 -3
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
- package/src/utils/__tests__/dates.test.ts +116 -0
- package/src/utils/dates.ts +94 -0
- package/dist/assets/JsonOutput-D6HIIsCb.js +0 -11
- package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
- package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
- package/dist/assets/api-BeC_VSGv.js +0 -1
- package/dist/assets/config-BOKzA3tF.js +0 -1
- package/dist/assets/edit-page-ChcSgpke.js +0 -9
- package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
- package/dist/assets/index-Bcdzex-3.css +0 -2
- package/dist/assets/pair-CaQyK6En.js +0 -1
- package/dist/assets/panels-CxVG8-v2.js +0 -4
- package/dist/assets/session-panel-VdDhEBa-.js +0 -1
- package/dist/assets/state-_Qai_QyX.js +0 -3
|
@@ -8,8 +8,8 @@ import { connectionAtom } from "@/core/network/connection";
|
|
|
8
8
|
import { store } from "@/core/state/jotai";
|
|
9
9
|
import { isStaticNotebook } from "@/core/static/static-state";
|
|
10
10
|
import { ConnectionState } from "@/core/websocket/types";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { pairConfigAtom } from "@/core/config/pair";
|
|
12
|
+
import { PAIR_CONFIG } from "./fixtures/pair-config";
|
|
13
13
|
import { mount, visibleForTesting } from "../mount";
|
|
14
14
|
|
|
15
15
|
// Mock React DOM
|
|
@@ -84,20 +84,20 @@ describe("mount", () => {
|
|
|
84
84
|
mockElement,
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
it("hydrates the server's Pair
|
|
88
|
-
const error = mountRead({
|
|
87
|
+
it("hydrates the server's Pair configuration", () => {
|
|
88
|
+
const error = mountRead({ pairConfig: PAIR_CONFIG });
|
|
89
89
|
|
|
90
90
|
expect(error).toBeUndefined();
|
|
91
|
-
expect(store.get(
|
|
91
|
+
expect(store.get(pairConfigAtom)).toEqual(PAIR_CONFIG);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
it("
|
|
95
|
-
store.set(
|
|
94
|
+
it("clears Pair configuration when the server omits it", () => {
|
|
95
|
+
store.set(pairConfigAtom, PAIR_CONFIG);
|
|
96
96
|
|
|
97
97
|
const error = mountRead();
|
|
98
98
|
|
|
99
99
|
expect(error).toBeUndefined();
|
|
100
|
-
expect(store.get(
|
|
100
|
+
expect(store.get(pairConfigAtom)).toBeUndefined();
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
describe("connection state initialization", () => {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
4
|
+
import { buildCellFilter } from "../context-menu";
|
|
5
|
+
|
|
6
|
+
describe("buildCellFilter", () => {
|
|
7
|
+
// Use a non-UTC, non-DST-ambiguous offset so date-only parsing bugs
|
|
8
|
+
// (UTC vs. local midnight) can't hide behind a host machine that
|
|
9
|
+
// happens to run in UTC.
|
|
10
|
+
let originalTimezone: string | undefined;
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
originalTimezone = process.env.TZ;
|
|
13
|
+
process.env.TZ = "America/New_York";
|
|
14
|
+
});
|
|
15
|
+
afterAll(() => {
|
|
16
|
+
process.env.TZ = originalTimezone;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("builds an equality filter for a normal date value", () => {
|
|
20
|
+
const filter = buildCellFilter({
|
|
21
|
+
type: "date",
|
|
22
|
+
value: "2024-01-15",
|
|
23
|
+
comparison: "eq",
|
|
24
|
+
dataType: "date",
|
|
25
|
+
dtype: "date",
|
|
26
|
+
});
|
|
27
|
+
expect(filter).toEqual({
|
|
28
|
+
type: "date",
|
|
29
|
+
operator: "==",
|
|
30
|
+
// Must be local midnight, not `new Date("2024-01-15")` (UTC
|
|
31
|
+
// midnight), or the filter shifts by a day in UTC- timezones.
|
|
32
|
+
value: new Date(2024, 0, 15),
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("returns undefined for an empty-string date value in a non-temporal-looking context", () => {
|
|
37
|
+
const filter = buildCellFilter({
|
|
38
|
+
type: "date",
|
|
39
|
+
value: "",
|
|
40
|
+
comparison: "eq",
|
|
41
|
+
dataType: "date",
|
|
42
|
+
dtype: "date",
|
|
43
|
+
});
|
|
44
|
+
expect(filter).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("returns undefined for an unparsable date value instead of an Invalid Date filter", () => {
|
|
48
|
+
const filter = buildCellFilter({
|
|
49
|
+
type: "date",
|
|
50
|
+
value: "not-a-date",
|
|
51
|
+
comparison: "eq",
|
|
52
|
+
dataType: "date",
|
|
53
|
+
dtype: "date",
|
|
54
|
+
});
|
|
55
|
+
expect(filter).toBeUndefined();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("builds an equality filter for a normal datetime value", () => {
|
|
59
|
+
const filter = buildCellFilter({
|
|
60
|
+
type: "datetime",
|
|
61
|
+
value: "2024-01-15 08:30:00",
|
|
62
|
+
comparison: "eq",
|
|
63
|
+
dataType: "datetime",
|
|
64
|
+
dtype: "datetime64[ns]",
|
|
65
|
+
});
|
|
66
|
+
expect(filter).toEqual({
|
|
67
|
+
type: "datetime",
|
|
68
|
+
operator: "==",
|
|
69
|
+
value: new Date(2024, 0, 15, 8, 30, 0),
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("returns undefined for an unparsable datetime value", () => {
|
|
74
|
+
const filter = buildCellFilter({
|
|
75
|
+
type: "datetime",
|
|
76
|
+
value: "not-a-datetime",
|
|
77
|
+
comparison: "eq",
|
|
78
|
+
dataType: "datetime",
|
|
79
|
+
dtype: "datetime64[ns]",
|
|
80
|
+
});
|
|
81
|
+
expect(filter).toBeUndefined();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("builds an equality filter for a normal time value", () => {
|
|
85
|
+
const filter = buildCellFilter({
|
|
86
|
+
type: "time",
|
|
87
|
+
value: "08:30:00",
|
|
88
|
+
comparison: "eq",
|
|
89
|
+
dataType: "time",
|
|
90
|
+
});
|
|
91
|
+
expect(filter).toEqual({
|
|
92
|
+
type: "time",
|
|
93
|
+
operator: "==",
|
|
94
|
+
value: new Date(1970, 0, 1, 8, 30, 0),
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("returns undefined instead of an unparsable time value", () => {
|
|
99
|
+
const filter = buildCellFilter({
|
|
100
|
+
type: "time",
|
|
101
|
+
value: "25:00:00",
|
|
102
|
+
comparison: "eq",
|
|
103
|
+
dataType: "time",
|
|
104
|
+
});
|
|
105
|
+
expect(filter).toBeUndefined();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("maps a NaT date value to is_null instead of an invalid Date filter", () => {
|
|
109
|
+
const filter = buildCellFilter({
|
|
110
|
+
type: "date",
|
|
111
|
+
value: "NaT",
|
|
112
|
+
comparison: "eq",
|
|
113
|
+
dataType: "date",
|
|
114
|
+
dtype: "date",
|
|
115
|
+
});
|
|
116
|
+
expect(filter).toEqual({ type: "date", operator: "is_null" });
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("maps a NaT datetime value to is_not_null for the neq comparison", () => {
|
|
120
|
+
const filter = buildCellFilter({
|
|
121
|
+
type: "datetime",
|
|
122
|
+
value: "NaT",
|
|
123
|
+
comparison: "neq",
|
|
124
|
+
dataType: "datetime",
|
|
125
|
+
dtype: "datetime64[ns]",
|
|
126
|
+
});
|
|
127
|
+
expect(filter).toEqual({ type: "datetime", operator: "is_not_null" });
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("does not treat the string 'NaT' in a non-temporal column as a sentinel", () => {
|
|
131
|
+
const filter = buildCellFilter({
|
|
132
|
+
type: "text",
|
|
133
|
+
value: "NaT",
|
|
134
|
+
comparison: "eq",
|
|
135
|
+
dataType: "string",
|
|
136
|
+
});
|
|
137
|
+
expect(filter).toEqual({ type: "text", operator: "equals", text: "NaT" });
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("maps an actual null value to is_null", () => {
|
|
141
|
+
const filter = buildCellFilter({
|
|
142
|
+
type: "number",
|
|
143
|
+
value: null,
|
|
144
|
+
comparison: "eq",
|
|
145
|
+
dataType: "number",
|
|
146
|
+
});
|
|
147
|
+
expect(filter).toEqual({ type: "number", operator: "is_null" });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("builds a literal (always-false) equality filter for a NaN number value", () => {
|
|
151
|
+
// NaN is a real float value, not a missing-value marker like null/NaT,
|
|
152
|
+
// and the backend's is_null() (narwhals/polars semantics) doesn't match
|
|
153
|
+
// it, so it falls through to a normal (if unsatisfiable) == filter.
|
|
154
|
+
const filter = buildCellFilter({
|
|
155
|
+
type: "number",
|
|
156
|
+
value: Number.NaN,
|
|
157
|
+
comparison: "eq",
|
|
158
|
+
dataType: "number",
|
|
159
|
+
});
|
|
160
|
+
expect(filter).toEqual({
|
|
161
|
+
type: "number",
|
|
162
|
+
operator: "==",
|
|
163
|
+
value: Number.NaN,
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("builds a literal equality filter for a normal number value", () => {
|
|
168
|
+
const filter = buildCellFilter({
|
|
169
|
+
type: "number",
|
|
170
|
+
value: 42,
|
|
171
|
+
comparison: "eq",
|
|
172
|
+
dataType: "number",
|
|
173
|
+
});
|
|
174
|
+
expect(filter).toEqual({ type: "number", operator: "==", value: 42 });
|
|
175
|
+
});
|
|
176
|
+
});
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
3
|
import { dateToLocalISODate } from "@/utils/dates";
|
|
4
|
-
import { parsePastedRange } from "../date-filter-inputs";
|
|
4
|
+
import { parsePastedDate, parsePastedRange } from "../date-filter-inputs";
|
|
5
|
+
|
|
6
|
+
describe("parsePastedDate", () => {
|
|
7
|
+
it("parses a time-only string for the time filter type", () => {
|
|
8
|
+
const result = parsePastedDate("time", "2:30 PM");
|
|
9
|
+
expect(result).toEqual(new Date(1970, 0, 1, 14, 30));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("parses a local ISO datetime for the datetime filter type", () => {
|
|
13
|
+
const result = parsePastedDate("datetime", "2026-02-01T08:30:00");
|
|
14
|
+
expect(result).toEqual(new Date(2026, 1, 1, 8, 30, 0));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("falls back to the Date constructor for other formats", () => {
|
|
18
|
+
const result = parsePastedDate("datetime", "Feb 1, 2026 08:30:00");
|
|
19
|
+
expect(result).toBeDefined();
|
|
20
|
+
expect(result?.getFullYear()).toBe(2026);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("returns undefined for an empty or unparsable string", () => {
|
|
24
|
+
expect(parsePastedDate("date", "")).toBeUndefined();
|
|
25
|
+
expect(parsePastedDate("time", "not-a-time")).toBeUndefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
5
28
|
|
|
6
29
|
describe("parsePastedRange", () => {
|
|
7
30
|
it.each([
|
|
@@ -54,6 +54,7 @@ function renderExportActions(
|
|
|
54
54
|
props: Partial<ExportActionProps> = {},
|
|
55
55
|
sizeLimit: { limitBytes: number; unavailableMessage: string } | null = null,
|
|
56
56
|
mode: AppMode = "edit",
|
|
57
|
+
strictMode = false,
|
|
57
58
|
) {
|
|
58
59
|
const store = createStore();
|
|
59
60
|
store.set(downloadSizeLimitAtom, sizeLimit);
|
|
@@ -66,7 +67,7 @@ function renderExportActions(
|
|
|
66
67
|
</TooltipProvider>
|
|
67
68
|
</Provider>
|
|
68
69
|
);
|
|
69
|
-
const result = render(view(props));
|
|
70
|
+
const result = render(view(props), { reactStrictMode: strictMode });
|
|
70
71
|
return {
|
|
71
72
|
...result,
|
|
72
73
|
rerenderExportActions: (nextProps: Partial<ExportActionProps>) =>
|
|
@@ -284,7 +285,7 @@ describe("ExportActions dialog", () => {
|
|
|
284
285
|
await waitFor(() => {
|
|
285
286
|
expect(downloadByURL).toHaveBeenCalled();
|
|
286
287
|
});
|
|
287
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
288
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
288
289
|
expect(
|
|
289
290
|
screen.queryByText("GeoParquet export requires pyarrow."),
|
|
290
291
|
).not.toBeInTheDocument();
|
|
@@ -310,10 +311,10 @@ describe("ExportActions dialog", () => {
|
|
|
310
311
|
mocks.handleInstallPackages.mock.calls[0][1]();
|
|
311
312
|
});
|
|
312
313
|
await waitFor(() => {
|
|
313
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
314
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
314
315
|
});
|
|
315
316
|
expect(
|
|
316
|
-
screen.
|
|
317
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
317
318
|
).toBeInTheDocument();
|
|
318
319
|
expect(
|
|
319
320
|
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
@@ -530,6 +531,328 @@ describe("ExportActions dialog", () => {
|
|
|
530
531
|
expect(downloadByURL).not.toHaveBeenCalled();
|
|
531
532
|
});
|
|
532
533
|
|
|
534
|
+
async function startGeoParquetInstall(strictMode = false) {
|
|
535
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
536
|
+
downloadAs.mockResolvedValueOnce({
|
|
537
|
+
url: "",
|
|
538
|
+
filename: "",
|
|
539
|
+
error: "GeoParquet export requires pyarrow.",
|
|
540
|
+
missing_packages: ["pyarrow"],
|
|
541
|
+
});
|
|
542
|
+
const { rerenderExportActions, unmount } = renderExportActions(
|
|
543
|
+
{ getExportMetadata, metadataSource: "first" },
|
|
544
|
+
null,
|
|
545
|
+
"edit",
|
|
546
|
+
strictMode,
|
|
547
|
+
);
|
|
548
|
+
const dialog = await openDialog();
|
|
549
|
+
fireEvent.click(
|
|
550
|
+
await screen.findByRole("button", { name: "Download GeoParquet" }),
|
|
551
|
+
);
|
|
552
|
+
fireEvent.click(
|
|
553
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
554
|
+
);
|
|
555
|
+
return { dialog, getExportMetadata, rerenderExportActions, unmount };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
it("does not retry with a geometry choice after the final geometry disappears", async () => {
|
|
559
|
+
const { getExportMetadata } = await startGeoParquetInstall();
|
|
560
|
+
getExportMetadata.mockResolvedValue({
|
|
561
|
+
geometry_columns: [],
|
|
562
|
+
primary_geometry_column: null,
|
|
563
|
+
default_geometry_column: null,
|
|
564
|
+
formats: {},
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
568
|
+
|
|
569
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
570
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
571
|
+
expect(
|
|
572
|
+
await screen.findByText(
|
|
573
|
+
"The selected geometry is no longer available. Choose another geometry to export.",
|
|
574
|
+
),
|
|
575
|
+
).toBeInTheDocument();
|
|
576
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
577
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
578
|
+
expect(downloadAs).toHaveBeenLastCalledWith({ format: "parquet" });
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
it("does not export when installation finishes after the widget unmounts", async () => {
|
|
582
|
+
const { getExportMetadata, unmount } = await startGeoParquetInstall();
|
|
583
|
+
unmount();
|
|
584
|
+
|
|
585
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
586
|
+
|
|
587
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(1);
|
|
588
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
589
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it("does not export when post-install metadata resolves after unmount", async () => {
|
|
593
|
+
const { getExportMetadata, unmount } = await startGeoParquetInstall();
|
|
594
|
+
let resolveCheck: (value: ExportMetadata) => void = () => undefined;
|
|
595
|
+
getExportMetadata.mockImplementationOnce(
|
|
596
|
+
() =>
|
|
597
|
+
new Promise<ExportMetadata>((resolve) => {
|
|
598
|
+
resolveCheck = resolve;
|
|
599
|
+
}),
|
|
600
|
+
);
|
|
601
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
602
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
603
|
+
unmount();
|
|
604
|
+
|
|
605
|
+
await act(async () => resolveCheck(geometryMetadata));
|
|
606
|
+
|
|
607
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
608
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it("does not deliver a retried export that resolves after unmount", async () => {
|
|
612
|
+
const { unmount } = await startGeoParquetInstall();
|
|
613
|
+
let resolveDownload: (value: {
|
|
614
|
+
url: string;
|
|
615
|
+
filename: string;
|
|
616
|
+
}) => void = () => undefined;
|
|
617
|
+
downloadAs.mockImplementationOnce(
|
|
618
|
+
() =>
|
|
619
|
+
new Promise((resolve) => {
|
|
620
|
+
resolveDownload = resolve;
|
|
621
|
+
}),
|
|
622
|
+
);
|
|
623
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
624
|
+
expect(downloadAs).toHaveBeenCalledTimes(2);
|
|
625
|
+
unmount();
|
|
626
|
+
|
|
627
|
+
await act(async () =>
|
|
628
|
+
resolveDownload({
|
|
629
|
+
url: "https://example.test/export",
|
|
630
|
+
filename: "table",
|
|
631
|
+
}),
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it("retries after installation under StrictMode effect replay", async () => {
|
|
638
|
+
await startGeoParquetInstall(true);
|
|
639
|
+
|
|
640
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
641
|
+
|
|
642
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
643
|
+
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
644
|
+
format: "parquet",
|
|
645
|
+
geometry_column: "location",
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
it("does not export when installation finishes after the dialog closes", async () => {
|
|
650
|
+
const { dialog, getExportMetadata } = await startGeoParquetInstall();
|
|
651
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
652
|
+
await waitFor(() => {
|
|
653
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
657
|
+
|
|
658
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(1);
|
|
659
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
660
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
it("does not export when installation finishes after the source changes", async () => {
|
|
664
|
+
const { getExportMetadata, rerenderExportActions } =
|
|
665
|
+
await startGeoParquetInstall();
|
|
666
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
667
|
+
await waitFor(() => {
|
|
668
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
672
|
+
|
|
673
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(2);
|
|
674
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
675
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
it("does not export a non-geographic retry after the dialog closes", async () => {
|
|
679
|
+
downloadAs.mockResolvedValueOnce({
|
|
680
|
+
url: "",
|
|
681
|
+
filename: "",
|
|
682
|
+
error: "Parquet export requires pyarrow.",
|
|
683
|
+
missing_packages: ["pyarrow"],
|
|
684
|
+
});
|
|
685
|
+
renderExportActions();
|
|
686
|
+
const dialog = await openDialog();
|
|
687
|
+
fireEvent.click(screen.getByRole("button", { name: "Download Parquet" }));
|
|
688
|
+
fireEvent.click(
|
|
689
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
690
|
+
);
|
|
691
|
+
fireEvent.click(within(dialog).getByRole("button", { name: "Close" }));
|
|
692
|
+
|
|
693
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
694
|
+
|
|
695
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
696
|
+
expect(downloadByURL).not.toHaveBeenCalled();
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
it("retries after installation when an earlier export succeeded", async () => {
|
|
700
|
+
const getExportMetadata = vi.fn().mockResolvedValue({
|
|
701
|
+
...geometryMetadata,
|
|
702
|
+
formats: {
|
|
703
|
+
parquet: {
|
|
704
|
+
available: false,
|
|
705
|
+
reason: "GeoParquet export requires pyarrow.",
|
|
706
|
+
missing_packages: ["pyarrow"],
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
});
|
|
710
|
+
renderExportActions({ getExportMetadata });
|
|
711
|
+
await openDialog();
|
|
712
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
713
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(1));
|
|
714
|
+
fireEvent.click(
|
|
715
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
716
|
+
);
|
|
717
|
+
getExportMetadata.mockResolvedValue(geometryMetadata);
|
|
718
|
+
|
|
719
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
720
|
+
|
|
721
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalledTimes(2));
|
|
722
|
+
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
723
|
+
format: "parquet",
|
|
724
|
+
geometry_column: "location",
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
it("waits for the post-install metadata check before exporting", async () => {
|
|
729
|
+
let resolveCheck: (value: ExportMetadata) => void = () => undefined;
|
|
730
|
+
const getExportMetadata = vi.fn().mockResolvedValue({
|
|
731
|
+
...geometryMetadata,
|
|
732
|
+
formats: {
|
|
733
|
+
parquet: {
|
|
734
|
+
available: false,
|
|
735
|
+
reason: "GeoParquet export requires pyarrow.",
|
|
736
|
+
missing_packages: ["pyarrow"],
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
});
|
|
740
|
+
renderExportActions({ getExportMetadata });
|
|
741
|
+
await openDialog();
|
|
742
|
+
fireEvent.click(
|
|
743
|
+
await screen.findByRole("button", { name: "Install pyarrow" }),
|
|
744
|
+
);
|
|
745
|
+
getExportMetadata.mockImplementationOnce(
|
|
746
|
+
() =>
|
|
747
|
+
new Promise((resolve) => {
|
|
748
|
+
resolveCheck = resolve;
|
|
749
|
+
}),
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
753
|
+
expect(downloadAs).not.toHaveBeenCalled();
|
|
754
|
+
|
|
755
|
+
getExportMetadata.mockResolvedValue(geometryMetadata);
|
|
756
|
+
await act(async () => resolveCheck(geometryMetadata));
|
|
757
|
+
await waitFor(() => expect(downloadByURL).toHaveBeenCalled());
|
|
758
|
+
expect(downloadAs).toHaveBeenCalledTimes(1);
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
it("uses the new source eligibility after a settled package failure", async () => {
|
|
762
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
763
|
+
downloadAs.mockResolvedValueOnce({
|
|
764
|
+
url: "",
|
|
765
|
+
filename: "",
|
|
766
|
+
error: "GeoParquet export requires pyarrow.",
|
|
767
|
+
missing_packages: ["pyarrow"],
|
|
768
|
+
});
|
|
769
|
+
const { rerenderExportActions } = renderExportActions({
|
|
770
|
+
getExportMetadata,
|
|
771
|
+
metadataSource: "first",
|
|
772
|
+
});
|
|
773
|
+
await openDialog();
|
|
774
|
+
fireEvent.click(
|
|
775
|
+
await screen.findByRole("button", { name: "Download GeoParquet" }),
|
|
776
|
+
);
|
|
777
|
+
await screen.findByRole("button", { name: "Install pyarrow" });
|
|
778
|
+
|
|
779
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
780
|
+
|
|
781
|
+
await waitFor(() =>
|
|
782
|
+
expect(
|
|
783
|
+
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
784
|
+
).toBeEnabled(),
|
|
785
|
+
);
|
|
786
|
+
expect(
|
|
787
|
+
screen.queryByRole("button", { name: "Install pyarrow" }),
|
|
788
|
+
).not.toBeInTheDocument();
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
it("ignores metadata for an earlier source that resolves late", async () => {
|
|
792
|
+
let resolveFirst: (value: ExportMetadata) => void = () => undefined;
|
|
793
|
+
const first = vi.fn(
|
|
794
|
+
() =>
|
|
795
|
+
new Promise<ExportMetadata>((resolve) => {
|
|
796
|
+
resolveFirst = resolve;
|
|
797
|
+
}),
|
|
798
|
+
);
|
|
799
|
+
const second = vi.fn().mockResolvedValue({
|
|
800
|
+
...geometryMetadata,
|
|
801
|
+
geometry_columns: [
|
|
802
|
+
{ name: "region", encoding: "objects", crs: "EPSG:3857" },
|
|
803
|
+
],
|
|
804
|
+
primary_geometry_column: "region",
|
|
805
|
+
default_geometry_column: "region",
|
|
806
|
+
});
|
|
807
|
+
const { rerenderExportActions } = renderExportActions({
|
|
808
|
+
getExportMetadata: first,
|
|
809
|
+
metadataSource: "first",
|
|
810
|
+
});
|
|
811
|
+
await openDialog();
|
|
812
|
+
rerenderExportActions({
|
|
813
|
+
getExportMetadata: second,
|
|
814
|
+
metadataSource: "second",
|
|
815
|
+
});
|
|
816
|
+
await waitFor(() =>
|
|
817
|
+
expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
|
|
818
|
+
"region",
|
|
819
|
+
),
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
await act(async () => resolveFirst(geometryMetadata));
|
|
823
|
+
|
|
824
|
+
expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
|
|
825
|
+
"region",
|
|
826
|
+
);
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
it("does not use earlier metadata when the new source request fails", async () => {
|
|
830
|
+
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
831
|
+
const { rerenderExportActions } = renderExportActions({
|
|
832
|
+
getExportMetadata,
|
|
833
|
+
metadataSource: "first",
|
|
834
|
+
});
|
|
835
|
+
await openDialog();
|
|
836
|
+
await waitFor(() =>
|
|
837
|
+
expect(
|
|
838
|
+
screen.getByRole("button", { name: "Download GeoParquet" }),
|
|
839
|
+
).toBeEnabled(),
|
|
840
|
+
);
|
|
841
|
+
getExportMetadata.mockRejectedValueOnce(new Error("Connection lost"));
|
|
842
|
+
|
|
843
|
+
rerenderExportActions({ getExportMetadata, metadataSource: "second" });
|
|
844
|
+
|
|
845
|
+
expect(
|
|
846
|
+
await screen.findByText(
|
|
847
|
+
"Could not load geometry options: Connection lost",
|
|
848
|
+
),
|
|
849
|
+
).toBeInTheDocument();
|
|
850
|
+
expect(
|
|
851
|
+
screen.getByRole("button", { name: "Download Parquet" }),
|
|
852
|
+
).toBeDisabled();
|
|
853
|
+
expect(screen.getByRole("button", { name: "Download CSV" })).toBeEnabled();
|
|
854
|
+
});
|
|
855
|
+
|
|
533
856
|
it("shows formats in the approved order with an options toggle where supported", async () => {
|
|
534
857
|
renderExportActions();
|
|
535
858
|
const dialog = await openDialog();
|
|
@@ -1412,7 +1735,7 @@ describe("ExportActions GeoJSON", () => {
|
|
|
1412
1735
|
);
|
|
1413
1736
|
await act(async () => mocks.handleInstallPackages.mock.calls[0][1]());
|
|
1414
1737
|
await waitFor(() => expect(downloadByURL).toHaveBeenCalled());
|
|
1415
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
1738
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
1416
1739
|
expect(downloadAs).toHaveBeenLastCalledWith({
|
|
1417
1740
|
format: "geojson",
|
|
1418
1741
|
geometry_column: "boundary",
|
|
@@ -1685,7 +2008,7 @@ describe("ExportActions GeoJSON clipboard", () => {
|
|
|
1685
2008
|
format: "geojson",
|
|
1686
2009
|
geometry_column: "boundary",
|
|
1687
2010
|
});
|
|
1688
|
-
expect(getExportMetadata).toHaveBeenCalledTimes(
|
|
2011
|
+
expect(getExportMetadata).toHaveBeenCalledTimes(3);
|
|
1689
2012
|
expect(downloadByURL).not.toHaveBeenCalled();
|
|
1690
2013
|
});
|
|
1691
2014
|
|