дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Ref-name inputs only validated after the fact, so a space typed or pasted into a branch name showed "Branch name contains invalid characters" and disabled Create. Branch-name fields (New Branch, from a revision and in several repositories, Rename Branch, New Worktree, GitHub New Remote Branch) now clean the name while typing: forbidden characters are dropped and whitespace becomes '-', without stacking separators, keeping the caret in place. Shared via src/platform/gitRefName.ts and the useSanitizedField hook in src/ui. Closes #1553 Co-authored-by: jaw52 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
20 рядки
811 B
TypeScript
20 рядки
811 B
TypeScript
import { act, render, screen } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { expect, it } from "vitest";
|
|
import { GithubDialogHost } from "../ui/dialogs";
|
|
import { remoteBranchNameDialog } from "./RemoteBranchDialog";
|
|
|
|
it("turns spaces typed in the remote branch name into separators", async () => {
|
|
const user = userEvent.setup();
|
|
render(<GithubDialogHost />);
|
|
let result: Promise<string | null> | undefined;
|
|
act(() => {
|
|
result = remoteBranchNameDialog("");
|
|
});
|
|
const input = await screen.findByRole("textbox", { name: "Remote branch name" });
|
|
await user.type(input, "my feature");
|
|
expect(input).toHaveValue("my-feature");
|
|
await user.click(screen.getByRole("button", { name: "OK" }));
|
|
await expect(result).resolves.toBe("my-feature");
|
|
});
|