mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
fix(vcs): keep long Git Log filters compact (#5201)
Long Git Log filter values now end in an ellipsis, with the full value available on hover. A tighter width in compact commit panes keeps the active filter and its clear button visible at more window sizes.
This commit is contained in:
@@ -225,6 +225,50 @@ test("Git Log keeps filters and actions inside the commit pane at the minimum wi
|
||||
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("long Git Log filter values shorten inside their buttons", async ({ workbench: page }) => {
|
||||
const branchName = "feature/quarterly-settlement-and-backoffice-invoice-reconciliation";
|
||||
await page.setViewportSize({ width: 1120, height: 720 });
|
||||
await page.evaluate(async (branch) => {
|
||||
const logModule = "/src/features/vcs/logStore.ts";
|
||||
const optionsModule = "/src/features/vcs/logOptions.ts";
|
||||
const { setLogBranches } = await import(/* @vite-ignore */ logModule);
|
||||
const { setLogOptions } = await import(/* @vite-ignore */ optionsModule);
|
||||
setLogOptions({ showBranches: false, showDetails: false });
|
||||
setLogBranches([branch]);
|
||||
}, branchName);
|
||||
|
||||
const toolbar = page.getByRole("toolbar", { name: "Log filters" });
|
||||
const branch = toolbar.getByRole("button", { name: `Branch: ${branchName}`, exact: true });
|
||||
const value = branch.getByText(branchName, { exact: true });
|
||||
const clear = toolbar.getByRole("button", { name: "Clear Branch filter", exact: true });
|
||||
for (const width of [1120, 620]) {
|
||||
await page.setViewportSize({ width, height: 720 });
|
||||
await expect(branch).toBeVisible();
|
||||
await expect(value).toHaveCSS("text-overflow", "ellipsis");
|
||||
expect(
|
||||
await value.evaluate((label) => {
|
||||
const bounds = label.getBoundingClientRect();
|
||||
const button = label.closest("button")!.getBoundingClientRect();
|
||||
return label.scrollWidth > label.clientWidth && bounds.width > 0 && bounds.right <= button.right;
|
||||
}),
|
||||
).toBe(true);
|
||||
await expect(branch).toHaveAttribute("title", branchName);
|
||||
await clear.click({ trial: true });
|
||||
}
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 560 });
|
||||
// The overflow is measured after the resize: open the menu once the filter has moved into it.
|
||||
await expect(branch).toBeHidden();
|
||||
await toolbar.getByRole("button", { name: "More Filters" }).click();
|
||||
await expect(page.getByRole("menuitem", { name: `Branch: ${branchName}`, exact: true })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
await page.setViewportSize({ width: 620, height: 720 });
|
||||
await clear.click();
|
||||
await expect(toolbar.getByRole("button", { name: "Branch", exact: true })).toBeVisible();
|
||||
await expect(clear).toBeHidden();
|
||||
});
|
||||
|
||||
test("Git Log puts affected changes on the changed-files toolbar and groups preview options", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
|
||||
@@ -162,15 +162,24 @@
|
||||
white-space: nowrap;
|
||||
max-width: 220px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.filterValue {
|
||||
min-width: 0;
|
||||
max-width: 16ch;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--fg-strong);
|
||||
}
|
||||
@container git-log (max-width: 600px) {
|
||||
.filterValue {
|
||||
max-width: 10ch;
|
||||
}
|
||||
}
|
||||
.filterChevron {
|
||||
color: var(--fg-icon);
|
||||
}
|
||||
.filterClear {
|
||||
flex: none;
|
||||
height: 100%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -56,7 +56,13 @@ function FilterButton({ label, value, onOpen, onClear, hidden }: LogFilter & { h
|
||||
className={clsx(styles.filterButton, value && styles.filterActive, hidden && styles.filterHidden)}
|
||||
inert={hidden}
|
||||
>
|
||||
<button type="button" className={styles.filterMain} onClick={(e) => onOpen(e.currentTarget)} aria-haspopup="menu">
|
||||
<button
|
||||
type="button"
|
||||
className={styles.filterMain}
|
||||
onClick={(e) => onOpen(e.currentTarget)}
|
||||
aria-haspopup="menu"
|
||||
title={value ?? undefined}
|
||||
>
|
||||
{value ? (
|
||||
<>
|
||||
{tx(label)}: <span className={styles.filterValue}>{value}</span>
|
||||
|
||||
Reference in New Issue
Block a user