2022-12-10 03:25:02 +08:00
|
|
|
/*
|
2024-09-06 16:22:13 +08:00
|
|
|
Copyright 2022-2024 New Vector Ltd.
|
2022-12-10 03:25:02 +08:00
|
|
|
|
2024-09-06 16:22:13 +08:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
Please see LICENSE in the repository root for full details.
|
2022-12-10 03:25:02 +08:00
|
|
|
*/
|
|
|
|
|
2024-08-27 21:45:39 +08:00
|
|
|
import { expect, test } from "vitest";
|
|
|
|
|
2022-12-10 03:25:02 +08:00
|
|
|
import { Initializer } from "../src/initializer";
|
|
|
|
|
|
|
|
test("initBeforeReact sets font family from URL param", () => {
|
|
|
|
window.location.hash = "#?font=DejaVu Sans";
|
|
|
|
Initializer.initBeforeReact();
|
|
|
|
expect(
|
2023-10-11 22:42:04 +08:00
|
|
|
getComputedStyle(document.documentElement).getPropertyValue(
|
|
|
|
"--font-family",
|
|
|
|
),
|
2022-12-10 03:25:02 +08:00
|
|
|
).toBe('"DejaVu Sans"');
|
|
|
|
});
|
|
|
|
|
|
|
|
test("initBeforeReact sets font scale from URL param", () => {
|
|
|
|
window.location.hash = "#?fontScale=1.2";
|
|
|
|
Initializer.initBeforeReact();
|
|
|
|
expect(
|
2023-10-11 22:42:04 +08:00
|
|
|
getComputedStyle(document.documentElement).getPropertyValue("--font-scale"),
|
2022-12-10 03:25:02 +08:00
|
|
|
).toBe("1.2");
|
|
|
|
});
|