From 4c9d6839bceb466257e83a257ac96076b958a121 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Tue, 9 Jun 2026 18:38:40 -0700 Subject: [PATCH] FN-6148: add mobile GitHub toggle touch coverage Expand QuickEntryBox mobile touch coverage for the GitHub tracking toggle. - preserve the mobile quick-entry render helper return value for create payload assertions - add touch tests for GitHub toggle pressed state, SVG touch targets, submitted overrides, and primary styling - verify mobile touch can disable GitHub tracking before quick task submission Files changed: packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx | 63 +++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-6148 Fusion-Task-Lineage: 4a577bc3-bf98-4821-aba2-0c66b99f1e1f --- .../__tests__/QuickEntryBox.test.tsx | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx b/packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx index 617378d318..6cb6d75e64 100644 --- a/packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx +++ b/packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx @@ -465,11 +465,12 @@ describe("QuickEntryBox", () => { vi.mocked(fetchSettings).mockResolvedValueOnce({ githubTrackingEnabledByDefault: true, } as any); - renderQuickEntryBox(props); + const result = renderQuickEntryBox(props); expandQuickEntry(); await waitFor(() => { expect(screen.getByTestId("quick-entry-github-toggle")).not.toBeDisabled(); }); + return result; } function focusTextareaWithValue(value: string) { @@ -535,6 +536,66 @@ describe("QuickEntryBox", () => { expect(fastToggle.getAttribute("aria-pressed")).toBe("true"); }); + it("toggles GitHub tracking pressed state via mobile touch", async () => { + await renderMobileQuickEntryWithEnabledActions(); + const githubToggle = screen.getByTestId("quick-entry-github-toggle"); + + expect(githubToggle).toHaveAttribute("aria-pressed", "true"); + await touchActionButton(githubToggle); + expect(githubToggle).toHaveAttribute("aria-pressed", "false"); + + await touchActionButton(githubToggle); + expect(githubToggle).toHaveAttribute("aria-pressed", "true"); + }); + + it("captures an SVG touch target inside the GitHub tracking toggle", async () => { + await renderMobileQuickEntryWithEnabledActions(); + const githubToggle = screen.getByTestId("quick-entry-github-toggle"); + const svg = githubToggle.querySelector("svg"); + expect(svg).not.toBeNull(); + + expect(githubToggle).toHaveAttribute("aria-pressed", "true"); + const { preventDefaultSpy } = fireCancelableTouchStart(svg!); + expect(preventDefaultSpy).toHaveBeenCalled(); + await act(async () => { + fireEvent(svg!, new Event("touchend", { bubbles: true, cancelable: true })); + vi.runOnlyPendingTimers(); + vi.runOnlyPendingTimers(); + }); + + expect(githubToggle).toHaveAttribute("aria-pressed", "false"); + }); + + it("submits GitHub tracking override after mobile touch disables tracking", async () => { + const { props } = await renderMobileQuickEntryWithEnabledActions(); + const githubToggle = screen.getByTestId("quick-entry-github-toggle"); + const textarea = screen.getByTestId("quick-entry-input"); + + await touchActionButton(githubToggle); + expect(githubToggle).toHaveAttribute("aria-pressed", "false"); + + fireEvent.change(textarea, { target: { value: "Disable GitHub tracking by touch" } }); + fireEvent.keyDown(textarea, { key: "Enter" }); + + await waitFor(() => { + expect(props.onCreate).toHaveBeenCalled(); + }); + const payload = props.onCreate.mock.calls[0]?.[0]; + expect(payload.githubTracking).toEqual({ enabled: false }); + }); + + it("toggles GitHub tracking primary button styling via mobile touch", async () => { + await renderMobileQuickEntryWithEnabledActions(); + const githubToggle = screen.getByTestId("quick-entry-github-toggle"); + + expect(githubToggle.classList.contains("btn-primary")).toBe(true); + await touchActionButton(githubToggle); + expect(githubToggle.classList.contains("btn-primary")).toBe(false); + + await touchActionButton(githubToggle); + expect(githubToggle.classList.contains("btn-primary")).toBe(true); + }); + it("opens the priority picker via mobile touch", async () => { await renderMobileQuickEntryWithEnabledActions(); await touchActionButton(screen.getByTestId("quick-entry-priority-button"));