mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-26 01:34:51 +08:00
Picking many reasoning levels for a Codex model catalog row pushed the levels column wider, and the rows stopped lining up with each other and with the header. - Each catalog row is its own grid, and its `1fr` tracks could not shrink below their content, so a long label such as "none,low,medium,high,xhigh,max" widened its own row. The header and row templates now use `minmax(0,1fr)`, so every row splits the width the same way and the label's existing truncation takes effect. - The trigger label collapses each run of three or more adjacent levels into "first → last": "low → max", or "none, low → max" when minimal is skipped. A range never spans a skipped level, so it cannot suggest a level that was not picked. Shorter runs, gapped picks such as "low, high, max" and lists that are not in canonical order are shown in full. - Hovering or keyboard-focusing the trigger shows every picked level and, when one is set, the default level (new codexConfig.defaultReasoningLevelTip key in all four locales).
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { formatReasoningLevelsLabel } from "@/components/providers/forms/CodexFormFields";
|
|
|
|
describe("formatReasoningLevelsLabel", () => {
|
|
it("collapses a run of three or more adjacent levels into a range", () => {
|
|
expect(
|
|
formatReasoningLevelsLabel(["low", "medium", "high", "xhigh", "max"]),
|
|
).toBe("low → max");
|
|
});
|
|
|
|
it("collapses each run separately, so a skipped level stays visible", () => {
|
|
// minimal sits between none and low: none must not join the low run.
|
|
expect(
|
|
formatReasoningLevelsLabel([
|
|
"none",
|
|
"low",
|
|
"medium",
|
|
"high",
|
|
"xhigh",
|
|
"max",
|
|
]),
|
|
).toBe("none, low → max");
|
|
expect(formatReasoningLevelsLabel(["none", "low", "medium", "high"])).toBe(
|
|
"none, low → high",
|
|
);
|
|
});
|
|
|
|
it("lists short runs and gapped picks as they are", () => {
|
|
expect(formatReasoningLevelsLabel(["high"])).toBe("high");
|
|
expect(formatReasoningLevelsLabel(["none", "high"])).toBe("none, high");
|
|
expect(formatReasoningLevelsLabel(["low", "high", "max"])).toBe(
|
|
"low, high, max",
|
|
);
|
|
expect(formatReasoningLevelsLabel(["low", "medium", "xhigh"])).toBe(
|
|
"low, medium, xhigh",
|
|
);
|
|
});
|
|
|
|
it("keeps a non-canonical order as a plain list", () => {
|
|
expect(formatReasoningLevelsLabel(["high", "medium", "low"])).toBe(
|
|
"high, medium, low",
|
|
);
|
|
});
|
|
});
|