The best way to control Claude Code, Codex and more from any computer or phone

main
ts 50 lines 1.54 KB
Raw
1 import { describe, expect, it } from "vite-plus/test";
2
3 import { resolveComposerControlsOwnership } from "./composerControlsOwnership";
4
5 const base = {
6 matchesDefault: true,
7 collapsed: false,
8 measuredHiddenBlockCount: 0,
9 };
10
11 describe("resolveComposerControlsOwnership", () => {
12 it("hides the chip at the default and lets the model picker answer composer.mode", () => {
13 const result = resolveComposerControlsOwnership(base);
14 expect(result).toMatchObject({
15 accessDisplay: "hidden",
16 showModeBlock: false,
17 hiddenBlockIds: [],
18 pickerOwnsModeShortcut: true,
19 });
20 });
21
22 it("shows a labelled chip that owns composer.mode when the mode differs", () => {
23 const result = resolveComposerControlsOwnership({ ...base, matchesDefault: false });
24 expect(result).toMatchObject({
25 accessDisplay: "label",
26 showModeBlock: true,
27 pickerOwnsModeShortcut: false,
28 });
29 });
30
31 it("gives an overflowed chip's Permissions to the overflow menu", () => {
32 const result = resolveComposerControlsOwnership({
33 ...base,
34 matchesDefault: false,
35 measuredHiddenBlockCount: 1,
36 });
37 expect(result.hiddenBlockIds).toEqual(["mode"]);
38 expect(result.overflowShowsPermissions).toBe(true);
39 expect(result.pickerOwnsModeShortcut).toBe(false);
40 });
41
42 it("shows the non-default chip as an icon in the compacted row", () => {
43 const result = resolveComposerControlsOwnership({
44 ...base,
45 matchesDefault: false,
46 collapsed: true,
47 });
48 expect(result.accessDisplay).toBe("icon");
49 });
50 });