mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-11-01 08:05:23 +00:00
feat: row detail options for hosts and credentials, open manage from sidebar header
This commit is contained in:
1 parent
08db1fcdde
commit
a72aa5b57b
18 files changed
+415
-45
No files matched your search
@@ -43,7 +43,11 @@ vi.mock("@/main-axios", () => ({
|
||||
getHostPassword: vi.fn(),
|
||||
}));
|
||||
|
||||
import { HostItem } from "../../../../sidebar/tree/HostItem/HostItem";
|
||||
import {
|
||||
HostItem,
|
||||
formatHostAddress,
|
||||
} from "../../../../sidebar/tree/HostItem/HostItem";
|
||||
import { defaultHostRowFields } from "@/types/host-sidebar-preferences";
|
||||
|
||||
const baseHost: Host = {
|
||||
id: "1",
|
||||
@@ -356,3 +360,45 @@ describe("HostItem click behavior", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("HostItem row fields", () => {
|
||||
function renderWith(
|
||||
fields: Partial<ReturnType<typeof defaultHostRowFields>>,
|
||||
) {
|
||||
return render(
|
||||
<HostItem
|
||||
host={baseHost}
|
||||
onOpenTab={noop}
|
||||
onEditHost={noop}
|
||||
onDelete={noop}
|
||||
onDuplicate={noop}
|
||||
density="comfortable"
|
||||
rowFields={{ ...defaultHostRowFields(), ...fields }}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
it("shows user@address by default", () => {
|
||||
renderWith({});
|
||||
expect(screen.getByText("root@10.0.0.5")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("hides the address when turned off", () => {
|
||||
renderWith({ showAddress: false });
|
||||
expect(screen.queryByText(/10\.0\.0\.5/)).toBeNull();
|
||||
});
|
||||
|
||||
it("hides the pin icon when turned off", () => {
|
||||
renderWith({ showPinIcon: false });
|
||||
expect(document.querySelector(".lucide-pin")).toBeNull();
|
||||
});
|
||||
|
||||
it("formats the address from the chosen parts", () => {
|
||||
expect(
|
||||
formatHostAddress(baseHost, { showUsername: false, showPort: true }),
|
||||
).toBe("10.0.0.5:22");
|
||||
expect(
|
||||
formatHostAddress(baseHost, { showUsername: true, showPort: false }),
|
||||
).toBe("root@10.0.0.5");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user