perf(webui): bound reasoning previews and pace streaming updates
This commit is contained in:
1 parent
9e71087a2a
commit
7cede64f07
5 files changed
+167
-12
No files matched your search
@@ -20,3 +20,34 @@ it("shows the reasoning preview in the shared tooltip on hover and keyboard focu
|
||||
await user.keyboard("{Escape}");
|
||||
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("bounds reasoning text without repainting a truncated label and keeps the complete tooltip current", async () => {
|
||||
const user = userEvent.setup();
|
||||
const text = "A long reasoning paragraph. ".repeat(2_000) + "original tail";
|
||||
const { container, rerender } = render(<ReasoningRow text={text} streaming />);
|
||||
const line = screen.getByTestId("activity-line");
|
||||
|
||||
expect(line.textContent).toBe(text.slice(0, 512) + "…");
|
||||
expect(container.querySelector("[data-sheen-text]")).toBeNull();
|
||||
expect(screen.getByTestId("activity-reasoning-marker")).toHaveAttribute("data-state", "thinking");
|
||||
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
||||
|
||||
await user.tab();
|
||||
expect(line).toHaveFocus();
|
||||
expect(await screen.findByRole("tooltip")).toHaveTextContent(text);
|
||||
rerender(<ReasoningRow text={text + " latest tail"} streaming />);
|
||||
expect(screen.getByRole("tooltip")).toHaveTextContent(text + " latest tail");
|
||||
await user.keyboard("{Escape}");
|
||||
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
|
||||
expect(line.textContent).toBe(text.slice(0, 512) + "…");
|
||||
});
|
||||
|
||||
it("keeps the existing text animation for short active reasoning", () => {
|
||||
const { container } = render(<ReasoningRow text="Short active reasoning" streaming />);
|
||||
expect(container.querySelector("[data-sheen-text]")).toHaveAttribute("data-sheen-text", "Short active reasoning");
|
||||
});
|
||||
|
||||
it("does not split a surrogate pair at the reasoning preview boundary", () => {
|
||||
render(<ReasoningRow text={"x".repeat(511) + "🚀 tail"} streaming />);
|
||||
expect(screen.getByTestId("activity-line").textContent).toBe("x".repeat(511) + "…");
|
||||
});
|
||||
Reference in new issue
Block a user