Skip to content
TypeScript

fix(server): read the smallest iOS simulator text size as small (#22114)

Victor Vogel0d51b146381c
diff --git a/apps/server/src/device/DeviceActions.test.ts b/apps/server/src/device/DeviceActions.test.ts
index 90f46a4b66d..a0bc0499d6f 100644
--- a/apps/server/src/device/DeviceActions.test.ts
+++ b/apps/server/src/device/DeviceActions.test.ts
@@ -155,6 +155,18 @@ describe("runDeviceAction", () => {
});
describe("readDeviceDetail", () => {
+ it.effect("reads the smallest iOS text size as small", () =>
+ Effect.gen(function* () {
+ const { ready } = makeReady((call) =>
+ call.args.join(" ").endsWith("ui SIM-1 content_size")
+ ? { stdout: "extra-small\n" }
+ : { code: 1 },
+ );
+ const detail = yield* readDeviceDetail(ready, "ios", udid);
+ expect(detail.settings.textSize).toBe("small");
+ }),
+ );
+
it.effect("reads iOS settings from simctl and the accessibility helper", () =>
Effect.gen(function* () {
const { ready } = makeReady((call) => {
diff --git a/apps/server/src/device/DeviceActions.ts b/apps/server/src/device/DeviceActions.ts
index 6b734b6b9b4..64630488f3d 100644
--- a/apps/server/src/device/DeviceActions.ts
+++ b/apps/server/src/device/DeviceActions.ts
@@ -102,10 +102,8 @@ const textSizeFromIos = (category: string): DeviceTextSize | undefined => {
);
if (entry) return entry[0];
if (category.startsWith("accessibility")) return "extra-large";
- if (category.includes("extra")) return "large";
- return category === "extra-small" || category === "small" || category === "medium"
- ? "small"
- : "default";
+ if (category === "extra-small" || category === "small" || category === "medium") return "small";
+ return category.includes("extra") ? "large" : "default";
};
const textSizeFromAndroid = (scale: number): DeviceTextSize => {