mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 22:55:24 +00:00
feat: redesign user host defaults system
This commit is contained in:
1 parent
3028ab1176
commit
a4a4d4f27b
144 files changed
+24609
-2555
No files matched your search
@@ -116,11 +116,11 @@ describe(`${manifest.id} activate`, () => {
|
||||
it("registers its settings components", async () => {
|
||||
rendered = await renderWithApp(plugin, { manifest, locales });
|
||||
expect(rendered.registered.settingsComponents()).toEqual(
|
||||
expect.arrayContaining([
|
||||
"terminalDefaults",
|
||||
"newHostTheme",
|
||||
"newHostFontFamily",
|
||||
]),
|
||||
expect.arrayContaining(["touchInput", "imageStorageTest"]),
|
||||
);
|
||||
// Terminal defaults are host defaults now, set in the host editor.
|
||||
expect(rendered.registered.settingsComponents()).not.toContain(
|
||||
"terminalDefaults",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { TerminalDefaultsSettings } from "../../../src/frontend/settings/TerminalDefaultsSettings";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe("TerminalDefaultsSettings", () => {
|
||||
it("counts the defaults the user set", () => {
|
||||
render(
|
||||
<TerminalDefaultsSettings
|
||||
pluginId="ssh-terminal"
|
||||
values={{ terminalDefaults: { fontSize: 18, cursorBlink: false } }}
|
||||
setValue={vi.fn()}
|
||||
running
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText("2")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("applies the dialog's values to the terminalDefaults setting", () => {
|
||||
const setValue = vi.fn();
|
||||
render(
|
||||
<TerminalDefaultsSettings
|
||||
pluginId="ssh-terminal"
|
||||
values={{ terminalDefaults: { fontSize: 18 } }}
|
||||
setValue={setValue}
|
||||
running
|
||||
/>,
|
||||
);
|
||||
fireEvent.click(screen.getByText("terminalDefaults.manage"));
|
||||
fireEvent.change(screen.getByDisplayValue("18"), {
|
||||
target: { value: "20" },
|
||||
});
|
||||
fireEvent.click(screen.getByText("terminalDefaults.apply"));
|
||||
expect(setValue).toHaveBeenCalledWith("terminalDefaults", { fontSize: 20 });
|
||||
});
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
fromTriState,
|
||||
toTriState,
|
||||
} from "../../../src/frontend/settings/tri-state";
|
||||
|
||||
describe("tri-state", () => {
|
||||
it("keeps unset booleans distinct from false", () => {
|
||||
expect(toTriState(undefined)).toBe("inherit");
|
||||
expect(toTriState(true)).toBe("on");
|
||||
expect(toTriState(false)).toBe("off");
|
||||
|
||||
expect(fromTriState("inherit")).toBeUndefined();
|
||||
expect(fromTriState("on")).toBe(true);
|
||||
expect(fromTriState("off")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user