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 | dc829d314563589455b0a8d0a13a302180edcf4f (patch) | |
| tree | 5d4ccfd9be18cd8565732daecd66b726ee2132ab /src/app/App.test.ts | |
| parent | 18fe4ef5eddbf4c1719422d9caefa5a088a9b124 (diff) | |
| download | dispatch-web-dc829d314563589455b0a8d0a13a302180edcf4f.tar.gz dispatch-web-dc829d314563589455b0a8d0a13a302180edcf4f.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({ |
