fix(webui): restore full-project typechecking

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-20 14:47:38 +08:00
1 parent f869212e7d
commit a1bca7dc50
56 files changed
+622 -583

No files matched your search

+14 -14
View File
@@ -60,17 +60,17 @@ describe("Workspace project picker", () => {
await user.click(screen.getByRole("button", { name: "Switch directory" }));
await user.click(await screen.findByRole("button", { name: "/srv/beta" }));
await screen.findByRole("listbox", { name: "/srv/beta" });
await user.click(screen.getByRole("button", { name: "Back", exact: true }));
await user.click(screen.getByRole("button", { name: "Back" }));
await screen.findByRole("listbox", { name: scope.project_path });
await user.click(screen.getByRole("button", { name: "Forward", exact: true }));
await user.click(screen.getByRole("button", { name: "Forward" }));
await screen.findByRole("listbox", { name: "/srv/beta" });
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "srv", exact: true }));
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "srv" }));
await screen.findByRole("listbox", { name: "/srv" });
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "/", exact: true }));
await screen.findByRole("listbox", { name: "/", exact: true });
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "/" }));
await screen.findByRole("listbox", { name: "/" });
expect(screen.queryByRole("button", { name: "Parent folder" })).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "Forward", exact: true })).toBeDisabled();
await user.click(screen.getByRole("button", { name: "Cancel", exact: true }));
expect(screen.getByRole("button", { name: "Forward" })).toBeDisabled();
await user.click(screen.getByRole("button", { name: "Cancel" }));
expect(onChange).not.toHaveBeenCalled();
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
@@ -85,7 +85,7 @@ describe("Workspace project picker", () => {
expect(lastVisited).toBeDisabled();
await user.click(await screen.findByRole("button", { name: "/srv/alpha" }));
await screen.findByRole("listbox", { name: "/srv/alpha" });
await user.click(screen.getByRole("button", { name: "Back", exact: true }));
await user.click(screen.getByRole("button", { name: "Back" }));
await screen.findByRole("listbox", { name: scope.project_path });
await user.click(lastVisited);
await screen.findByRole("listbox", { name: "/srv/alpha" });
@@ -95,7 +95,7 @@ describe("Workspace project picker", () => {
await screen.findByRole("listbox", { name: "/srv/alpha" });
expect(screen.queryByRole("menu")).not.toBeInTheDocument();
expect(onChange).not.toHaveBeenCalled();
await user.click(screen.getByRole("button", { name: "Cancel", exact: true }));
await user.click(screen.getByRole("button", { name: "Cancel" }));
await user.click(screen.getByRole("button", { name: "Switch directory" }));
expect(screen.getByRole("button", { name: "Last visited folder" })).toBeDisabled();
});
@@ -123,20 +123,20 @@ describe("Workspace project picker", () => {
expect(screen.getAllByRole("listbox")).toHaveLength(2);
expect(screen.getByRole("option", { name: "/srv/workspace/memory" })).toHaveAttribute("aria-selected", "true");
expect(screen.getByRole("listbox", { name: scope.project_path }).scrollTop).toBe(44);
await user.click(screen.getByRole("button", { name: "Back", exact: true }));
await user.click(screen.getByRole("button", { name: "Back" }));
await screen.findByRole("listbox", { name: "/srv/workspace/prompts" });
expect(screen.getAllByRole("listbox")).toHaveLength(2);
expect(screen.getByRole("option", { name: "/srv/workspace/prompts" })).toHaveAttribute("aria-selected", "true");
await user.click(screen.getByRole("button", { name: "Forward", exact: true }));
await user.click(screen.getByRole("button", { name: "Forward" }));
await screen.findByRole("option", { name: "/srv/workspace/memory/reference" });
expect(screen.getAllByRole("listbox")).toHaveLength(2);
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "workspace", exact: true }));
await user.click(within(screen.getByRole("navigation", { name: "Current location" })).getByRole("button", { name: "workspace" }));
await screen.findByRole("listbox", { name: scope.project_path });
rootChanged = true;
const systemNow = Date.now;
const clock = vi.spyOn(Date, "now").mockImplementation(() => systemNow() + 31_000);
try {
await user.click(screen.getByRole("button", { name: "Back", exact: true }));
await user.click(screen.getByRole("button", { name: "Back" }));
await screen.findByRole("option", { name: "/srv/workspace/new-folder" });
expect(screen.getByRole("option", { name: "/srv/workspace/memory" })).toHaveAttribute("aria-selected", "true");
expect(screen.getAllByRole("listbox")).toHaveLength(2);
@@ -677,7 +677,7 @@ describe("Workspace project picker", () => {
const filter = screen.getByRole("textbox", { name: "Filter folders" });
await user.type(filter, "hjkl");
expect(filter).toHaveValue("hjkl");
expect(screen.getByRole("listbox", { name: "/srv/workspace", exact: true })).toBeInTheDocument();
expect(screen.getByRole("listbox", { name: "/srv/workspace" })).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: /^Edit path:/ }));
const editor = screen.getByRole("combobox");
await user.clear(editor);