Files
element-call/src/initializer.test.ts
T

29 lines
824 B
TypeScript
Raw Normal View History

2022-12-09 14:25:02 -05:00
/*
Copyright 2022-2024 New Vector Ltd.
2022-12-09 14:25:02 -05:00
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
2022-12-09 14:25:02 -05:00
*/
import { expect, test } from "vitest";
2022-12-09 14:25:02 -05:00
import { Initializer } from "../src/initializer";
test("initBeforeReact sets font family from URL param", async () => {
2022-12-09 14:25:02 -05:00
window.location.hash = "#?font=DejaVu Sans";
await Initializer.initBeforeReact();
2022-12-09 14:25:02 -05:00
expect(
2023-10-11 10:42:04 -04:00
getComputedStyle(document.documentElement).getPropertyValue(
"--font-family",
),
2022-12-09 14:25:02 -05:00
).toBe('"DejaVu Sans"');
});
test("initBeforeReact sets font scale from URL param", async () => {
2022-12-09 14:25:02 -05:00
window.location.hash = "#?fontScale=1.2";
await Initializer.initBeforeReact();
2022-12-09 14:25:02 -05:00
expect(
2023-10-11 10:42:04 -04:00
getComputedStyle(document.documentElement).getPropertyValue("--font-scale"),
2022-12-09 14:25:02 -05:00
).toBe("1.2");
});