1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-28 15:22:05 +03:00

Use browser's font size instead of hardcoded 16px as root font size (#12246)

* WIP Use browser font size instead of hardcoded 16px

* Add font migration to v3

* Remove custom font size input

* Use a dropdown instead of a slider

* Add margin to the font size dropdown

* Fix `UpdateFontSizeDelta` action typo

* Fix `fontScale`in `Call.ts`

* Rename `baseFontSizeV3` to `fontSizeDelta`

* Update playwright test

* Add `default` next to the browser font size

* Remove remaining `TODO`

* Remove falsy `private`

* Improve doc

* Update snapshots after develop merge

* Remove commented import
This commit is contained in:
Florian Duros
2024-02-21 12:23:07 +01:00
committed by GitHub
parent 36a8d503df
commit 6d55ce0217
17 changed files with 453 additions and 366 deletions

View File

@ -710,8 +710,8 @@ describe("ElementCall", () => {
const originalGetValue = SettingsStore.getValue;
SettingsStore.getValue = <T>(name: string, roomId?: string, excludeDefault?: boolean) => {
switch (name) {
case "baseFontSizeV2":
return 12 as T;
case "fontSizeDelta":
return 4 as T;
case "useSystemFont":
return true as T;
case "systemFont":
@ -720,13 +720,14 @@ describe("ElementCall", () => {
return originalGetValue<T>(name, roomId, excludeDefault);
}
};
document.documentElement.style.fontSize = "12px";
await ElementCall.create(room);
const call = Call.get(room);
if (!(call instanceof ElementCall)) throw new Error("Failed to create call");
const urlParams = new URLSearchParams(new URL(call.widget.url).hash.slice(1));
expect(urlParams.get("fontScale")).toBe("0.75");
expect(urlParams.get("fontScale")).toBe("1.5");
expect(urlParams.getAll("font")).toEqual(["OpenDyslexic", "DejaVu Sans"]);
SettingsStore.getValue = originalGetValue;