Open History to see the last commit
1import { expect, it } from "vite-plus/test";
2
3import { floatingTabsMetrics } from "./floating-workspace-tabs";
4import { resolveAndroidNavigationStyle } from "../../../lib/androidNavigationStyle";
5
6it.each([
7 [undefined, "Samsung", false, "one-ui"],
8 [undefined, "samsung", false, "one-ui"],
9 [undefined, "Google", false, "material"],
10 [undefined, null, false, "material"],
11 [undefined, "Google", true, "one-ui"],
12 ["material", "Samsung", false, "material"],
13 ["one-ui", "Google", false, "one-ui"],
14 ["material", "Google", true, "material"],
15] as const)(
16 "resolves navigation preference %s on %s with preview %s",
17 (preference, manufacturer, preview, expected) => {
18 expect(resolveAndroidNavigationStyle(preference, manufacturer, preview)).toBe(expected);
19 },
20);
21
22it.each([
23 [475, 1, 56, 4, 56],
24 [411, 1, 56, 4, 56],
25 [475, 1.25, 70, 4, 70],
26 [320, 11 / 16, 48, 4, 48],
27 [320, 1, 56, 4, 55.2],
28 [320, 22 / 16, 77, 4, 55.2],
29 [300, 22 / 16, 77, 4, 51.2],
30 [411, 22 / 16, 77, 4, 73.4],
31 [320, 22 / 16, 77, 2, 77],
32] as const)(
33 "fills a %sdp row at scale %s beside a %sdp compose button",
34 (width, scale, fabSize, count, height) => {
35 const metrics = floatingTabsMetrics(count, scale, fabSize, width, true);
36 expect(metrics.pill + 2 * 16 + 12 + metrics.height).toBeCloseTo(width);
37 expect(metrics.height).toBeCloseTo(height);
38 expect(metrics.pill / count).toBeGreaterThanOrEqual(metrics.height - 0.001);
39 },
40);