mirror of
https://github.com/YuzuZensai/Termix.git
synced 2026-11-12 11:56:47 +00:00
v26.10.5 (#1710)
* feat: add an auto or fixed columns picker to card grids * feat: add safe mode that only runs layout and theme plugins * docs: add simple layout to plugin table * fix: ask for local network access in the macOS app * feat: allow plugin registries on listed private hosts (#1705) * chore: add private registry hosts to the changelog * feat: use the proxy for plugin registry downloads * fix: allow changing connection origin on shared hosts * chore: update translations and plugin pins * chore: lint, format, and bump version to 26.10.5 --------- Co-authored-by: Lukas <80832688+0skater0@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { cleanup, render } from "@testing-library/react";
|
||||
|
||||
const toast = vi.hoisted(() => ({ warning: vi.fn() }));
|
||||
vi.mock("sonner", () => ({ toast }));
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key }),
|
||||
}));
|
||||
|
||||
const look = vi.hoisted(() => ({ safeMode: false }));
|
||||
vi.mock("@/look/look-store", () => ({
|
||||
useLookState: () => ({
|
||||
loaded: true,
|
||||
response: { safeMode: look.safeMode },
|
||||
}),
|
||||
}));
|
||||
|
||||
const { SafeModeNotice } = await import("@/shell/SafeModeNotice");
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
toast.warning.mockReset();
|
||||
});
|
||||
|
||||
describe("SafeModeNotice", () => {
|
||||
it("shows nothing when safe mode is off", () => {
|
||||
look.safeMode = false;
|
||||
render(<SafeModeNotice />);
|
||||
expect(toast.warning).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows a lasting warning when the server runs in safe mode", () => {
|
||||
look.safeMode = true;
|
||||
render(<SafeModeNotice />);
|
||||
expect(toast.warning).toHaveBeenCalledWith(
|
||||
"safeMode.title",
|
||||
expect.objectContaining({
|
||||
id: "safe-mode",
|
||||
description: "safeMode.description",
|
||||
duration: Infinity,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user