Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+54
@@ -0,0 +1,54 @@
|
||||
import { vi, describe, it, expect } from "vitest";
|
||||
import "@testing-library/jest-dom";
|
||||
import { render } from "@testing-library/react";
|
||||
import { BrowserRouter as Router } from "react-router";
|
||||
|
||||
import { TaskNewPage, type TaskNewPageProps } from "./TaskNewPage";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (str: string) => str, i18n: { language: "de" } }),
|
||||
}));
|
||||
|
||||
function baseProps(overrides: Partial<TaskNewPageProps> = {}): TaskNewPageProps {
|
||||
return {
|
||||
assignableUsers: [{ id: "u1", label: "Alex Meier" }],
|
||||
assignableGroups: [{ id: "g1", label: "Vertrieb" }],
|
||||
prefill: null,
|
||||
cancelHref: "/acme/tasks",
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("TaskNewPage (interim-UI)", () => {
|
||||
it("renders the create form surface + title/submit/cancel markers", () => {
|
||||
const { container } = render(
|
||||
<Router>
|
||||
<TaskNewPage {...baseProps()} />
|
||||
</Router>,
|
||||
);
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new"]')).toBeInTheDocument();
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new.title"]')).toBeInTheDocument();
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new.submit"]')).toBeInTheDocument();
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new.cancel"]')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the entity prefill marker + hidden inputs when prefilled", () => {
|
||||
const { container } = render(
|
||||
<Router>
|
||||
<TaskNewPage {...baseProps({ prefill: { entityType: "contact", entityId: "c9" } })} />
|
||||
</Router>,
|
||||
);
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new.prefill"]')).toBeInTheDocument();
|
||||
expect(container.querySelector('input[type="hidden"][name="entityType"][value="contact"]')).toBeInTheDocument();
|
||||
expect(container.querySelector('input[type="hidden"][name="entityId"][value="c9"]')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("omits the prefill block when not prefilled", () => {
|
||||
const { container } = render(
|
||||
<Router>
|
||||
<TaskNewPage {...baseProps()} />
|
||||
</Router>,
|
||||
);
|
||||
expect(container.querySelector('[data-ui-id="ui.tasks.new.prefill"]')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user