@marimo-team/frontend 0.24.1-dev99 → 0.24.2-dev129
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-wvvZkEPY.js → CellStatus-LoTwk7fR.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-Dkqk66Mv.js → ConnectedDataExplorerComponent-DW6cJ-Lr.js} +1 -1
- package/dist/assets/{ErrorBoundary-npvnLp9x.js → ErrorBoundary-CDVGFYfr.js} +1 -1
- package/dist/assets/JsonOutput-CzIGPEZQ.js +50 -0
- package/dist/assets/{LazyAnyLanguageCodeMirror-zSwE3dvU.js → LazyAnyLanguageCodeMirror-LboTfNDv.js} +2 -2
- package/dist/assets/{MarimoErrorOutput-CeUo5oka.js → MarimoErrorOutput-DqpoYOvw.js} +1 -1
- package/dist/assets/RenderHTML-DwhMAd9l.js +1 -0
- package/dist/assets/{RunButton-BaV8A-z4.js → RunButton-BlpbweyH.js} +1 -1
- package/dist/assets/{VisuallyHidden-SChAyKIQ.js → VisuallyHidden-CBMDmozt.js} +1 -1
- package/dist/assets/{add-cell-with-ai-DoLkfzYn.js → add-cell-with-ai-R-3DS79K.js} +1 -1
- package/dist/assets/{add-connection-dialog-C1IF1nR0.js → add-connection-dialog-BGfpw5lC.js} +1 -1
- package/dist/assets/{agent-panel-CG154QrU.js → agent-panel-Cgt_K0tD.js} +1 -1
- package/dist/assets/ai-model-dropdown-DCmiuk7x.js +3 -0
- package/dist/assets/alert-dialog-CA-2mBs3.js +11 -0
- package/dist/assets/any-language-editor-DflLjPSQ.js +1 -0
- package/dist/assets/{app-config-button-ktBH1pEB.js → app-config-button-DUJC6b6x.js} +1 -1
- package/dist/assets/badge-BSgtkC2e.js +1 -0
- package/dist/assets/{blob-DVtvZmWH.js → blob-B2d_dHwI.js} +1 -1
- package/dist/assets/button-Dh8EwhsF.js +1 -0
- package/dist/assets/{cache-panel-C7jsiqCa.js → cache-panel-DqgtC98s.js} +1 -1
- package/dist/assets/{capabilities-LWzb3E3M.js → capabilities-D8kPgMKr.js} +1 -1
- package/dist/assets/{cell-editor-DoDqaCZp.js → cell-editor-Dw09J9yD.js} +6 -6
- package/dist/assets/{cell-link-Dqqt6Rgs.js → cell-link-6burT2XF.js} +1 -1
- package/dist/assets/{cells-D4RwofRx.js → cells-Cp-G34Rz.js} +56 -56
- package/dist/assets/{chat-display-COmzHgx5.js → chat-display-Bu405iyc.js} +1 -1
- package/dist/assets/{chat-panel-B2tyEfGW.js → chat-panel-BlUwNY5j.js} +1 -1
- package/dist/assets/{chat-ui-B5bsr-7V.js → chat-ui-DGiVDzNh.js} +1 -1
- package/dist/assets/{circle--ysFeW9z.js → circle-ByJdIf5p.js} +1 -1
- package/dist/assets/{column-preview-CW5DPFvy.js → column-preview-riSXbYe_.js} +1 -1
- package/dist/assets/{command-palette-B9dyvMvJ.js → command-palette-CCVzJcyf.js} +1 -1
- package/dist/assets/{common-CC3tuCpi.js → common-CHR7w7aQ.js} +1 -1
- package/dist/assets/{components-D02ZZZMP.js → components-C7mWrmXr.js} +1 -1
- package/dist/assets/{components-CBlGIIAX.js → components-DUYCXngU.js} +1 -1
- package/dist/assets/config-B-r81uZ6.js +1 -0
- package/dist/assets/{config-D4frVGQ4.js → config-BlNM0caL.js} +1 -1
- package/dist/assets/{copy-Cg05mM3C.js → copy-DlEomWzI.js} +1 -1
- package/dist/assets/{copy-icon-CRxVZTJ9.js → copy-icon-z8fuTE3w.js} +1 -1
- package/dist/assets/{createReducer-Bq-nQJiK.js → createReducer-B_XmHROl.js} +1 -1
- package/dist/assets/{datasource-Do8f2hFf.js → datasource-DrODSIs0.js} +1 -1
- package/dist/assets/{dates-DK5JikJo.js → dates-B58T85Jq.js} +1 -1
- package/dist/assets/dependency-graph-panel-AY5BEVH2.js +5 -0
- package/dist/assets/{dist-7qdHLg-L.js → dist-B0RXffUm.js} +1 -1
- package/dist/assets/dist-B0qYy1Ye.js +1 -0
- package/dist/assets/{dist-B97dKQGP.js → dist-B8pdsUrS.js} +1 -1
- package/dist/assets/{dist-BcfF-rkl.js → dist-BF7Lrekv.js} +1 -1
- package/dist/assets/dist-BL8RjfvI.js +1 -0
- package/dist/assets/dist-BVZxge7j.js +1 -0
- package/dist/assets/{dist-fxnYzq-R.js → dist-BaRNSaca.js} +1 -1
- package/dist/assets/dist-Bk2yQtw4.js +1 -0
- package/dist/assets/dist-BsfiiKoy.js +1 -0
- package/dist/assets/dist-BskmVd3B.js +1 -0
- package/dist/assets/{dist-DL1Thauf.js → dist-Bsu3h9O7.js} +1 -1
- package/dist/assets/{dist-PIe1xcZo.js → dist-BtC9ym6k.js} +7 -7
- package/dist/assets/{dist-DeuWxYVk.js → dist-Bv0S1RlZ.js} +1 -1
- package/dist/assets/{dist-CidBzUqR.js → dist-C--ZICxQ.js} +1 -1
- package/dist/assets/dist-C-2fD3XY.js +1 -0
- package/dist/assets/{dist-DzAWvPVK.js → dist-CKUpxYGQ.js} +1 -1
- package/dist/assets/dist-CMFMfBm1.js +1 -0
- package/dist/assets/dist-CZNULd6Z.js +2 -0
- package/dist/assets/dist-CjFduPiC.js +1 -0
- package/dist/assets/{dist-DoAjHgMj.js → dist-CmImLjus.js} +1 -1
- package/dist/assets/{dist-BKx0MLbb.js → dist-Cq8NOszX.js} +1 -1
- package/dist/assets/{dist-DCc0VfiO.js → dist-Cx4BE7jC.js} +3 -3
- package/dist/assets/dist-D45ScydS.js +1 -0
- package/dist/assets/dist-D6dg87r7.js +1 -0
- package/dist/assets/dist-DEjfQLz0.js +1 -0
- package/dist/assets/{dist-BcYW-EJk.js → dist-DJOWOALB.js} +1 -1
- package/dist/assets/{dist-CxxZaSme.js → dist-DPoYlxSC.js} +1 -1
- package/dist/assets/dist-DR-Y-nl3.js +1 -0
- package/dist/assets/dist-Dahlp9JQ.js +1 -0
- package/dist/assets/{dist-DIkuvChK.js → dist-Db-HC93w.js} +1 -1
- package/dist/assets/{dist-DTM7BAUu.js → dist-DdOlZ6mj.js} +1 -1
- package/dist/assets/{dist-Dz_04liz.js → dist-DiYjQAhI.js} +1 -1
- package/dist/assets/{dist-BO5c5n_b.js → dist-DkPPv0FB.js} +1 -1
- package/dist/assets/{dist-DkCO0b-0.js → dist-DmGtPaVM.js} +1 -1
- package/dist/assets/{dist-CXmhxecl.js → dist-DnxYYyU7.js} +1 -1
- package/dist/assets/{dist-CO1Hfv5H.js → dist-Dw9YRsCU.js} +1 -1
- package/dist/assets/dist-Dwx3KdUP.js +1 -0
- package/dist/assets/{dist-BgL43w5r.js → dist-DzCQtGkt.js} +1 -1
- package/dist/assets/dist-JweaDt6P.js +1 -0
- package/dist/assets/{dist-Dbu5sPgR.js → dist-gELFCfHH.js} +1 -1
- package/dist/assets/dist-kGDJ0AWF.js +1 -0
- package/dist/assets/{dist-Cqm1W-Zm.js → dist-kaLvV_d4.js} +1 -1
- package/dist/assets/{dist-CEeRVpMD.js → dist-qvk3g06H.js} +1 -1
- package/dist/assets/dist-wCw2twuB.js +1 -0
- package/dist/assets/dist-wF42tUcr.js +1 -0
- package/dist/assets/dist-wY2yia-1.js +3 -0
- package/dist/assets/{documentation-panel-DvHjxlli.js → documentation-panel-CaJF7e-j.js} +1 -1
- package/dist/assets/{download-BP8MrprC.js → download-DMxOzI7b.js} +1 -1
- package/dist/assets/dropdown-menu-C40jM9o4.js +1 -0
- package/dist/assets/{edit-page-71cK-Nhe.js → edit-page-Vqd9NedM.js} +6 -6
- package/dist/assets/{error-banner-BYN8YUMe.js → error-banner-Dw5YY9wq.js} +1 -1
- package/dist/assets/{error-entries-DOZ1u97X.js → error-entries-Cv2m1yhc.js} +1 -1
- package/dist/assets/{error-panel-CINcf76Z.js → error-panel-Bhlvt6_H.js} +1 -1
- package/dist/assets/{es-BuMFDpR4.js → es-CrFhA96G.js} +1 -1
- package/dist/assets/{esm-Dw0vvSg2.js → esm-BHMOvJzM.js} +1 -1
- package/dist/assets/{esm-BGpfQNhD.js → esm-DmqQGMel.js} +1 -1
- package/dist/assets/file-explorer-panel-6HvNfCrJ.js +1 -0
- package/dist/assets/{file-icons-DgKj9mrV.js → file-icons-DdGYuADJ.js} +1 -1
- package/dist/assets/file-name-input-K4MKESI_.js +3 -0
- package/dist/assets/{floating-outline-CRXIsrPm.js → floating-outline-DaUHnl_e.js} +1 -1
- package/dist/assets/{formats-DSzGCKeO.js → formats-C6s96nu2.js} +1 -1
- package/dist/assets/{formatting-BJlT1s_3.js → formatting-BWZH2nBg.js} +1 -1
- package/dist/assets/{fullscreen-0EEPR7uc.js → fullscreen-BH2jz-F4.js} +5 -5
- package/dist/assets/{gallery-page-TqnFYECu.js → gallery-page-C3pBpHlY.js} +1 -1
- package/dist/assets/{glide-data-editor-DcY3nXI8.js → glide-data-editor-sICUMEhk.js} +1 -1
- package/dist/assets/{glide-utils-CR1sWLZU.js → glide-utils-UGsrRHYj.js} +1 -1
- package/dist/assets/home-page-BLd6rnbk.js +4 -0
- package/dist/assets/{html-to-image-DMn_7CCA.js → html-to-image-D6GUC5q6.js} +1 -1
- package/dist/assets/index-BGT7have.css +2 -0
- package/dist/assets/index-ipFYAeCF.js +29 -0
- package/dist/assets/{input-Daz6sk8l.js → input-DEbY281O.js} +2 -2
- package/dist/assets/{kiosk-mode-CzGt3mc2.js → kiosk-mode-mxgb5lWf.js} +1 -1
- package/dist/assets/{layout-KJMQADEj.js → layout-DWnrxIo2.js} +5 -5
- package/dist/assets/links-DLvOXyO_.js +1 -0
- package/dist/assets/{logs-panel-DFibPeCT.js → logs-panel-BGS2v3ba.js} +1 -1
- package/dist/assets/lua-1tNpM92n.js +1 -0
- package/dist/assets/{lua-CRIS5afH.js → lua-DXBxhmso.js} +1 -1
- package/dist/assets/{markdown-renderer-CdZX2MvM.js → markdown-renderer-BZKlbm2Q.js} +1 -1
- package/dist/assets/menu-items-BSRA2YI9.js +1 -0
- package/dist/assets/{mermaid-CeseGGnS.js → mermaid-l6lQkCib.js} +1 -1
- package/dist/assets/{name-cell-input-B-d5Jwh4.js → name-cell-input-BMCdK-el.js} +1 -1
- package/dist/assets/{numbers-DKurV_vq.js → numbers-Bc-r3jsC.js} +1 -1
- package/dist/assets/{outline-panel-D2Wk10hY.js → outline-panel-Dr5u73V6.js} +1 -1
- package/dist/assets/{packages-panel-CQsbxIlG.js → packages-panel-BdpRg9tX.js} +1 -1
- package/dist/assets/{pair-with-agent-modal-CNxmIMFM.js → pair-with-agent-modal-CbUFKJHP.js} +1 -1
- package/dist/assets/{panel-accordion-state-D6-FMXE2.js → panel-accordion-state-DjUTN7i5.js} +1 -1
- package/dist/assets/{panels-BgcK_4M7.js → panels-CWn0Yh1D.js} +1 -1
- package/dist/assets/process-output-Ck7-P_xp.js +1 -0
- package/dist/assets/{readonly-code-display-BvqLeUsJ.js → readonly-code-display--S2daDa6.js} +1 -1
- package/dist/assets/{readonly-python-code-GSN4D4sb.js → readonly-python-code-DpIyjHqY.js} +1 -1
- package/dist/assets/{renderShortcut-DK_OucLT.js → renderShortcut-X-CJUSM8.js} +1 -1
- package/dist/assets/{reveal-component-u9ED2diI.js → reveal-component-nZIAapoD.js} +1 -1
- package/dist/assets/{run-page-U5iuhyz8.js → run-page-9pl8qhQR.js} +1 -1
- package/dist/assets/{runs-BQTlv6Ja.js → runs-euHSzlw_.js} +1 -1
- package/dist/assets/{scratchpad-panel--YOR0kUB.js → scratchpad-panel-BleGt2KM.js} +1 -1
- package/dist/assets/{scroll-to-bottom-button-xua0e9rA.js → scroll-to-bottom-button-DufiYUD7.js} +1 -1
- package/dist/assets/{secrets-panel-CZPbFAZH.js → secrets-panel-D3BpDIgg.js} +1 -1
- package/dist/assets/select-nLt2y0Sw.js +1 -0
- package/dist/assets/{session-CEdta5_Q.js → session-Sz5nSFku.js} +1 -1
- package/dist/assets/session-panel-DRGPlL5J.js +1 -0
- package/dist/assets/{share-C2MPy_VX.js → share-CPtBiNgr.js} +1 -1
- package/dist/assets/{skeleton-CsceCAjw.js → skeleton-BKeh8hf3.js} +1 -1
- package/dist/assets/{snippets-panel-BxwHsPmW.js → snippets-panel-D5yy7kj0.js} +1 -1
- package/dist/assets/{spec-CUFquO6R.js → spec-DKsAmLTi.js} +1 -1
- package/dist/assets/{state-BqrF--O0.js → state-B6AklCzD.js} +1 -1
- package/dist/assets/{state-C2c3_VuY.js → state-B8XRqyFg.js} +1 -1
- package/dist/assets/{state-CHplO0zn.js → state-Di9TbuV9.js} +1 -1
- package/dist/assets/{strings-CpYReX2Q.js → strings-CReV1AYG.js} +1 -1
- package/dist/assets/{swiper-component-Bot7ehYH.js → swiper-component-5Kdi1-Gn.js} +1 -1
- package/dist/assets/{switch-CtH5Ct94.js → switch-DjXr9Y9D.js} +1 -1
- package/dist/assets/{tabs-c6mpccpH.js → tabs-Cy1qXLzH.js} +1 -1
- package/dist/assets/{terminal-C73iz1fU.js → terminal-CQAFGBfN.js} +1 -1
- package/dist/assets/{tooltip-Cwltdez8.js → tooltip-BG35uS_N.js} +1 -1
- package/dist/assets/{tooltip-D7dq6bnc.js → tooltip-BUtPzKB4.js} +1 -1
- package/dist/assets/{tracing-Dhq121dR.js → tracing-DNk3gmWv.js} +1 -1
- package/dist/assets/{tracing-panel-IKt1933_.js → tracing-panel-Yqazr6w_.js} +2 -2
- package/dist/assets/{tree-actions-DIfWonCA.js → tree-actions-CG5g7aUQ.js} +1 -1
- package/dist/assets/{useAddCell-BYrVaYfZ.js → useAddCell-DdB_uBif.js} +1 -1
- package/dist/assets/{useBoolean-ZU5StAbr.js → useBoolean-BXC4CItZ.js} +1 -1
- package/dist/assets/{useCellActionButton-DbXDs0MA.js → useCellActionButton-B31neI3m.js} +1 -1
- package/dist/assets/{useDebounce-Dulm61-t.js → useDebounce-DgpSQhrP.js} +1 -1
- package/dist/assets/{useDeleteCell-Wgcl3CRG.js → useDeleteCell-Bz49_cFj.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-C5AU8GKL.js → useDependencyPanelTab-C_ps0r--.js} +1 -1
- package/dist/assets/{useEventListener-D27Dii_l.js → useEventListener-92uWqz-P.js} +1 -1
- package/dist/assets/{useIframeCapabilities-DEpTCh1Q.js → useIframeCapabilities-C7Di8f2y.js} +1 -1
- package/dist/assets/{useInstallPackage-u7d0wo79.js → useInstallPackage-DsD08SLK.js} +1 -1
- package/dist/assets/{useInterval-B1_J4wdT.js → useInterval-B4v7_zd0.js} +1 -1
- package/dist/assets/{useNotebookActions-FuMERtHq.js → useNotebookActions-CQtbk9CB.js} +2 -2
- package/dist/assets/{useRunCells-DTdMRbkE.js → useRunCells-CX7oW5zy.js} +1 -1
- package/dist/assets/{useSplitCell-2z0zEB8X.js → useSplitCell-Dy2_DmJR.js} +1 -1
- package/dist/assets/{useTheme-CF-zG9YH.js → useTheme-C-ri8BtY.js} +1 -1
- package/dist/assets/utils-D5Ywm7-q.js +1 -0
- package/dist/assets/{vega-component-BSXJcTJb.js → vega-component-C7TCzyaU.js} +1 -1
- package/dist/assets/write-secret-modal-D6zoZgLY.js +2 -0
- package/dist/index.html +73 -73
- package/package.json +26 -26
- package/src/components/ai/ai-provider-icon.tsx +2 -2
- package/src/components/ai/ai-utils.ts +1 -1
- package/src/components/app-config/ai-config.tsx +33 -37
- package/src/components/app-config/user-config-form.tsx +1 -1
- package/src/components/data-table/__tests__/column-explorer.test.tsx +64 -4
- package/src/components/data-table/__tests__/column-visibility-dropdown.test.tsx +137 -4
- package/src/components/data-table/__tests__/url-detector.test.tsx +1 -1
- package/src/components/data-table/__tests__/useColumnVisibility.test.ts +153 -1
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +54 -25
- package/src/components/data-table/column-visibility-dropdown.tsx +62 -14
- package/src/components/data-table/date-popover.tsx +2 -1
- package/src/components/data-table/hooks/use-column-visibility.ts +76 -0
- package/src/components/data-table/renderers.tsx +4 -8
- package/src/components/data-table/show-only-column-button.tsx +58 -0
- package/src/components/dependency-graph/__tests__/elements.test.ts +151 -0
- package/src/components/dependency-graph/custom-edge.tsx +68 -0
- package/src/components/dependency-graph/custom-node.tsx +54 -26
- package/src/components/dependency-graph/dependency-graph-tree.tsx +110 -21
- package/src/components/dependency-graph/elements.ts +225 -31
- package/src/components/dependency-graph/panels.tsx +23 -2
- package/src/components/dependency-graph/utils/__tests__/layout.test.ts +78 -0
- package/src/components/dependency-graph/utils/layout.ts +108 -18
- package/src/components/editor/Output.tsx +40 -0
- package/src/components/editor/__tests__/Output.test.tsx +85 -2
- package/src/components/editor/connections/secret-combobox.tsx +3 -1
- package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +832 -0
- package/src/components/editor/file-tree/__tests__/file-viewer.test.tsx +27 -0
- package/src/components/editor/file-tree/__tests__/requesting-tree.test.ts +130 -0
- package/src/components/editor/file-tree/file-browser-row.tsx +82 -0
- package/src/components/editor/file-tree/file-explorer.tsx +377 -159
- package/src/components/editor/file-tree/file-operations.tsx +1 -1
- package/src/components/editor/file-tree/file-search-results.tsx +142 -0
- package/src/components/editor/file-tree/file-tree-row.tsx +40 -0
- package/src/components/editor/file-tree/file-viewer.tsx +2 -1
- package/src/components/editor/file-tree/renderers.tsx +4 -2
- package/src/components/editor/file-tree/requesting-tree.tsx +162 -32
- package/src/components/editor/file-tree/use-file-search.ts +142 -0
- package/src/components/editor/file-tree/use-hover-expand.ts +34 -0
- package/src/components/editor/navigation/__tests__/navigation.test.ts +30 -0
- package/src/components/editor/navigation/navigation.ts +20 -0
- package/src/components/forms/form.tsx +6 -4
- package/src/components/home/components.tsx +1 -0
- package/src/components/static-html/share-modal.tsx +3 -2
- package/src/components/ui/__tests__/badge.test.ts +63 -0
- package/src/components/ui/__tests__/button.test.ts +19 -0
- package/src/components/ui/__tests__/fullscreen.test.tsx +88 -0
- package/src/components/ui/__tests__/menu-items.test.ts +31 -0
- package/src/components/ui/badge.tsx +9 -7
- package/src/components/ui/button.tsx +1 -0
- package/src/components/ui/combobox.tsx +1 -1
- package/src/components/ui/date-input.tsx +1 -1
- package/src/components/ui/dialog.tsx +3 -1
- package/src/components/ui/fullscreen.tsx +43 -1
- package/src/components/ui/input.tsx +5 -1
- package/src/components/ui/links.tsx +2 -1
- package/src/components/ui/menu-items.tsx +9 -9
- package/src/components/ui/native-select.tsx +2 -2
- package/src/components/ui/navigation.tsx +1 -1
- package/src/components/ui/range-slider.tsx +5 -3
- package/src/components/ui/select.tsx +1 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/toast.tsx +8 -5
- package/src/components/ui/toaster.tsx +2 -2
- package/src/core/ai/ids/__tests__/ids.test.ts +0 -8
- package/src/core/ai/ids/ids.ts +1 -1
- package/src/core/cells/__tests__/add-missing-import.test.ts +20 -0
- package/src/core/codemirror/language/__tests__/utils.test.ts +1 -1
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/hotkeys/hotkeys.ts +5 -0
- package/src/core/network/__tests__/requests-toasting.test.tsx +14 -0
- package/src/core/network/requests-toasting.tsx +1 -1
- package/src/css/globals.css +28 -0
- package/src/hooks/useEventListener.ts +1 -1
- package/src/plugins/core/RenderHTML.tsx +6 -4
- package/src/plugins/impl/MatrixPlugin.tsx +1 -1
- package/src/plugins/impl/code/any-language-editor.tsx +7 -4
- package/src/plugins/impl/data-frames/__tests__/schema.test.ts +34 -1
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +25 -25
- package/src/plugins/impl/data-frames/schema.ts +5 -11
- package/src/plugins/impl/panel/__tests__/utils.test.ts +4 -4
- package/src/plugins/impl/vega/__tests__/vega.test.ts +1 -1
- package/src/stories/cell.stories.tsx +15 -11
- package/src/utils/__tests__/events.test.ts +1 -1
- package/dist/assets/JsonOutput-CRLQQVKf.js +0 -50
- package/dist/assets/RenderHTML-YkwVPe9V.js +0 -1
- package/dist/assets/ai-model-dropdown-CrSrb8Zz.js +0 -3
- package/dist/assets/alert-dialog-BVi_GyOB.js +0 -11
- package/dist/assets/any-language-editor-BL8H-DwB.js +0 -1
- package/dist/assets/badge-D_-uqy2N.js +0 -1
- package/dist/assets/button-Btj6GXNy.js +0 -1
- package/dist/assets/config-ycxJQP2b.js +0 -1
- package/dist/assets/dependency-graph-panel-Dg-tUB9T.js +0 -5
- package/dist/assets/dist-2oRmY-BC.js +0 -1
- package/dist/assets/dist-8lhGoJ54.js +0 -3
- package/dist/assets/dist-B4QaGCvF.js +0 -1
- package/dist/assets/dist-B_ABJVTW.js +0 -1
- package/dist/assets/dist-Bke0Ybxy.js +0 -1
- package/dist/assets/dist-Bw8CAY5i.js +0 -1
- package/dist/assets/dist-BwmO3SSk.js +0 -1
- package/dist/assets/dist-C3KxgR0m.js +0 -1
- package/dist/assets/dist-CLE562nZ.js +0 -1
- package/dist/assets/dist-CLi0j3bw.js +0 -1
- package/dist/assets/dist-CMIyXejt.js +0 -1
- package/dist/assets/dist-CbQrIaPV.js +0 -2
- package/dist/assets/dist-CpgfIIzU.js +0 -1
- package/dist/assets/dist-D7aYPqs9.js +0 -1
- package/dist/assets/dist-DKCF5R0T.js +0 -1
- package/dist/assets/dist-DbFa9cik.js +0 -1
- package/dist/assets/dist-DdPuhs_-.js +0 -1
- package/dist/assets/dist-DkfdZExz.js +0 -1
- package/dist/assets/dist-hOh6JBwi.js +0 -1
- package/dist/assets/dist-mY1j_5eA.js +0 -1
- package/dist/assets/dist-tg3aVnpD.js +0 -1
- package/dist/assets/dropdown-menu-CqNabM1f.js +0 -1
- package/dist/assets/file-explorer-panel-cflxW8a7.js +0 -1
- package/dist/assets/file-name-input-CQF4Ovwx.js +0 -3
- package/dist/assets/home-page-DPRHPAQM.js +0 -4
- package/dist/assets/index-BkIXRAbi.css +0 -2
- package/dist/assets/index-p49fbIlR.js +0 -29
- package/dist/assets/links-DPh7yoP-.js +0 -1
- package/dist/assets/lua-_4wuYo1j.js +0 -1
- package/dist/assets/menu-items-BSVrMleU.js +0 -1
- package/dist/assets/process-output-DvTtgoMs.js +0 -1
- package/dist/assets/select-czJLm6jf.js +0 -1
- package/dist/assets/session-panel-C_N3WGWQ.js +0 -1
- package/dist/assets/utils-CWSZQEjr.js +0 -1
- package/dist/assets/write-secret-modal-lNU_7c2x.js +0 -2
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
act,
|
|
5
|
+
fireEvent,
|
|
6
|
+
render,
|
|
7
|
+
renderHook,
|
|
8
|
+
screen,
|
|
9
|
+
waitFor,
|
|
10
|
+
} from "@testing-library/react";
|
|
11
|
+
import { Provider, createStore } from "jotai";
|
|
12
|
+
import type { ReactNode } from "react";
|
|
13
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
14
|
+
import { MockRequestClient } from "@/__mocks__/requests";
|
|
15
|
+
import { ModalProvider } from "@/components/modal/ImperativeModal";
|
|
16
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
17
|
+
import { requestClientAtom } from "@/core/network/requests";
|
|
18
|
+
import type { FileInfo, FileSearchResponse } from "@/core/network/types";
|
|
19
|
+
import { Deferred } from "@/utils/Deferred";
|
|
20
|
+
import type { FilePath } from "@/utils/paths";
|
|
21
|
+
import { TreeDndProvider } from "../dnd-wrapper";
|
|
22
|
+
import { FileExplorer } from "../file-explorer";
|
|
23
|
+
import { openStateAtom } from "../state";
|
|
24
|
+
import { fileTreeNodeId, RequestingTree } from "../requesting-tree";
|
|
25
|
+
import { useFileSearch } from "../use-file-search";
|
|
26
|
+
import { HOVER_EXPAND_DELAY } from "../use-hover-expand";
|
|
27
|
+
|
|
28
|
+
vi.mock("../file-viewer", () => ({
|
|
29
|
+
FileViewer: ({ file }: { file: FileInfo }) => <div>Preview: {file.name}</div>,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
function file(name: string, isDirectory = false): FileInfo {
|
|
33
|
+
return {
|
|
34
|
+
id: name,
|
|
35
|
+
name: name.split("/").at(-1) ?? name,
|
|
36
|
+
path: `/workspace/${name}`,
|
|
37
|
+
isDirectory,
|
|
38
|
+
isMarimoFile: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createDragEvents(clientY = 115) {
|
|
43
|
+
const dataTransfer = {
|
|
44
|
+
setData: vi.fn(),
|
|
45
|
+
getData: vi.fn(),
|
|
46
|
+
setDragImage: vi.fn(),
|
|
47
|
+
types: [],
|
|
48
|
+
dropEffect: "move",
|
|
49
|
+
effectAllowed: "all",
|
|
50
|
+
};
|
|
51
|
+
return (target: Element, type: string) => {
|
|
52
|
+
// jsdom has no DragEvent; MouseEvent preserves the pointer coordinates.
|
|
53
|
+
const event = new MouseEvent(type, {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
cancelable: true,
|
|
56
|
+
clientX: 100,
|
|
57
|
+
clientY,
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(event, "dataTransfer", { value: dataTransfer });
|
|
60
|
+
fireEvent(target, event);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let store = createStore();
|
|
65
|
+
let client: ReturnType<typeof MockRequestClient.create>;
|
|
66
|
+
const wrapper = ({ children }: { children: ReactNode }) => (
|
|
67
|
+
<Provider store={store}>
|
|
68
|
+
<TooltipProvider>
|
|
69
|
+
<ModalProvider>
|
|
70
|
+
<TreeDndProvider>{children}</TreeDndProvider>
|
|
71
|
+
</ModalProvider>
|
|
72
|
+
</TooltipProvider>
|
|
73
|
+
</Provider>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
localStorage.clear();
|
|
78
|
+
store = createStore();
|
|
79
|
+
client = MockRequestClient.create({
|
|
80
|
+
getFileRoots: vi.fn().mockResolvedValue({
|
|
81
|
+
roots: [{ path: "/workspace", name: "workspace", isPrimary: true }],
|
|
82
|
+
}),
|
|
83
|
+
sendListFiles: vi.fn().mockImplementation(async ({ path }) => ({
|
|
84
|
+
files:
|
|
85
|
+
path === "/workspace"
|
|
86
|
+
? [file("data", true), file("notes.txt")]
|
|
87
|
+
: [file("data/report.csv")],
|
|
88
|
+
})),
|
|
89
|
+
});
|
|
90
|
+
store.set(requestClientAtom, client);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("file browser navigation", () => {
|
|
94
|
+
it("debounces the first character, subsequent edits, and searches after clearing", async () => {
|
|
95
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
96
|
+
const input = await screen.findByRole("textbox", {
|
|
97
|
+
name: "Search files and folders",
|
|
98
|
+
});
|
|
99
|
+
vi.useFakeTimers();
|
|
100
|
+
try {
|
|
101
|
+
fireEvent.change(input, { target: { value: "n" } });
|
|
102
|
+
await act(() => vi.advanceTimersByTimeAsync(100));
|
|
103
|
+
expect(client.sendSearchFiles).not.toHaveBeenCalled();
|
|
104
|
+
fireEvent.change(input, { target: { value: "no" } });
|
|
105
|
+
await act(() => vi.advanceTimersByTimeAsync(299));
|
|
106
|
+
expect(client.sendSearchFiles).not.toHaveBeenCalled();
|
|
107
|
+
await act(() => vi.advanceTimersByTimeAsync(1));
|
|
108
|
+
expect(client.sendSearchFiles).toHaveBeenCalledOnce();
|
|
109
|
+
expect(client.sendSearchFiles).toHaveBeenLastCalledWith(
|
|
110
|
+
expect.objectContaining({ query: "no" }),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
fireEvent.change(input, { target: { value: "" } });
|
|
114
|
+
fireEvent.change(input, { target: { value: "f" } });
|
|
115
|
+
await act(() => vi.advanceTimersByTimeAsync(299));
|
|
116
|
+
expect(client.sendSearchFiles).toHaveBeenCalledOnce();
|
|
117
|
+
await act(() => vi.advanceTimersByTimeAsync(1));
|
|
118
|
+
expect(client.sendSearchFiles).toHaveBeenCalledTimes(2);
|
|
119
|
+
expect(client.sendSearchFiles).toHaveBeenLastCalledWith(
|
|
120
|
+
expect.objectContaining({ query: "f" }),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
fireEvent.change(input, { target: { value: "" } });
|
|
124
|
+
await act(() => vi.advanceTimersByTimeAsync(300));
|
|
125
|
+
expect(client.sendSearchFiles).toHaveBeenCalledTimes(2);
|
|
126
|
+
} finally {
|
|
127
|
+
vi.useRealTimers();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("navigates with arrows, opens with Enter, and restores the tree after preview", async () => {
|
|
132
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
133
|
+
const tree = await screen.findByRole("tree");
|
|
134
|
+
act(() => tree.focus());
|
|
135
|
+
expect(document.activeElement).toHaveTextContent("data");
|
|
136
|
+
fireEvent.keyDown(document.activeElement!, { key: "ArrowRight" });
|
|
137
|
+
expect(client.sendListFiles).toHaveBeenCalledWith({
|
|
138
|
+
path: "/workspace/data",
|
|
139
|
+
});
|
|
140
|
+
expect(await screen.findByText("report.csv")).toBeVisible();
|
|
141
|
+
fireEvent.keyDown(document.activeElement!, { key: "ArrowDown" });
|
|
142
|
+
expect(screen.queryByText("Preview: report.csv")).not.toBeInTheDocument();
|
|
143
|
+
expect(document.activeElement).toHaveTextContent("report.csv");
|
|
144
|
+
fireEvent.keyDown(document.activeElement!, { key: "Enter" });
|
|
145
|
+
expect(await screen.findByText("Preview: report.csv")).toBeVisible();
|
|
146
|
+
fireEvent.click(screen.getByRole("button", { name: "Back to files" }));
|
|
147
|
+
expect(await screen.findByText("report.csv")).toBeVisible();
|
|
148
|
+
expect(screen.getByRole("tree")).toBe(tree);
|
|
149
|
+
await waitFor(() =>
|
|
150
|
+
expect(document.activeElement).toHaveTextContent("report.csv"),
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("bounds mounted rows for a directory with 10,000 files and supports End navigation", async () => {
|
|
155
|
+
client.sendListFiles.mockResolvedValue({
|
|
156
|
+
root: "/workspace",
|
|
157
|
+
files: Array.from({ length: 10_000 }, (_, index) =>
|
|
158
|
+
file(`file-${index}.txt`),
|
|
159
|
+
),
|
|
160
|
+
});
|
|
161
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
162
|
+
const tree = await screen.findByRole("tree");
|
|
163
|
+
expect(screen.getAllByRole("treeitem").length).toBeLessThan(40);
|
|
164
|
+
act(() => tree.focus());
|
|
165
|
+
fireEvent.keyDown(document.activeElement!, { key: "End" });
|
|
166
|
+
expect(await screen.findByText("file-9999.txt")).toBeVisible();
|
|
167
|
+
expect(screen.getAllByRole("treeitem").length).toBeLessThan(40);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("renames with F2 and keeps leaf files distinct from expandable folders", async () => {
|
|
171
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
172
|
+
const row = await screen.findByRole("treeitem", { name: "notes.txt" });
|
|
173
|
+
expect(row).not.toHaveAttribute("aria-expanded");
|
|
174
|
+
expect(screen.getByRole("treeitem", { name: "data" })).toHaveAttribute(
|
|
175
|
+
"aria-expanded",
|
|
176
|
+
"false",
|
|
177
|
+
);
|
|
178
|
+
fireEvent.click(screen.getByText("notes.txt"));
|
|
179
|
+
fireEvent.keyDown(row, { key: "F2" });
|
|
180
|
+
expect(await screen.findByDisplayValue("notes.txt")).toHaveFocus();
|
|
181
|
+
fireEvent.keyDown(document.activeElement!, { key: "Escape" });
|
|
182
|
+
expect(client.sendRenameFileOrFolder).not.toHaveBeenCalled();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("reveals and expands folders found by search", async () => {
|
|
186
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
187
|
+
files: [file("data", true)],
|
|
188
|
+
query: "data",
|
|
189
|
+
totalFound: 1,
|
|
190
|
+
});
|
|
191
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
192
|
+
const input = await screen.findByRole("textbox", {
|
|
193
|
+
name: "Search files and folders",
|
|
194
|
+
});
|
|
195
|
+
fireEvent.change(input, { target: { value: "data" } });
|
|
196
|
+
await screen.findByText("1 match");
|
|
197
|
+
fireEvent.keyDown(input, { key: "Enter" });
|
|
198
|
+
expect(await screen.findByText("report.csv")).toBeVisible();
|
|
199
|
+
expect(input).toHaveValue("");
|
|
200
|
+
expect(screen.getByRole("treeitem", { name: "data" })).toHaveAttribute(
|
|
201
|
+
"aria-expanded",
|
|
202
|
+
"true",
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it("finds unopened descendants and supports keyboard activation from the search field", async () => {
|
|
207
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
208
|
+
files: [file("data/report.csv")],
|
|
209
|
+
query: "report",
|
|
210
|
+
totalFound: 1,
|
|
211
|
+
});
|
|
212
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
213
|
+
const input = await screen.findByRole("textbox", {
|
|
214
|
+
name: "Search files and folders",
|
|
215
|
+
});
|
|
216
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
217
|
+
expect(await screen.findByText("report.csv")).toBeVisible();
|
|
218
|
+
expect(client.sendSearchFiles).toHaveBeenCalledWith(
|
|
219
|
+
expect.objectContaining({ query: "report", path: "/workspace" }),
|
|
220
|
+
);
|
|
221
|
+
fireEvent.keyDown(input, { key: "ArrowDown" });
|
|
222
|
+
await waitFor(() =>
|
|
223
|
+
expect(document.activeElement).toHaveTextContent("report.csv"),
|
|
224
|
+
);
|
|
225
|
+
fireEvent.keyDown(document.activeElement!, { key: "Enter" });
|
|
226
|
+
expect(await screen.findByText("Preview: report.csv")).toBeVisible();
|
|
227
|
+
fireEvent.click(screen.getByRole("button", { name: "Back to files" }));
|
|
228
|
+
expect(input).toHaveValue("report");
|
|
229
|
+
fireEvent.keyDown(input, { key: "Escape" });
|
|
230
|
+
expect(input).toHaveValue("");
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("previews search files without loading their ancestors", async () => {
|
|
234
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
235
|
+
files: [file("new/nested/report.csv")],
|
|
236
|
+
query: "report",
|
|
237
|
+
totalFound: 1,
|
|
238
|
+
});
|
|
239
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
240
|
+
const input = await screen.findByRole("textbox", {
|
|
241
|
+
name: "Search files and folders",
|
|
242
|
+
});
|
|
243
|
+
client.sendListFiles.mockClear();
|
|
244
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
245
|
+
await screen.findByText("1 match");
|
|
246
|
+
fireEvent.keyDown(input, { key: "Enter" });
|
|
247
|
+
expect(await screen.findByText("Preview: report.csv")).toBeVisible();
|
|
248
|
+
expect(client.sendListFiles).not.toHaveBeenCalled();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it.each([
|
|
252
|
+
{ offset: 1, sourceName: "notes.txt", canMove: true },
|
|
253
|
+
{ offset: 15, sourceName: "notes.txt", canMove: true },
|
|
254
|
+
{ offset: 29, sourceName: "notes.txt", canMove: true },
|
|
255
|
+
{ offset: 15, sourceName: "data", canMove: false },
|
|
256
|
+
])(
|
|
257
|
+
"drops $sourceName at folder offset $offset with canMove=$canMove",
|
|
258
|
+
async ({ offset, sourceName, canMove }) => {
|
|
259
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
260
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
261
|
+
const source = screen.getByRole("treeitem", {
|
|
262
|
+
name: sourceName,
|
|
263
|
+
}).firstElementChild;
|
|
264
|
+
if (!source) {
|
|
265
|
+
throw new Error("Missing drag source");
|
|
266
|
+
}
|
|
267
|
+
vi.spyOn(folder, "getBoundingClientRect").mockReturnValue(
|
|
268
|
+
new DOMRect(0, 100, 300, 30),
|
|
269
|
+
);
|
|
270
|
+
const dragEvent = createDragEvents(100 + offset);
|
|
271
|
+
dragEvent(source, "dragstart");
|
|
272
|
+
await act(async () => {
|
|
273
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
274
|
+
});
|
|
275
|
+
dragEvent(folder, "dragenter");
|
|
276
|
+
dragEvent(folder, "dragover");
|
|
277
|
+
await act(async () => {
|
|
278
|
+
await new Promise(requestAnimationFrame);
|
|
279
|
+
});
|
|
280
|
+
dragEvent(folder, "drop");
|
|
281
|
+
if (canMove) {
|
|
282
|
+
await waitFor(() =>
|
|
283
|
+
expect(client.sendRenameFileOrFolder).toHaveBeenCalledExactlyOnceWith(
|
|
284
|
+
{
|
|
285
|
+
path: "/workspace/notes.txt",
|
|
286
|
+
newPath: "/workspace/data/notes.txt",
|
|
287
|
+
},
|
|
288
|
+
),
|
|
289
|
+
);
|
|
290
|
+
} else {
|
|
291
|
+
expect(client.sendRenameFileOrFolder).not.toHaveBeenCalled();
|
|
292
|
+
}
|
|
293
|
+
dragEvent(source, "dragend");
|
|
294
|
+
},
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
it("expands hovered folders after a delay and supports nested drops", async () => {
|
|
298
|
+
client.sendListFiles.mockImplementation(async ({ path }) => {
|
|
299
|
+
if (path === "/workspace") {
|
|
300
|
+
return {
|
|
301
|
+
root: "/workspace",
|
|
302
|
+
files: [file("data", true), file("notes.txt")],
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
if (path === "/workspace/data") {
|
|
306
|
+
return { root: "/workspace", files: [file("data/nested", true)] };
|
|
307
|
+
}
|
|
308
|
+
return { root: "/workspace", files: [] };
|
|
309
|
+
});
|
|
310
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
311
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
312
|
+
const source = screen.getByRole("treeitem", {
|
|
313
|
+
name: "notes.txt",
|
|
314
|
+
}).firstElementChild;
|
|
315
|
+
if (!source) {
|
|
316
|
+
throw new Error("Missing drag source");
|
|
317
|
+
}
|
|
318
|
+
const dragEvent = createDragEvents();
|
|
319
|
+
vi.useFakeTimers();
|
|
320
|
+
try {
|
|
321
|
+
dragEvent(source, "dragstart");
|
|
322
|
+
await act(async () => {
|
|
323
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
324
|
+
});
|
|
325
|
+
dragEvent(folder, "dragenter");
|
|
326
|
+
dragEvent(folder, "dragover");
|
|
327
|
+
await act(async () => {
|
|
328
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY - 1);
|
|
329
|
+
});
|
|
330
|
+
expect(folder).toHaveAttribute("aria-expanded", "false");
|
|
331
|
+
await act(async () => {
|
|
332
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
333
|
+
});
|
|
334
|
+
expect(folder).toHaveAttribute("aria-expanded", "true");
|
|
335
|
+
expect(client.sendListFiles).toHaveBeenCalledWith({
|
|
336
|
+
path: "/workspace/data",
|
|
337
|
+
});
|
|
338
|
+
const nested = screen.getByRole("treeitem", { name: "nested" });
|
|
339
|
+
dragEvent(nested, "dragenter");
|
|
340
|
+
dragEvent(nested, "dragover");
|
|
341
|
+
await act(async () => {
|
|
342
|
+
await vi.advanceTimersByTimeAsync(16);
|
|
343
|
+
});
|
|
344
|
+
await act(async () => {
|
|
345
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY);
|
|
346
|
+
});
|
|
347
|
+
expect(nested).toHaveAttribute("aria-expanded", "true");
|
|
348
|
+
expect(client.sendListFiles).toHaveBeenCalledWith({
|
|
349
|
+
path: "/workspace/data/nested",
|
|
350
|
+
});
|
|
351
|
+
await act(async () => {
|
|
352
|
+
dragEvent(nested, "drop");
|
|
353
|
+
});
|
|
354
|
+
expect(client.sendRenameFileOrFolder).toHaveBeenCalledExactlyOnceWith({
|
|
355
|
+
path: "/workspace/notes.txt",
|
|
356
|
+
newPath: "/workspace/data/nested/notes.txt",
|
|
357
|
+
});
|
|
358
|
+
dragEvent(source, "dragend");
|
|
359
|
+
} finally {
|
|
360
|
+
vi.useRealTimers();
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it.each(["leave", "end", "invalid"])(
|
|
365
|
+
"does not expand a folder when the drag is %s",
|
|
366
|
+
async (reason) => {
|
|
367
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
368
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
369
|
+
const sourceRow =
|
|
370
|
+
reason === "invalid"
|
|
371
|
+
? folder
|
|
372
|
+
: screen.getByRole("treeitem", { name: "notes.txt" });
|
|
373
|
+
const source = sourceRow.firstElementChild;
|
|
374
|
+
if (!source) {
|
|
375
|
+
throw new Error("Missing drag source");
|
|
376
|
+
}
|
|
377
|
+
const dragEvent = createDragEvents();
|
|
378
|
+
vi.useFakeTimers();
|
|
379
|
+
try {
|
|
380
|
+
dragEvent(source, "dragstart");
|
|
381
|
+
await act(async () => {
|
|
382
|
+
await vi.advanceTimersByTimeAsync(0);
|
|
383
|
+
});
|
|
384
|
+
dragEvent(folder, "dragenter");
|
|
385
|
+
dragEvent(folder, "dragover");
|
|
386
|
+
await act(async () => {
|
|
387
|
+
await vi.advanceTimersByTimeAsync(400);
|
|
388
|
+
});
|
|
389
|
+
if (reason === "leave") {
|
|
390
|
+
dragEvent(sourceRow, "dragenter");
|
|
391
|
+
dragEvent(sourceRow, "dragover");
|
|
392
|
+
} else if (reason === "end") {
|
|
393
|
+
dragEvent(source, "dragend");
|
|
394
|
+
}
|
|
395
|
+
await act(async () => {
|
|
396
|
+
await vi.advanceTimersByTimeAsync(1000);
|
|
397
|
+
});
|
|
398
|
+
expect(folder).toHaveAttribute("aria-expanded", "false");
|
|
399
|
+
expect(client.sendListFiles).not.toHaveBeenCalledWith({
|
|
400
|
+
path: "/workspace/data",
|
|
401
|
+
});
|
|
402
|
+
dragEvent(source, "dragend");
|
|
403
|
+
} finally {
|
|
404
|
+
vi.useRealTimers();
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
it("expands nested external upload destinations and cancels when the drag leaves", async () => {
|
|
410
|
+
client.sendListFiles.mockImplementation(async ({ path }) => {
|
|
411
|
+
if (path === "/workspace") {
|
|
412
|
+
return { root: "/workspace", files: [file("data", true)] };
|
|
413
|
+
}
|
|
414
|
+
if (path === "/workspace/data") {
|
|
415
|
+
return { root: "/workspace", files: [file("data/nested", true)] };
|
|
416
|
+
}
|
|
417
|
+
return { root: "/workspace", files: [] };
|
|
418
|
+
});
|
|
419
|
+
const { rerender } = render(<FileExplorer height={300} />, { wrapper });
|
|
420
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
421
|
+
vi.useFakeTimers();
|
|
422
|
+
try {
|
|
423
|
+
rerender(
|
|
424
|
+
<FileExplorer
|
|
425
|
+
height={300}
|
|
426
|
+
externalDropDestinationPath={"/workspace/data" as FilePath}
|
|
427
|
+
/>,
|
|
428
|
+
);
|
|
429
|
+
await act(async () => {
|
|
430
|
+
await vi.advanceTimersByTimeAsync(300);
|
|
431
|
+
});
|
|
432
|
+
rerender(
|
|
433
|
+
<FileExplorer height={300} externalDropDestinationPath={null} />,
|
|
434
|
+
);
|
|
435
|
+
await act(async () => {
|
|
436
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY);
|
|
437
|
+
});
|
|
438
|
+
expect(folder).toHaveAttribute("aria-expanded", "false");
|
|
439
|
+
rerender(
|
|
440
|
+
<FileExplorer
|
|
441
|
+
height={300}
|
|
442
|
+
externalDropDestinationPath={"/workspace/data" as FilePath}
|
|
443
|
+
/>,
|
|
444
|
+
);
|
|
445
|
+
await act(async () => {
|
|
446
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY - 1);
|
|
447
|
+
});
|
|
448
|
+
expect(folder).toHaveAttribute("aria-expanded", "false");
|
|
449
|
+
await act(async () => {
|
|
450
|
+
await vi.advanceTimersByTimeAsync(1);
|
|
451
|
+
});
|
|
452
|
+
expect(folder).toHaveAttribute("aria-expanded", "true");
|
|
453
|
+
const nested = screen.getByRole("treeitem", { name: "nested" });
|
|
454
|
+
rerender(
|
|
455
|
+
<FileExplorer
|
|
456
|
+
height={300}
|
|
457
|
+
externalDropDestinationPath={"/workspace/data/nested" as FilePath}
|
|
458
|
+
/>,
|
|
459
|
+
);
|
|
460
|
+
await act(async () => {
|
|
461
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY);
|
|
462
|
+
});
|
|
463
|
+
expect(nested).toHaveAttribute("aria-expanded", "true");
|
|
464
|
+
expect(client.sendListFiles).toHaveBeenCalledWith({
|
|
465
|
+
path: "/workspace/data/nested",
|
|
466
|
+
});
|
|
467
|
+
expect(client.sendRenameFileOrFolder).not.toHaveBeenCalled();
|
|
468
|
+
} finally {
|
|
469
|
+
vi.useRealTimers();
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it("ranks matches across roots before applying the global result limit", async () => {
|
|
474
|
+
client.getFileRoots.mockResolvedValue({
|
|
475
|
+
roots: [
|
|
476
|
+
{ path: "/workspace", name: "workspace", isPrimary: true },
|
|
477
|
+
{ path: "/shared", name: "shared", isPrimary: false },
|
|
478
|
+
],
|
|
479
|
+
});
|
|
480
|
+
client.sendSearchFiles.mockImplementation(async ({ path, query }) => {
|
|
481
|
+
const files =
|
|
482
|
+
path === "/workspace"
|
|
483
|
+
? Array.from({ length: 200 }, (_, index) =>
|
|
484
|
+
file(`report-${index}.txt`),
|
|
485
|
+
)
|
|
486
|
+
: [{ ...file("report"), path: "/shared/report" }];
|
|
487
|
+
return { files, query, totalFound: files.length };
|
|
488
|
+
});
|
|
489
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
490
|
+
const input = await screen.findByRole("textbox", {
|
|
491
|
+
name: "Search files and folders",
|
|
492
|
+
});
|
|
493
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
494
|
+
await screen.findByText(/200 matches/);
|
|
495
|
+
const results = screen.getAllByRole("treeitem");
|
|
496
|
+
expect(results[0]).toHaveAccessibleName("/shared/report");
|
|
497
|
+
expect(
|
|
498
|
+
client.sendSearchFiles.mock.calls.map(([request]) => request.path),
|
|
499
|
+
).toEqual(["/workspace", "/shared"]);
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
it.each([false, true])(
|
|
503
|
+
"deduplicates overlapping roots before limiting (primary first: %s)",
|
|
504
|
+
async (primaryFirst) => {
|
|
505
|
+
const roots = [
|
|
506
|
+
{ path: "/workspace", name: "workspace", isPrimary: true },
|
|
507
|
+
{ path: "/workspace/data", name: "data", isPrimary: false },
|
|
508
|
+
];
|
|
509
|
+
client.getFileRoots.mockResolvedValue({
|
|
510
|
+
roots: primaryFirst ? roots : roots.toReversed(),
|
|
511
|
+
});
|
|
512
|
+
const sharedFiles = Array.from({ length: 150 }, (_, index) =>
|
|
513
|
+
file(`data/report-${index}.txt`),
|
|
514
|
+
);
|
|
515
|
+
client.sendSearchFiles.mockImplementation(async ({ path, query }) => {
|
|
516
|
+
const files =
|
|
517
|
+
path === "/workspace"
|
|
518
|
+
? [...sharedFiles, file("report-unique.txt")]
|
|
519
|
+
: sharedFiles;
|
|
520
|
+
return { files, query, totalFound: files.length };
|
|
521
|
+
});
|
|
522
|
+
const tree = new RequestingTree({
|
|
523
|
+
getRoots: client.getFileRoots,
|
|
524
|
+
listFiles: client.sendListFiles,
|
|
525
|
+
createFileOrFolder: client.sendCreateFileOrFolder,
|
|
526
|
+
deleteFileOrFolder: client.sendDeleteFileOrFolder,
|
|
527
|
+
copyFileOrFolder: client.sendCopyFileOrFolder,
|
|
528
|
+
renameFileOrFolder: client.sendRenameFileOrFolder,
|
|
529
|
+
});
|
|
530
|
+
await tree.initialize(vi.fn());
|
|
531
|
+
const { result } = renderHook(
|
|
532
|
+
() => useFileSearch({ query: "report", tree, showHiddenFiles: false }),
|
|
533
|
+
{ wrapper },
|
|
534
|
+
);
|
|
535
|
+
await waitFor(() => expect(result.current.state.status).toBe("success"));
|
|
536
|
+
const state = result.current.state;
|
|
537
|
+
if (state.status !== "success") {
|
|
538
|
+
throw new Error("Expected search results");
|
|
539
|
+
}
|
|
540
|
+
expect(state.files).toHaveLength(151);
|
|
541
|
+
expect(new Set(state.files.map((file) => file.path)).size).toBe(151);
|
|
542
|
+
expect(
|
|
543
|
+
state.files.every(
|
|
544
|
+
(file) => file.rootPath === "/workspace" && file.isPrimaryRoot,
|
|
545
|
+
),
|
|
546
|
+
).toBe(true);
|
|
547
|
+
expect(
|
|
548
|
+
state.files.some(
|
|
549
|
+
(file) => file.path === "/workspace/report-unique.txt",
|
|
550
|
+
),
|
|
551
|
+
).toBe(true);
|
|
552
|
+
expect(state.hasMore).toBe(false);
|
|
553
|
+
},
|
|
554
|
+
);
|
|
555
|
+
|
|
556
|
+
it("distinguishes same-named search results by their accessible paths", async () => {
|
|
557
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
558
|
+
query: "report",
|
|
559
|
+
files: [file("data/report.csv"), file("archive/report.csv")],
|
|
560
|
+
totalFound: 2,
|
|
561
|
+
});
|
|
562
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
563
|
+
fireEvent.change(
|
|
564
|
+
await screen.findByRole("textbox", { name: "Search files and folders" }),
|
|
565
|
+
{ target: { value: "report" } },
|
|
566
|
+
);
|
|
567
|
+
expect(
|
|
568
|
+
await screen.findByRole("treeitem", {
|
|
569
|
+
name: "/workspace/data/report.csv",
|
|
570
|
+
}),
|
|
571
|
+
).toBeVisible();
|
|
572
|
+
expect(
|
|
573
|
+
screen.getByRole("treeitem", { name: "/workspace/archive/report.csv" }),
|
|
574
|
+
).toBeVisible();
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
it("shows an error when every search root fails", async () => {
|
|
578
|
+
client.sendSearchFiles.mockRejectedValue(new Error("Unavailable"));
|
|
579
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
580
|
+
const input = await screen.findByRole("textbox", {
|
|
581
|
+
name: "Search files and folders",
|
|
582
|
+
});
|
|
583
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
584
|
+
expect(await screen.findByRole("alert")).toHaveTextContent(
|
|
585
|
+
"Could not search files",
|
|
586
|
+
);
|
|
587
|
+
expect(screen.getByRole("button", { name: "Retry" })).toBeInTheDocument();
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
it("retries failed hover expansion only after leaving and reentering", async () => {
|
|
591
|
+
const { rerender } = render(<FileExplorer height={300} />, { wrapper });
|
|
592
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
593
|
+
client.sendListFiles.mockRejectedValue(new Error("Unavailable"));
|
|
594
|
+
client.sendListFiles.mockClear();
|
|
595
|
+
vi.useFakeTimers();
|
|
596
|
+
try {
|
|
597
|
+
rerender(
|
|
598
|
+
<FileExplorer
|
|
599
|
+
height={300}
|
|
600
|
+
externalDropDestinationPath={"/workspace/data" as FilePath}
|
|
601
|
+
/>,
|
|
602
|
+
);
|
|
603
|
+
await act(async () => {
|
|
604
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY);
|
|
605
|
+
});
|
|
606
|
+
expect(folder).toHaveAttribute("aria-expanded", "false");
|
|
607
|
+
await act(async () => {
|
|
608
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY * 5);
|
|
609
|
+
});
|
|
610
|
+
expect(client.sendListFiles).toHaveBeenCalledTimes(1);
|
|
611
|
+
rerender(
|
|
612
|
+
<FileExplorer height={300} externalDropDestinationPath={null} />,
|
|
613
|
+
);
|
|
614
|
+
client.sendListFiles.mockResolvedValue({
|
|
615
|
+
root: "/workspace",
|
|
616
|
+
files: [file("data/report.csv")],
|
|
617
|
+
});
|
|
618
|
+
rerender(
|
|
619
|
+
<FileExplorer
|
|
620
|
+
height={300}
|
|
621
|
+
externalDropDestinationPath={"/workspace/data" as FilePath}
|
|
622
|
+
/>,
|
|
623
|
+
);
|
|
624
|
+
await act(async () => {
|
|
625
|
+
await vi.advanceTimersByTimeAsync(HOVER_EXPAND_DELAY);
|
|
626
|
+
});
|
|
627
|
+
expect(client.sendListFiles).toHaveBeenCalledTimes(2);
|
|
628
|
+
expect(folder).toHaveAttribute("aria-expanded", "true");
|
|
629
|
+
} finally {
|
|
630
|
+
vi.useRealTimers();
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
it("keeps partial results when a root fails, and retries all roots", async () => {
|
|
635
|
+
client.getFileRoots.mockResolvedValue({
|
|
636
|
+
roots: [
|
|
637
|
+
{ path: "/workspace", name: "workspace", isPrimary: true },
|
|
638
|
+
{ path: "/shared", name: "shared", isPrimary: false },
|
|
639
|
+
],
|
|
640
|
+
});
|
|
641
|
+
let sharedUnavailable = true;
|
|
642
|
+
client.sendSearchFiles.mockImplementation(async ({ path, query }) => {
|
|
643
|
+
if (path === "/shared" && sharedUnavailable) {
|
|
644
|
+
throw new Error("Storage unavailable");
|
|
645
|
+
}
|
|
646
|
+
return {
|
|
647
|
+
files: [{ ...file("report.txt"), path: `${path}/report.txt` }],
|
|
648
|
+
query,
|
|
649
|
+
totalFound: 1,
|
|
650
|
+
};
|
|
651
|
+
});
|
|
652
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
653
|
+
const input = await screen.findByRole("textbox", {
|
|
654
|
+
name: "Search files and folders",
|
|
655
|
+
});
|
|
656
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
657
|
+
expect(await screen.findByRole("alert")).toHaveTextContent(
|
|
658
|
+
"Some locations could not be searched",
|
|
659
|
+
);
|
|
660
|
+
expect(
|
|
661
|
+
screen.getByRole("treeitem", { name: "/workspace/report.txt" }),
|
|
662
|
+
).toBeInTheDocument();
|
|
663
|
+
fireEvent.click(
|
|
664
|
+
screen.getByRole("treeitem", { name: "/workspace/report.txt" }),
|
|
665
|
+
);
|
|
666
|
+
const retry = screen.getByRole("button", { name: "Retry" });
|
|
667
|
+
retry.focus();
|
|
668
|
+
sharedUnavailable = false;
|
|
669
|
+
expect(fireEvent.keyDown(retry, { key: "Enter" })).toBe(true);
|
|
670
|
+
// jsdom does not synthesize a button click from Enter.
|
|
671
|
+
fireEvent.click(retry);
|
|
672
|
+
await screen.findByText("2 matches");
|
|
673
|
+
expect(screen.queryByText("Preview: report.txt")).not.toBeInTheDocument();
|
|
674
|
+
expect(
|
|
675
|
+
client.sendSearchFiles.mock.calls.map(([request]) => request.path),
|
|
676
|
+
).toEqual(["/workspace", "/shared", "/workspace", "/shared"]);
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
it.each([
|
|
680
|
+
{ counts: [100, 100], truncated: false },
|
|
681
|
+
{ counts: [200, 0], truncated: true },
|
|
682
|
+
{ counts: [150, 100], truncated: true },
|
|
683
|
+
])(
|
|
684
|
+
"reports search truncation correctly for $counts",
|
|
685
|
+
async ({ counts, truncated }) => {
|
|
686
|
+
client.getFileRoots.mockResolvedValue({
|
|
687
|
+
roots: [
|
|
688
|
+
{ path: "/workspace", name: "workspace", isPrimary: true },
|
|
689
|
+
{ path: "/shared", name: "shared", isPrimary: false },
|
|
690
|
+
],
|
|
691
|
+
});
|
|
692
|
+
client.sendSearchFiles.mockImplementation(async ({ path, query }) => {
|
|
693
|
+
const count = counts[path === "/workspace" ? 0 : 1];
|
|
694
|
+
const files = Array.from({ length: count }, (_, index) => ({
|
|
695
|
+
...file(`report-${index}`),
|
|
696
|
+
path: `${path}/report-${index}`,
|
|
697
|
+
}));
|
|
698
|
+
return { files, query, totalFound: files.length };
|
|
699
|
+
});
|
|
700
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
701
|
+
const input = await screen.findByRole("textbox", {
|
|
702
|
+
name: "Search files and folders",
|
|
703
|
+
});
|
|
704
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
705
|
+
const status = await screen.findByText(/200 matches/);
|
|
706
|
+
expect(status.textContent?.includes("Refine your search")).toBe(
|
|
707
|
+
truncated,
|
|
708
|
+
);
|
|
709
|
+
},
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
it("keeps keyboard navigation aligned with a clicked row", async () => {
|
|
713
|
+
client.sendListFiles.mockResolvedValue({
|
|
714
|
+
root: "/workspace",
|
|
715
|
+
files: [file("a.txt"), file("b.txt"), file("c.txt")],
|
|
716
|
+
});
|
|
717
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
718
|
+
const middle = await screen.findByRole("treeitem", { name: "b.txt" });
|
|
719
|
+
fireEvent.click(screen.getByText("b.txt"));
|
|
720
|
+
expect(middle).toHaveFocus();
|
|
721
|
+
fireEvent.keyDown(middle, { key: "ArrowDown" });
|
|
722
|
+
expect(screen.getByRole("treeitem", { name: "c.txt" })).toHaveFocus();
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
it("closes failed expansions without persisting them and allows retry", async () => {
|
|
726
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
727
|
+
const folder = await screen.findByRole("treeitem", { name: "data" });
|
|
728
|
+
client.sendListFiles.mockRejectedValueOnce(new Error("Offline"));
|
|
729
|
+
fireEvent.click(folder);
|
|
730
|
+
fireEvent.keyDown(folder, { key: "ArrowRight" });
|
|
731
|
+
await waitFor(() =>
|
|
732
|
+
expect(folder).toHaveAttribute("aria-expanded", "false"),
|
|
733
|
+
);
|
|
734
|
+
expect(
|
|
735
|
+
store.get(openStateAtom)[fileTreeNodeId("/workspace", "/workspace/data")],
|
|
736
|
+
).toBe(false);
|
|
737
|
+
fireEvent.keyDown(folder, { key: "ArrowRight" });
|
|
738
|
+
expect(
|
|
739
|
+
await screen.findByRole("treeitem", { name: "report.csv" }),
|
|
740
|
+
).toBeVisible();
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
it("focuses a clicked search result so Enter opens that result", async () => {
|
|
744
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
745
|
+
files: [file("report-first.txt"), file("report-second.txt")],
|
|
746
|
+
query: "report",
|
|
747
|
+
totalFound: 2,
|
|
748
|
+
});
|
|
749
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
750
|
+
const input = await screen.findByRole("textbox", {
|
|
751
|
+
name: "Search files and folders",
|
|
752
|
+
});
|
|
753
|
+
input.focus();
|
|
754
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
755
|
+
await screen.findByText("2 matches");
|
|
756
|
+
fireEvent.click(screen.getByText("report-second.txt"));
|
|
757
|
+
const second = screen.getByRole("treeitem", {
|
|
758
|
+
name: "/workspace/report-second.txt",
|
|
759
|
+
});
|
|
760
|
+
expect(second).toHaveFocus();
|
|
761
|
+
fireEvent.keyDown(second, { key: "Enter" });
|
|
762
|
+
expect(await screen.findByText("Preview: report-second.txt")).toBeVisible();
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
it("passes hidden-file visibility to search and refetches when it changes", async () => {
|
|
766
|
+
client.sendSearchFiles.mockResolvedValue({
|
|
767
|
+
files: [],
|
|
768
|
+
query: "note",
|
|
769
|
+
totalFound: 0,
|
|
770
|
+
});
|
|
771
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
772
|
+
const input = await screen.findByRole("textbox", {
|
|
773
|
+
name: "Search files and folders",
|
|
774
|
+
});
|
|
775
|
+
fireEvent.change(input, { target: { value: "note" } });
|
|
776
|
+
await screen.findByText("No matching files or folders.");
|
|
777
|
+
expect(client.sendSearchFiles).toHaveBeenLastCalledWith(
|
|
778
|
+
expect.objectContaining({ includeHidden: true }),
|
|
779
|
+
);
|
|
780
|
+
fireEvent.click(screen.getByTestId("file-explorer-hidden-files-button"));
|
|
781
|
+
await waitFor(() =>
|
|
782
|
+
expect(client.sendSearchFiles).toHaveBeenLastCalledWith(
|
|
783
|
+
expect.objectContaining({ includeHidden: false }),
|
|
784
|
+
),
|
|
785
|
+
);
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
it("coalesces superseded searches without overlapping server scans", async () => {
|
|
789
|
+
const slow = new Deferred<FileSearchResponse>();
|
|
790
|
+
client.sendSearchFiles
|
|
791
|
+
.mockReturnValueOnce(slow.promise)
|
|
792
|
+
.mockResolvedValueOnce({
|
|
793
|
+
files: [file("notes.txt")],
|
|
794
|
+
query: "notes",
|
|
795
|
+
totalFound: 1,
|
|
796
|
+
});
|
|
797
|
+
render(<FileExplorer height={300} />, { wrapper });
|
|
798
|
+
const input = await screen.findByRole("textbox", {
|
|
799
|
+
name: "Search files and folders",
|
|
800
|
+
});
|
|
801
|
+
fireEvent.change(input, { target: { value: "report" } });
|
|
802
|
+
await waitFor(() => expect(client.sendSearchFiles).toHaveBeenCalledOnce());
|
|
803
|
+
fireEvent.change(input, { target: { value: "notes" } });
|
|
804
|
+
await act(async () => {
|
|
805
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
806
|
+
});
|
|
807
|
+
expect(client.sendSearchFiles).toHaveBeenCalledOnce();
|
|
808
|
+
fireEvent.change(input, { target: { value: "note" } });
|
|
809
|
+
await act(async () => {
|
|
810
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
811
|
+
});
|
|
812
|
+
expect(client.sendSearchFiles).toHaveBeenCalledOnce();
|
|
813
|
+
await act(async () => {
|
|
814
|
+
slow.resolve({
|
|
815
|
+
files: [file("data/report.csv")],
|
|
816
|
+
query: "report",
|
|
817
|
+
totalFound: 1,
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
await screen.findByText("1 match");
|
|
821
|
+
expect(client.sendSearchFiles).toHaveBeenCalledTimes(2);
|
|
822
|
+
expect(client.sendSearchFiles).toHaveBeenLastCalledWith(
|
|
823
|
+
expect.objectContaining({ query: "note" }),
|
|
824
|
+
);
|
|
825
|
+
expect(
|
|
826
|
+
screen.getByRole("treeitem", { name: "/workspace/notes.txt" }),
|
|
827
|
+
).toBeVisible();
|
|
828
|
+
expect(
|
|
829
|
+
screen.queryByRole("treeitem", { name: "/workspace/data/report.csv" }),
|
|
830
|
+
).not.toBeInTheDocument();
|
|
831
|
+
});
|
|
832
|
+
});
|