From c4e17f7eb779fc9391f93a5f0fbe4ec5aa9658d8 Mon Sep 17 00:00:00 2001 From: t8y2 Date: Fri, 25 Sep 2026 09:59:20 +0800 Subject: [PATCH] test(grid): stub RecycleScroller module in batch paste spec --- .../DataGridBatchPasteFromCell.spec.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/desktop/src/components/grid/__tests__/DataGridBatchPasteFromCell.spec.ts b/apps/desktop/src/components/grid/__tests__/DataGridBatchPasteFromCell.spec.ts index e182bfc477..919a9a1486 100644 --- a/apps/desktop/src/components/grid/__tests__/DataGridBatchPasteFromCell.spec.ts +++ b/apps/desktop/src/components/grid/__tests__/DataGridBatchPasteFromCell.spec.ts @@ -9,6 +9,30 @@ import type { CustomSaveHandler } from "@/composables/useDataGridEditor"; import { buildMongoUpdateDocument } from "@/lib/mongo/mongoDocumentValues"; import { TooltipProvider } from "@/components/ui/tooltip"; +// DataGrid.vue imports RecycleScroller directly (no global registration), +// so the module itself must be stubbed for deterministic row rendering. +vi.mock("vue-virtual-scroller", async () => { + const { defineComponent, h } = await import("vue"); + return { + RecycleScroller: defineComponent({ + props: { + items: { + type: Array as PropType, + default: () => [], + }, + }, + setup(props, { attrs, slots }) { + return () => + h( + "div", + attrs, + props.items.map((item) => slots.default?.({ item })), + ); + }, + }), + }; +}); + vi.mock("@/composables/useDataGridColumnResize", async (importOriginal) => { const actual = await importOriginal(); const { ref } = await import("vue");