test(FN-4724): complete Step 2 — add worktrunk DOM-order regression

Fusion-Task-Id: FN-4724
Fusion-Task-Lineage: 3f633826-6c01-41ec-b55d-35c9ec5f27e3
This commit is contained in:
Fusion (runfusion.ai)
2026-05-16 07:26:36 -07:00
committed by gsxdsm
parent e0569d0805
commit e576a18c11

View File

@@ -2127,7 +2127,45 @@ describe("SettingsModal", () => {
expect(screen.getByLabelText("Worktrunk failure behavior")).toBeInTheDocument();
});
it("renders install affordance between enable toggle and binary path controls", async () => {
mockUseWorktrunkInstallStatus.mockReturnValue({
status: "missing",
requestInstall: vi.fn(),
requesting: false,
version: undefined,
installPath: undefined,
pendingApprovalId: undefined,
error: undefined,
});
renderModal({ initialSection: "worktrees" });
await waitForSettingsModalReady();
const enabledToggle = screen.getByLabelText("Enable worktrunk integration");
const installAffordance = screen.getByTestId("worktrunk-install-affordance");
const binaryPathInput = screen.getByLabelText("Worktrunk binary path");
const enableGroup = enabledToggle.closest(".form-group");
const binaryPathGroup = binaryPathInput.closest(".form-group");
expect(enableGroup).not.toBeNull();
expect(binaryPathGroup).not.toBeNull();
expect(enableGroup!.compareDocumentPosition(installAffordance) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(installAffordance.compareDocumentPosition(binaryPathGroup!) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
it("toggles disabled states and shows the worktreesDir precedence hint", async () => {
mockUseWorktrunkInstallStatus.mockReturnValue({
status: "installed",
requestInstall: vi.fn(),
requesting: false,
version: "v1.2.3",
installPath: "~/.fusion/bin/worktrunk",
pendingApprovalId: undefined,
error: undefined,
});
renderModal();
await waitForSettingsModalReady();
await userEvent.click(screen.getByText("Worktrees"));