diff options
| author | Adam Malczewski <[email protected]> | 2026-06-27 18:26:29 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-27 18:26:29 +0900 |
| commit | e81df4c4936549fa674584c076e9e59fa4c920d5 (patch) | |
| tree | d01ee2c17e069a5d05528d27fafd7a9de23e2801 /src/features/workspaces | |
| parent | f79e3fcd846f24582ea8c536cf55f1f72d75d967 (diff) | |
| parent | 5bd0b63a7f0cafd53fbd4ba287f8e2cf2b59a4a1 (diff) | |
| download | dispatch-web-e81df4c4936549fa674584c076e9e59fa4c920d5.tar.gz dispatch-web-e81df4c4936549fa674584c076e9e59fa4c920d5.zip | |
Merge branch 'dev' into feature/provider-concurrency
Diffstat (limited to 'src/features/workspaces')
| -rw-r--r-- | src/features/workspaces/ui/WorkspaceCard.svelte | 11 | ||||
| -rw-r--r-- | src/features/workspaces/ui/WorkspaceCard.test.ts | 14 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/features/workspaces/ui/WorkspaceCard.svelte b/src/features/workspaces/ui/WorkspaceCard.svelte index 81b89e9..0ffc975 100644 --- a/src/features/workspaces/ui/WorkspaceCard.svelte +++ b/src/features/workspaces/ui/WorkspaceCard.svelte @@ -188,7 +188,16 @@ </div> <div class="flex justify-start"> - <a class="btn" href={workspacePath(ws.id)} target="_blank" rel="noopener noreferrer"> Open </a> + <a + class="btn" + href={workspacePath(ws.id)} + onclick={(e) => { + e.preventDefault(); + onNavigate(workspacePath(ws.id)); + }} + > + Open + </a> </div> {#if cwdError} 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"); }); }); |
