feat(web): open project surfaces in browser targets — #204

This commit is contained in:
2026-08-15 01:16:23 +02:00
parent 7fea538d0d
commit 0d543fb298
8 changed files with 513 additions and 132 deletions

View File

@ -7,7 +7,7 @@
* that selecting an entry routes the main surface without ever crashing on a
* desktop-only action.
*/
import { describe, it, expect } from "vitest";
import { describe, it, expect, vi } from "vitest";
import { fireEvent, render, screen, within } from "@testing-library/react";
import type { Gateways } from "@/ports";
@ -68,6 +68,27 @@ describe("WebWorkspace « Panneaux » menu (#90)", () => {
expect(screen.getByRole("button", { name: "Surface Travail" })).toBeTruthy();
});
it("offers #204 open here/tab/window controls and falls back to a tab", async () => {
const open = vi
.spyOn(window, "open")
.mockReturnValueOnce(null)
.mockReturnValueOnce({ closed: false } as Window);
renderPairedWebApp(await seededGateways());
fireEvent.click(await screen.findByText("Demo"));
expect(await screen.findByText("Surface Travail")).toBeTruthy();
fireEvent.click(screen.getByRole("button", { name: "Fenêtre" }));
expect(open).toHaveBeenCalledTimes(2);
expect(open.mock.calls[0][0]).toContain("webPanel=work");
expect(open.mock.calls[0][1]).toBe("idea-web-work");
expect(open.mock.calls[1][1]).toBe("_blank");
expect(await screen.findByText("Fenêtre bloquée — ouverture en onglet.")).toBeTruthy();
open.mockRestore();
});
it("only enables Projets while no project is open, with a help note", async () => {
renderPairedWebApp(await seededGateways());