huskies: merge 488_story_web_ui_shows_project_name_in_browser_tab_with_huskies_favicon

This commit is contained in:
dave
2026-04-07 13:33:06 +00:00
parent c64577eff0
commit 4476c57444
5 changed files with 121 additions and 1 deletions
+53
View File
@@ -345,6 +345,59 @@ describe("App", () => {
});
});
it("sets document title to Huskies when no project is open", async () => {
mockedApi.getCurrentProject.mockResolvedValue(null);
await renderApp();
await waitFor(() => {
expect(document.title).toBe("Huskies");
});
});
it("sets document title to project name when a project is open", async () => {
mockedApi.getCurrentProject.mockResolvedValue("/home/user/reclaimer");
await renderApp();
await waitFor(() => {
expect(document.title).toBe("reclaimer | Huskies");
});
});
it("resets document title to Huskies after closing project", async () => {
mockedApi.openProject.mockResolvedValue("/home/user/myproject");
mockedApi.closeProject.mockResolvedValue(true);
await renderApp();
await waitFor(() => {
expect(
screen.getByPlaceholderText(/\/path\/to\/project/i),
).toBeInTheDocument();
});
const input = screen.getByPlaceholderText(
/\/path\/to\/project/i,
) as HTMLInputElement;
await userEvent.clear(input);
await userEvent.type(input, "/home/user/myproject");
const openButton = screen.getByRole("button", { name: /open project/i });
await userEvent.click(openButton);
await waitFor(() => {
expect(document.title).toBe("myproject | Huskies");
});
const closeButton = await waitFor(() => screen.getByText("✕"));
await userEvent.click(closeButton);
await waitFor(() => {
expect(document.title).toBe("Huskies");
});
});
it("handles Enter key to trigger project open", async () => {
mockedApi.openProject.mockResolvedValue("/home/user/myproject");