diff options
| author | Adam Malczewski <[email protected]> | 2026-10-15 14:38:50 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-15 14:38:50 +0900 |
| commit | c4c1d76fec972e5d902a669f0cb1953eaa528f16 (patch) | |
| tree | d5d85b8500157dd690e13954216a61a6aac64a8a /src/features/tabs/tabs.test.ts | |
| parent | 3d3c28b10de06aae7e2ad474e8931a3fdd88b41c (diff) | |
| download | dispatch-web-c4c1d76fec972e5d902a669f0cb1953eaa528f16.tar.gz dispatch-web-c4c1d76fec972e5d902a669f0cb1953eaa528f16.zip | |
feat(tabs): 2-column tab grid with nestable subagent groups + tab menu (add/remove from group)
Diffstat (limited to 'src/features/tabs/tabs.test.ts')
| -rw-r--r-- | src/features/tabs/tabs.test.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/features/tabs/tabs.test.ts b/src/features/tabs/tabs.test.ts index ec93076..696e994 100644 --- a/src/features/tabs/tabs.test.ts +++ b/src/features/tabs/tabs.test.ts @@ -10,6 +10,7 @@ import { newDraft, selectTab, setModel, + setTabGroupParent, setTitle, shortHandle, } from "./tabs"; @@ -223,3 +224,31 @@ describe("shortHandle", () => { expect(shortHandle("abcd", ["abcd", "abcd1234"])).toBe("abcd"); }); }); + +describe("setTabGroupParent", () => { + const base: TabsState = { + tabs: [ + { conversationId: "a", model: "m", title: "A", workspaceId: "w" }, + { conversationId: "b", model: "m", title: "B", workspaceId: "w" }, + ], + activeConversationId: "a", + }; + + it("sets the tab group parent on the named tab only", () => { + const next = setTabGroupParent(base, "b", "a"); + expect(next.tabs[1]?.tabGroupParentId).toBe("a"); + expect(next.tabs[0]).toBe(base.tabs[0]); + expect(next.activeConversationId).toBe("a"); + }); + + it("clears the key entirely with null", () => { + const grouped = setTabGroupParent(base, "b", "a"); + const cleared = setTabGroupParent(grouped, "b", null); + expect(cleared.tabs[1]).toEqual(base.tabs[1]); + expect("tabGroupParentId" in (cleared.tabs[1] ?? {})).toBe(false); + }); + + it("is a no-op for an unknown tab", () => { + expect(setTabGroupParent(base, "zz", "a").tabs).toEqual(base.tabs); + }); +}); |
