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
commit5bd0b63a7f0cafd53fbd4ba287f8e2cf2b59a4a1 (patch)
treeba0a6fb8ffa84c3fc86c250f8309018c79f74682 /src/features/workspaces/ui/WorkspaceCard.test.ts
parente1f6986c32767fea445eedffece488f10a73b3d2 (diff)
downloaddispatch-web-5bd0b63a7f0cafd53fbd4ba287f8e2cf2b59a4a1.tar.gz
dispatch-web-5bd0b63a7f0cafd53fbd4ba287f8e2cf2b59a4a1.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");
});
});