feat: add dense console ui primitives

This commit is contained in:
afei A
2026-03-28 00:16:01 +08:00
parent 4ca3ef96b9
commit 025ae31f9f
11 changed files with 236 additions and 9 deletions

View File

@@ -0,0 +1,19 @@
import { render, screen } from "@testing-library/react";
import { PageToolbar } from "@/components/ui/page-toolbar";
import { Input } from "@/components/ui/input";
import { Select } from "@/components/ui/select";
test("renders a dense toolbar row with compact controls", () => {
render(
<PageToolbar>
<Input aria-label="search" />
<Select aria-label="status">
<option value="all"></option>
</Select>
</PageToolbar>,
);
expect(screen.getByLabelText("search").className).toContain("h-9");
expect(screen.getByLabelText("status").className).toContain("h-9");
});

View File

@@ -21,6 +21,13 @@ test("uses order status metadata for the rendered tone", () => {
expect(screen.getByText("失败")).toHaveAttribute("data-tone", "danger");
});
test("uses compact dense-console badge sizing", () => {
render(<StatusBadge status="waiting_review" />);
expect(screen.getByText("待审核").className).toContain("px-2");
expect(screen.getByText("待审核").className).toContain("py-0.5");
});
test("can render review decision metadata when a variant is provided", () => {
render(<StatusBadge status="reject" variant="reviewDecision" />);