summaryrefslogtreecommitdiffhomepage
path: root/src/features/tabs/ui.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-07 14:49:30 +0900
committerAdam Malczewski <[email protected]>2026-06-07 14:49:30 +0900
commit29aef69f00906a7ef973bd68df7a56c7a212206f (patch)
tree4229199b4aed1d9225a50ca95e05ffb8f204e418 /src/features/tabs/ui.test.ts
parent0cb08678ffead285afb1f93ba50cd5a144ed5e7d (diff)
downloaddispatch-web-29aef69f00906a7ef973bd68df7a56c7a212206f.tar.gz
dispatch-web-29aef69f00906a7ef973bd68df7a56c7a212206f.zip
feat(tabs): polish new-chat button — stuck-only square edge, New Chat labelHEADmain
- isStuckToEnd (pure): square the sticky '+' right edge only while it floats over scrolled tabs; rounded at rest. Edge-measured in TabBar via a disposed scroll + ResizeObserver effect (RO guarded for non-browser envs). - Show a temporary 'New Chat' title when the draft is selected, with the '+' moved to the trailing close-button slot for consistency with real tabs.
Diffstat (limited to 'src/features/tabs/ui.test.ts')
-rw-r--r--src/features/tabs/ui.test.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/features/tabs/ui.test.ts b/src/features/tabs/ui.test.ts
index 53df0be..1ae18c8 100644
--- a/src/features/tabs/ui.test.ts
+++ b/src/features/tabs/ui.test.ts
@@ -145,4 +145,34 @@ describe("TabBar", () => {
const newChat = screen.getByRole("button", { name: "New chat" });
expect(newChat).toHaveClass("sticky");
});
+
+ it("shows visible 'New Chat' text when activeConversationId is null", () => {
+ render(TabBar, {
+ props: {
+ tabs: sampleTabs,
+ activeConversationId: null,
+ onSelect: vi.fn(),
+ onClose: vi.fn(),
+ onNewDraft: vi.fn(),
+ },
+ });
+
+ const newChat = screen.getByRole("button", { name: "New chat" });
+ expect(newChat).toHaveTextContent("New Chat");
+ });
+
+ it("does not show 'New Chat' text when a real tab is active", () => {
+ render(TabBar, {
+ props: {
+ tabs: sampleTabs,
+ activeConversationId: "c1",
+ onSelect: vi.fn(),
+ onClose: vi.fn(),
+ onNewDraft: vi.fn(),
+ },
+ });
+
+ const newChat = screen.getByRole("button", { name: "New chat" });
+ expect(newChat).not.toHaveTextContent("New Chat");
+ });
});