mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
feat: move the terminal fully into the ssh-terminal plugin (B9)
This commit is contained in:
1 parent
535126fd1b
commit
79d77678c9
309 files changed
+41789
-14958
No files matched your search
@@ -1,43 +0,0 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { AdminTouchInputSection } from "../../sidebar/AdminTouchInputSection";
|
||||
import { TOUCH_INPUT_DEFAULTS } from "@/types/touch-input-settings";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key }),
|
||||
}));
|
||||
|
||||
describe("AdminTouchInputSection", () => {
|
||||
it("shows simple defaults, keeps tunables collapsed, and resets", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onReset = vi.fn();
|
||||
render(
|
||||
<AdminTouchInputSection
|
||||
open
|
||||
onToggle={vi.fn()}
|
||||
settings={{ ...TOUCH_INPUT_DEFAULTS }}
|
||||
setSettings={vi.fn()}
|
||||
onSave={vi.fn()}
|
||||
onReset={onReset}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("admin.touchEnabled")).toBeTruthy();
|
||||
expect(screen.queryByLabelText("admin.touchDragThreshold")).toBeNull();
|
||||
await user.click(screen.getByText("admin.touchAdvanced"));
|
||||
expect(
|
||||
(screen.getByLabelText("admin.touchDragThreshold") as HTMLInputElement)
|
||||
.value,
|
||||
).toBe("6");
|
||||
expect(
|
||||
(
|
||||
screen.getByLabelText(
|
||||
"admin.touchMaximumTicksPerFrame",
|
||||
) as HTMLInputElement
|
||||
).value,
|
||||
).toBe("4");
|
||||
await user.click(screen.getByText("admin.touchResetDefaults"));
|
||||
expect(onReset).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
@@ -60,10 +60,8 @@ describe("RAIL_ITEMS", () => {
|
||||
"serial",
|
||||
"ssh-tools",
|
||||
"macros",
|
||||
"history",
|
||||
"session-logs",
|
||||
"split-screen",
|
||||
"local-terminal",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -84,7 +82,7 @@ describe("RAIL_ITEMS", () => {
|
||||
[...RAIL_ITEMS, ...RAIL_UTILITY_ITEMS]
|
||||
.filter((item) => item.promotable)
|
||||
.map((item) => item.id),
|
||||
).toEqual(["termix-id", "ssh-tools", "macros", "history", "session-logs"]);
|
||||
).toEqual(["termix-id", "ssh-tools", "macros", "session-logs"]);
|
||||
});
|
||||
|
||||
it("derives promotableIds from the promotable flag", () => {
|
||||
@@ -125,7 +123,6 @@ describe("RAIL_ITEMS", () => {
|
||||
"connections",
|
||||
"ssh-tools",
|
||||
"macros",
|
||||
"history",
|
||||
"session-logs",
|
||||
]);
|
||||
});
|
||||
@@ -198,15 +195,27 @@ describe("railItemLabel", () => {
|
||||
delete (window as { IS_ELECTRON?: boolean }).IS_ELECTRON;
|
||||
});
|
||||
|
||||
const desktopOnly = {
|
||||
id: "desktop-only",
|
||||
icon: Boxes,
|
||||
labelKey: "nav.desktopOnly",
|
||||
pluginId: "p",
|
||||
electronOnly: true,
|
||||
};
|
||||
|
||||
it("hides electron-only destinations in the browser build", () => {
|
||||
const dispose = registerRailItem(desktopOnly);
|
||||
const ids = visibleRailItems().map((item) => item.id);
|
||||
expect(ids).not.toContain("local-terminal");
|
||||
dispose();
|
||||
expect(ids).not.toContain("desktop-only");
|
||||
});
|
||||
|
||||
it("shows electron-only destinations in the desktop app", () => {
|
||||
(window as { IS_ELECTRON?: boolean }).IS_ELECTRON = true;
|
||||
const dispose = registerRailItem(desktopOnly);
|
||||
const ids = visibleRailItems().map((item) => item.id);
|
||||
expect(ids).toContain("local-terminal");
|
||||
dispose();
|
||||
expect(ids).toContain("desktop-only");
|
||||
});
|
||||
|
||||
it("keeps every non-electron item in both builds", () => {
|
||||
|
||||
@@ -229,7 +229,8 @@ describe("HostItem density parity", () => {
|
||||
expect(hostRow).toBeTruthy();
|
||||
fireEvent.pointerEnter(hostRow!);
|
||||
|
||||
expect(preloadTabSurfaceMock).toHaveBeenCalledWith("terminal");
|
||||
// No plugin registered a connect action, so only the learned tool preloads.
|
||||
expect(preloadTabSurfaceMock).not.toHaveBeenCalledWith("");
|
||||
expect(preloadTabSurfaceMock).toHaveBeenCalledWith("tmux_monitor");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user