From c4eabf90e7e089b86b65c24656abb26768758de5 Mon Sep 17 00:00:00 2001 From: Renn F Date: Sun, 28 Jun 2026 18:31:03 +0200 Subject: [PATCH] [F085] reject submitting both project_id and product_id validate() only checked 'at least one of project/product', so the dialog let both be submitted together. The server silently lets product_id win at routing and drops project_id, recording a misleading, never-used repo. Add a validator that refuses the ambiguous submit with a clear error. The at-least-one rule and the single-pick submit paths are unchanged. --- .../__tests__/create-task-dialog.test.tsx | 206 ++++++++++++++++++ .../components/tasks/create-task-dialog.tsx | 10 + 2 files changed, 216 insertions(+) create mode 100644 panel/src/components/tasks/__tests__/create-task-dialog.test.tsx diff --git a/panel/src/components/tasks/__tests__/create-task-dialog.test.tsx b/panel/src/components/tasks/__tests__/create-task-dialog.test.tsx new file mode 100644 index 00000000..577bb855 --- /dev/null +++ b/panel/src/components/tasks/__tests__/create-task-dialog.test.tsx @@ -0,0 +1,206 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; +import { fireEvent, render, screen, waitFor } from "@testing-library/react"; + +const { mutateAsync } = vi.hoisted(() => ({ + mutateAsync: vi.fn().mockResolvedValue(undefined), +})); + +// useCreateTask: just needs a mutateAsync the test can assert on. +vi.mock("@/hooks/use-tasks", () => ({ + useCreateTask: () => ({ mutateAsync, isPending: false }), +})); + +// useProducts: one product so the Product