Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+29
@@ -0,0 +1,29 @@
|
||||
// R-P7 interim-UI (AD-28) — LeadNewPage unit test. Pure props; asserts the create
|
||||
// callback + the identity guard. i18n mocked.
|
||||
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { LeadNewPage, type LeadNewPageActions } from "./LeadNewPage";
|
||||
|
||||
vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (s: string) => s, i18n: { language: "de" } }) }));
|
||||
|
||||
function actions(over: Partial<LeadNewPageActions> = {}): LeadNewPageActions {
|
||||
return { onCreate: vi.fn(), ...over };
|
||||
}
|
||||
|
||||
function renderPage(acts = actions()) {
|
||||
render(<LeadNewPage backHref="/acme/leads" submitting={false} errorKey={null} actions={acts} />);
|
||||
return acts;
|
||||
}
|
||||
|
||||
describe("LeadNewPage", () => {
|
||||
it("keeps create disabled until an identity field is filled, then submits", () => {
|
||||
const onCreate = vi.fn();
|
||||
renderPage(actions({ onCreate }));
|
||||
const submit = document.querySelector("[data-ui-id='ui.leads.new.submit']") as HTMLButtonElement;
|
||||
expect(submit.disabled).toBe(true);
|
||||
fireEvent.change(document.querySelector("[data-ui-id='ui.leads.new.email']")!, { target: { value: "neu@example.com" } });
|
||||
fireEvent.click(submit);
|
||||
expect(onCreate).toHaveBeenCalledWith(expect.objectContaining({ quelle: "manual", email: "neu@example.com" }));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user