The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(ui): cover keyboard activation of the log drawer collapse rows
Yuneng Jiang266a35b88c61
diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/CollapsibleMessage.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/CollapsibleMessage.test.tsxindex 1477febd967..3aa8d21c31c 100644--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/CollapsibleMessage.test.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/CollapsibleMessage.test.tsx@@ -37,4 +37,18 @@ describe("CollapsibleMessage", () => {await user.click(screen.getByText("SYSTEM"));expect(screen.getByText("Toggle me")).toBeInTheDocument();});++ it("should expand with Enter and collapse with Space from the keyboard", async () => {+ const user = userEvent.setup();+ render(<CollapsibleMessage label="SYSTEM" content="Toggle me" defaultExpanded={false} />);++ expect(screen.getByText("Toggle me")).not.toBeVisible();++ await user.tab();+ await user.keyboard("{Enter}");+ expect(screen.getByText("Toggle me")).toBeVisible();++ await user.keyboard(" ");+ expect(screen.getByText("Toggle me")).not.toBeVisible();+ });});diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/HistoryTree.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/HistoryTree.test.tsxindex 10d6bfa0847..0726a9f4b82 100644--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/HistoryTree.test.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/HistoryTree.test.tsx@@ -41,4 +41,22 @@ describe("HistoryTree", () => {expect(screen.getByText("Hello")).toBeInTheDocument();expect(screen.getByText("Hi there")).toBeInTheDocument();});++ it("should expand with Enter and collapse with Space from the keyboard", async () => {+ const user = userEvent.setup();+ const messages: ParsedMessage[] = [+ { role: "user", content: "Hello" },+ { role: "assistant", content: "Hi there" },+ ];+ render(<HistoryTree messages={messages} />);++ expect(screen.getByText("Hello")).not.toBeVisible();++ await user.tab();+ await user.keyboard("{Enter}");+ expect(screen.getByText("Hello")).toBeVisible();++ await user.keyboard(" ");+ expect(screen.getByText("Hello")).not.toBeVisible();+ });});