From 5f9a29a3e5d63daec291ca5168b35cd40ed374b9 Mon Sep 17 00:00:00 2001 From: TianYun Date: Fri, 12 Jun 2026 11:17:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A0=E6=9D=90=E6=8B=96=E6=8B=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/GenerationComposer.test.tsx | 14 +++++++------- src/store/utils/__tests__/connectedInputs.test.ts | 1 + src/store/utils/connectedInputs.ts | 10 ++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/__tests__/GenerationComposer.test.tsx b/src/components/__tests__/GenerationComposer.test.tsx index a44667e1..3247b80d 100644 --- a/src/components/__tests__/GenerationComposer.test.tsx +++ b/src/components/__tests__/GenerationComposer.test.tsx @@ -1641,17 +1641,17 @@ describe("GenerationComposer", () => { setData: (type: string, value: string) => dataTransferStore.set(type, value), getData: (type: string) => dataTransferStore.get(type) ?? "", }; - const videoMaterial = screen.getByTitle("@视频2"); - const imageMaterial = screen.getByTitle("Reference image 1"); + const videoMaterial = screen.getByLabelText("@视频2"); + const imageMaterial = screen.getByLabelText("参考图片 1"); const prompt = screen.getByDisplayValue("use @图1 and @视频2") as HTMLTextAreaElement; fireEvent.dragStart(videoMaterial, { dataTransfer }); fireEvent.drop(imageMaterial, { dataTransfer }); expect(prompt).toHaveValue("use @图2 and @视频1"); - expect(screen.getByTitle("@视频1")).toBeInTheDocument(); - expect(screen.getByTitle("Reference image 2")).toBeInTheDocument(); - fireEvent.click(screen.getByLabelText("Generate")); + expect(screen.getByLabelText("@视频1")).toBeInTheDocument(); + expect(screen.getByLabelText("参考图片 2")).toBeInTheDocument(); + fireEvent.click(screen.getByLabelText(/Generate|生成/)); await waitFor(() => { expect(useWorkflowStore.getState().regenerateNode).toHaveBeenCalledWith("vid-1"); @@ -1662,14 +1662,14 @@ describe("GenerationComposer", () => { id: 1, type: "video", url: "https://static.popi.art/ref.mp4", - name: "@视频1", + name: "视频1", duration: 5.033, }, { id: 2, type: "image", url: "https://static.popi.art/ref.jpg", - name: "@图2", + name: "图2", }, ]); }); diff --git a/src/store/utils/__tests__/connectedInputs.test.ts b/src/store/utils/__tests__/connectedInputs.test.ts index 0801a78a..f751336a 100644 --- a/src/store/utils/__tests__/connectedInputs.test.ts +++ b/src/store/utils/__tests__/connectedInputs.test.ts @@ -305,6 +305,7 @@ describe("getConnectedInputsPure", () => { }] as WorkflowEdge[]; const result = getConnectedInputsPure("gen", nodes, edges); expect(result.videos).toEqual(["data:video/mp4;base64,v"]); + expect(result.videoItems).toEqual([{ url: "data:video/mp4;base64,v" }]); expect(result.dynamicInputs).toEqual({ video_urls: "data:video/mp4;base64,v" }); }); diff --git a/src/store/utils/connectedInputs.ts b/src/store/utils/connectedInputs.ts index 0bae507c..ec32b3da 100644 --- a/src/store/utils/connectedInputs.ts +++ b/src/store/utils/connectedInputs.ts @@ -267,12 +267,10 @@ export function getConnectedInputsPure( } else if (type === "video") { videos.push(value); const duration = sourceNode ? getNodeVideoDurationSeconds(sourceNode) : null; - if (targetHandle === SINGLE_INPUT_HANDLE_ID) { - videoItems.push({ - url: value, - ...(duration !== null && duration > 0 ? { duration } : {}), - }); - } + videoItems.push({ + url: value, + ...(duration !== null && duration > 0 ? { duration } : {}), + }); } else if (type === "audio") { audio.push(value); } else if (type === "text") {