#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Rearm the pipeline test picker so the same file can be run again (#7853)
Anthony Stirlingbcb2b450228f
diff --git a/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.test.tsx b/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.test.tsxindex 4aafb27766..67feb8e695 100644--- a/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.test.tsx+++ b/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.test.tsx@@ -46,6 +46,24 @@ describe("PipelineGraphToolbar", () => {expect(handlers.onTest).toHaveBeenCalledWith(file);});+ it("clears the picker after a test so the same file can be chosen again", () => {+ renderToolbar();+ const file = new File(["x"], "claim.pdf", { type: "application/pdf" });+ const input = document.querySelector<HTMLInputElement>(+ 'input[type="file"]',+ ) as HTMLInputElement;+ const setValue = vi.fn();+ Object.defineProperty(input, "value", {+ configurable: true,+ get: () => "",+ set: setValue,+ });++ fireEvent.change(input, { target: { files: [file] } });++ expect(setValue).toHaveBeenCalledWith("");+ });+it("will not offer a test run on a chain with no steps", () => {renderToolbar({ stepCount: 0 });expect(diff --git a/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.tsx b/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.tsxindex 30513f6a83..1eaa2eca05 100644--- a/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.tsx+++ b/frontend/editor/src/portal/components/pipelines/PipelineGraphToolbar.tsx@@ -1,3 +1,4 @@+import { useRef } from "react";import { useTranslation } from "react-i18next";import { Tooltip } from "@mantine/core";import ScienceOutlinedIcon from "@mui/icons-material/ScienceOutlined";@@ -49,6 +50,7 @@ export function PipelineGraphToolbar({onViewDefinition,}: PipelineGraphToolbarProps) {const { t } = useTranslation();+ const resetPicker = useRef<() => void>(null);return (<div className="portal-pipeline-toolbar">@@ -59,7 +61,12 @@ export function PipelineGraphToolbar({loading={testing}// A chain with no steps would hand the file straight back, reading as a silent no-op.disabled={stepCount === 0}- onChange={(file) => file && onTest(file)}+ resetRef={resetPicker}+ onChange={(file) => {+ if (!file) return;+ onTest(file);+ resetPicker.current?.();+ }}leftSection={<ScienceOutlinedIcon style={{ fontSize: "1.125rem" }} />}>{t("portal.pipelines.builder.testRun")}