CI / config (push) Canceled after 0s
CI / test-frontend (push) Canceled after 0s
CI / test-rust (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-e2e-release (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / release (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / docker-website (push) Canceled after 0s
Add a persistent system-content switch, translate the extension manager, and apply theme changes in place without reloading the browser UI. Co-Authored-By: Codex <noreply@anthropic.com>
26 lines
756 B
TypeScript
26 lines
756 B
TypeScript
import { afterEach, expect, test } from "vitest";
|
|
import { toggleDarkMode } from "./editor.ts";
|
|
|
|
const originalSyscall = globalThis.syscall;
|
|
|
|
afterEach(() => {
|
|
globalThis.syscall = originalSyscall;
|
|
});
|
|
|
|
test("toggles and persists the theme without reloading the browser UI", async () => {
|
|
const calls: [string, ...any[]][] = [];
|
|
globalThis.syscall = async (name: string, ...args: any[]) => {
|
|
calls.push([name, ...args]);
|
|
if (name === "editor.getUiOption") return false;
|
|
};
|
|
|
|
await toggleDarkMode();
|
|
|
|
expect(calls).toEqual([
|
|
["editor.getUiOption", "darkMode"],
|
|
["clientStore.set", "darkMode", true],
|
|
["editor.setUiOption", "darkMode", true],
|
|
]);
|
|
expect(calls.some(([name]) => name === "editor.reloadUI")).toBe(false);
|
|
});
|