diff options
| author | Adam Malczewski <[email protected]> | 2026-06-27 16:08:10 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-27 16:08:10 +0900 |
| commit | 6bd8f4718b44d06d116d02d9538214c8450b1c8d (patch) | |
| tree | d709dc077be66cbf22108e492472e27cf731440d /src/app/App.test.ts | |
| parent | 0e0601817712033b3247695646acd22d6496330a (diff) | |
| download | dispatch-web-6bd8f4718b44d06d116d02d9538214c8450b1c8d.tar.gz dispatch-web-6bd8f4718b44d06d116d02d9538214c8450b1c8d.zip | |
feat(sidebar-tabs): add active tab title to top bar (New Tab for unstarted chats)
Diffstat (limited to 'src/app/App.test.ts')
| -rw-r--r-- | src/app/App.test.ts | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/app/App.test.ts b/src/app/App.test.ts index 7c0a851..3d6e70c 100644 --- a/src/app/App.test.ts +++ b/src/app/App.test.ts @@ -136,6 +136,46 @@ describe("App component interaction tests", () => { store.dispose(); }); + it("shows 'New Tab' in the top bar for an unstarted draft (no active tab)", () => { + const ws = fakeSocket(); + const store = createAppStore({ + socketFactory: () => ws, + fetchImpl: fakeFetchImpl(), + localStorage: createFakeStorage(), + }); + ws.resolveOpen(); + + render(App, { props: { store } }); + + expect(store.activeConversationId).toBeNull(); + expect(screen.getByTestId("top-bar-title")).toHaveTextContent("New Tab"); + + store.dispose(); + }); + + it("shows the active tab's title in the top bar once a tab is started", async () => { + const ws = fakeSocket(); + const store = createAppStore({ + socketFactory: () => ws, + fetchImpl: fakeFetchImpl(), + localStorage: createFakeStorage(), + }); + ws.resolveOpen(); + + render(App, { props: { store } }); + + // Promote draft → tab: the tab's title is derived from the first message. + store.send("Refactor the auth module"); + expect(store.activeConversationId).not.toBeNull(); + + // The top-bar title updates reactively; findByTestId awaits the flush. + expect(await screen.findByTestId("top-bar-title")).toHaveTextContent( + "Refactor the auth module", + ); + + store.dispose(); + }); + it("auto-subscribes to every catalog entry on render (no buttons to click)", () => { const ws = fakeSocket(); const store = createAppStore({ |
