Manage stakeholders implemented
This commit is contained in:
@@ -38,6 +38,8 @@ const config: ComponentTestSuiteConfig<CreateFlowTopNavProps> = {
|
||||
onShare: vi.fn(),
|
||||
onSelectExportFormat: vi.fn(),
|
||||
onEdit: vi.fn(),
|
||||
hasManageStakeholders: true,
|
||||
onManageStakeholders: vi.fn(),
|
||||
onExit: vi.fn(),
|
||||
className: "test-class",
|
||||
},
|
||||
@@ -121,6 +123,33 @@ describe("CreateFlowTopNav (behavioral tests)", () => {
|
||||
expect(editButton).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders Manage Stakeholders when hasManageStakeholders is true", () => {
|
||||
render(
|
||||
<CreateFlowTopNav
|
||||
hasManageStakeholders={true}
|
||||
onManageStakeholders={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Manage Stakeholders" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("calls onManageStakeholders when Manage Stakeholders is clicked", async () => {
|
||||
const user = userEvent.setup();
|
||||
const handler = vi.fn();
|
||||
render(
|
||||
<CreateFlowTopNav
|
||||
hasManageStakeholders={true}
|
||||
onManageStakeholders={handler}
|
||||
/>,
|
||||
);
|
||||
await user.click(
|
||||
screen.getByRole("button", { name: "Manage Stakeholders" }),
|
||||
);
|
||||
expect(handler).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("calls onExit when Exit button is clicked", async () => {
|
||||
const user = userEvent.setup();
|
||||
const handleExit = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user