* Load the Intl.Segmenter polyfill only if needed * Also polyfill Intl.DurationFormat only if needed * Polyfill Intl.* in tests * Load the default translations in tests * Instanciate the Intl.DurationFormat in the component
29 lines
791 B
TypeScript
29 lines
791 B
TypeScript
/*
|
|
Copyright 2022-2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { expect, test } from "vitest";
|
|
|
|
import { Initializer } from "../src/initializer";
|
|
|
|
test("initBeforeReact sets font family from URL param", async () => {
|
|
window.location.hash = "#?font=DejaVu Sans";
|
|
await Initializer.initBeforeReact();
|
|
expect(
|
|
getComputedStyle(document.documentElement).getPropertyValue(
|
|
"--font-family",
|
|
),
|
|
).toBe('"DejaVu Sans"');
|
|
});
|
|
|
|
test("initBeforeReact sets font scale from URL param", async () => {
|
|
window.location.hash = "#?fontScale=1.2";
|
|
await Initializer.initBeforeReact();
|
|
expect(
|
|
getComputedStyle(document.documentElement).getPropertyValue("--font-scale"),
|
|
).toBe("1.2");
|
|
});
|