fix(ui): improve knowledge reading and add isolated formatting examples
This commit is contained in:
@@ -22,6 +22,24 @@ beforeEach(() => server.use(
|
||||
http.get("/api/workspaces/sales/evidence", () => HttpResponse.json(page)),
|
||||
http.get("/api/workspaces/sales/evidence/evidence:order-key", () => HttpResponse.json(page)),
|
||||
));
|
||||
|
||||
test("copy uses an accessible icon and copies the unmodified full path", async () => {
|
||||
const user = userEvent.setup();
|
||||
const copy = vi.spyOn(navigator.clipboard, "writeText").mockResolvedValue();
|
||||
renderPage(); await choose();
|
||||
await user.click(await screen.findByRole("button", { name: "Order key" }));
|
||||
const detail = screen.getByRole("region", { name: "Evidence detail" });
|
||||
const button = within(detail).getByRole("button", { name: "Copy Evidence file path" });
|
||||
expect(button).toHaveTextContent("");
|
||||
expect(button.querySelector("svg")).not.toBeNull();
|
||||
await user.click(button);
|
||||
expect(copy).toHaveBeenCalledWith("/srv/workspaces/repo/sales/evidence/curated/domain/order-key.md");
|
||||
expect(within(detail).getByRole("status")).toHaveTextContent("Copied");
|
||||
copy.mockRejectedValueOnce(new Error("Clipboard unavailable"));
|
||||
await user.click(button);
|
||||
expect(within(detail).getByRole("status")).toHaveTextContent("Select the text and copy it manually.");
|
||||
copy.mockRestore();
|
||||
});
|
||||
async function choose() { await screen.findByRole("option", { name: "Sales" }); await userEvent.selectOptions(screen.getByLabelText("Workspace"), "sales"); }
|
||||
test("switches Evidence controls and detail labels without translating archive content", async () => {
|
||||
renderPage(); await choose();
|
||||
|
||||
Reference in New Issue
Block a user