mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
fix(sidebar): keep compact host addresses visible (#1524)
This commit is contained in:
1 parent
64b9b18fe6
commit
718717554d
4 files changed
+117
-16
No files matched your search
@@ -1167,18 +1167,11 @@ export function HostItem({
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
{isCompact &&
|
||||
!selectionMode &&
|
||||
!shouldUseClickTray &&
|
||||
!actionsOnly && (
|
||||
<span
|
||||
className={`text-[11px] text-muted-foreground/70 truncate leading-none ml-auto shrink-0 ${hoverTrayOpen ? "hidden" : ""}`}
|
||||
>
|
||||
{host.ip}
|
||||
</span>
|
||||
)}
|
||||
{isCompact && selectionMode && (
|
||||
<span className="text-[11px] text-muted-foreground/70 truncate leading-none ml-auto shrink-0">
|
||||
{isCompact && (
|
||||
<span
|
||||
className="text-[11px] text-muted-foreground/70 truncate leading-none ml-auto max-w-[50%] shrink-0"
|
||||
title={host.ip}
|
||||
>
|
||||
{host.ip}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -187,6 +187,30 @@ describe("HostItem density parity", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["hover", "click", "always", "actionsOnly"] as const)(
|
||||
"keeps the compact host address visible with %s actions",
|
||||
(trayTrigger) => {
|
||||
const props = {
|
||||
host: baseHost,
|
||||
onOpenTab: noop,
|
||||
onDelete: noop,
|
||||
onDuplicate: noop,
|
||||
density: "compact" as const,
|
||||
trayTrigger,
|
||||
};
|
||||
const { rerender } = render(<HostItem {...props} />);
|
||||
expect(screen.getByText(baseHost.ip).classList.contains("hidden")).toBe(
|
||||
false,
|
||||
);
|
||||
rerender(<HostItem {...props} isHovered />);
|
||||
expect(screen.getByText(baseHost.ip).classList.contains("hidden")).toBe(
|
||||
false,
|
||||
);
|
||||
rerender(<HostItem {...props} isTrayOpen selectionMode />);
|
||||
expect(screen.getAllByText(baseHost.ip)).toHaveLength(1);
|
||||
},
|
||||
);
|
||||
|
||||
it("shows tags in both densities when showTags is true", () => {
|
||||
renderHostItem("comfortable");
|
||||
expect(screen.getByText("prod")).toBeTruthy();
|
||||
|
||||
Reference in new issue
Block a user