Add the No Rules empty-state card from Figma.
This commit is contained in:
1 parent
e08884efde
commit
b1ae274ff6
7 files changed
+156
-1
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import NoRules from "../../../app/components/cards/NoRules";
|
||||
import { renderWithProviders, screen } from "../../utils/test-utils";
|
||||
|
||||
describe("NoRules", () => {
|
||||
it("renders the empty-state copy, create action, and templates link", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onCreate = vi.fn();
|
||||
renderWithProviders(
|
||||
<NoRules
|
||||
title="No Rules yet"
|
||||
description="Start from a template, or write your first over a few short meetings with the free kit."
|
||||
createLabel="Create rule"
|
||||
browseLabel="Browse templates"
|
||||
browseHref="/templates?fromFlow=1"
|
||||
onCreate={onCreate}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByRole("heading", { name: "No Rules yet" })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(
|
||||
"Start from a template, or write your first over a few short meetings with the free kit.",
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Create rule" }));
|
||||
expect(onCreate).toHaveBeenCalledTimes(1);
|
||||
|
||||
expect(
|
||||
screen.getByRole("link", { name: "Browse templates" }),
|
||||
).toHaveAttribute("href", "/templates?fromFlow=1");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user