дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
fix(vcs): select a Push dialog repository row without unticking it (#6169)
In the multi-repository Push dialog, clicking a repository row to see its outgoing files also unticked it, because the row's click toggled the checkbox. A click on the row or its name now only selects it; the checkbox, or Space on the selected row, includes or excludes it. Closes #6151 Co-authored-by: Rhombicdodecahedron <[email protected]>
Цей коміт міститься в:
1 джерело
89524bd583
коміт
f2a372428c
3 files changed
+40
-20
No files matched your search
@@ -392,6 +392,29 @@ it("lists every repository on Push all, checks those with commits, expands none
|
||||
expect(mocks.ops[0]?.repo).toBe("/p/a");
|
||||
});
|
||||
|
||||
it("selects a repository row to show its files without unticking it; the checkbox or Space includes it", async () => {
|
||||
await openPushDialog();
|
||||
const box = () => screen.getByRole("checkbox", { name: "b" });
|
||||
expect(box()).toBeChecked();
|
||||
|
||||
const name = screen.getByTitle("b");
|
||||
fireEvent.mouseDown(name);
|
||||
fireEvent.click(name);
|
||||
expect(await screen.findByText("b.txt")).toBeInTheDocument();
|
||||
expect(box()).toBeChecked();
|
||||
|
||||
fireEvent.click(box());
|
||||
expect(box()).not.toBeChecked();
|
||||
fireEvent.click(box());
|
||||
expect(box()).toBeChecked();
|
||||
|
||||
const tree = screen.getByRole("tree", { name: "Outgoing commits" });
|
||||
fireEvent.keyDown(tree, { key: " " });
|
||||
expect(box()).not.toBeChecked();
|
||||
fireEvent.keyDown(tree, { key: " " });
|
||||
expect(box()).toBeChecked();
|
||||
});
|
||||
|
||||
it("shows only the repository Push was invoked from without a checkbox, its files shown at once", async () => {
|
||||
render(<VcsDialogHost />);
|
||||
await act(() => showPushDialog({ repo: "/p/b" }));
|
||||
|
||||
@@ -730,9 +730,6 @@
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.pushRepoName {
|
||||
min-width: 20px;
|
||||
}
|
||||
.pushRepoLabel,
|
||||
.pushSourceBranch {
|
||||
display: block;
|
||||
|
||||
@@ -772,7 +772,17 @@ function MultiPushDialog({
|
||||
diff={diff}
|
||||
onClose={closeDiff}
|
||||
commits={
|
||||
<div className={styles.pushTreeWrap}>
|
||||
<div
|
||||
className={styles.pushTreeWrap}
|
||||
onKeyDown={(e) => {
|
||||
// Space on a selected repository row includes or excludes it, as its checkbox does.
|
||||
const target = e.target as HTMLElement;
|
||||
if (e.key !== " " || e.metaKey || e.ctrlKey || e.altKey || only !== undefined) return;
|
||||
if (!shown || shown.commit || target.closest("input, button, textarea, [contenteditable]")) return;
|
||||
e.preventDefault();
|
||||
toggle(shown.repo.root);
|
||||
}}
|
||||
>
|
||||
{loadErrors.map(({ root, message }) => (
|
||||
<div key={root} className={styles.error} role="alert">
|
||||
<strong>{repoName(root)}</strong> {message}
|
||||
@@ -826,28 +836,18 @@ function MultiPushDialog({
|
||||
<span
|
||||
className={styles.pushRepoRow}
|
||||
data-idle={(!!n.repo.branch.upstream && !n.children?.length) || undefined}
|
||||
// A row click toggles the checkbox, like before; only the chevron collapses.
|
||||
onClick={(e) => {
|
||||
if (only === undefined && !(e.target as HTMLElement | null)?.closest?.("label"))
|
||||
toggle(n.repo.root);
|
||||
}}
|
||||
>
|
||||
{only === undefined ? (
|
||||
{/* A row click only selects it (its outgoing files); the checkbox, or Space, includes it. */}
|
||||
{only === undefined && (
|
||||
<Checkbox
|
||||
checked={checked.has(n.repo.root)}
|
||||
onChange={() => toggle(n.repo.root)}
|
||||
className={styles.pushRepoName}
|
||||
label={
|
||||
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
|
||||
{repoName(n.repo.root)}
|
||||
</span>
|
||||
}
|
||||
aria-label={repoName(n.repo.root)}
|
||||
/>
|
||||
) : (
|
||||
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
|
||||
{repoName(n.repo.root)}
|
||||
</span>
|
||||
)}
|
||||
<span className={styles.pushRepoLabel} title={repoName(n.repo.root)}>
|
||||
{repoName(n.repo.root)}
|
||||
</span>
|
||||
<span
|
||||
className={styles.pushSourceBranch}
|
||||
title={n.repo.review?.revision ?? n.repo.branch.head ?? detachedTitle(n.repo.branch.headCommit)}
|
||||
|
||||
Reference in new issue
Заблокувати користувача