summaryrefslogtreecommitdiffhomepage
path: root/src/features/workspaces/ui/WorkspaceCard.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-27 17:23:40 +0900
committerAdam Malczewski <[email protected]>2026-06-27 17:23:40 +0900
commit11dc42164937c99359f1dc1b01756d6409fac906 (patch)
tree32c80bd4c5d1f88582dfc82d53c7771cde8fb004 /src/features/workspaces/ui/WorkspaceCard.test.ts
parent2958186fcc7d8278e9ae18cf9f366c5ab3a34992 (diff)
downloaddispatch-web-11dc42164937c99359f1dc1b01756d6409fac906.tar.gz
dispatch-web-11dc42164937c99359f1dc1b01756d6409fac906.zip
feat(sidebar-tabs): add dashboard home button + same-tab workspace open
Diffstat (limited to 'src/features/workspaces/ui/WorkspaceCard.test.ts')
-rw-r--r--src/features/workspaces/ui/WorkspaceCard.test.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/features/workspaces/ui/WorkspaceCard.test.ts b/src/features/workspaces/ui/WorkspaceCard.test.ts
index 0736efb..0d03b8e 100644
--- a/src/features/workspaces/ui/WorkspaceCard.test.ts
+++ b/src/features/workspaces/ui/WorkspaceCard.test.ts
@@ -119,16 +119,20 @@ describe("WorkspaceCard", () => {
expect(store.setDefaultCwd).toHaveBeenCalledWith("my-ws", null);
});
- it("the Open link opens the workspace in a new browser tab (no same-tab navigation)", () => {
+ it("the Open link navigates to the workspace in the same tab (SPA navigation, no new tab)", async () => {
+ const user = userEvent.setup();
const store = fakeStore() as unknown as WorkspaceStore;
const onNavigate = vi.fn();
render(WorkspaceCard, { props: { ws: fakeEntry(), store, onNavigate, computers: [] } });
const open = screen.getByRole("link", { name: "Open" });
- // Native new-tab link: href points at the workspace, and target="_blank"
- // opens it in a new browser tab rather than client-side navigating.
+ // Still a real link (progressive enhancement): href points at the workspace.
expect(open).toHaveAttribute("href", "/my-ws");
- expect(open).toHaveAttribute("target", "_blank");
- expect(open.getAttribute("rel") ?? "").toMatch(/noopener/);
+ // But it no longer opens a new browser tab.
+ expect(open).not.toHaveAttribute("target", "_blank");
+ // Clicking navigates in-place via the SPA callback.
+ await user.click(open);
+ expect(onNavigate).toHaveBeenCalledTimes(1);
+ expect(onNavigate).toHaveBeenCalledWith("/my-ws");
});
});