Show a footer Remove on selected create-flow modules so removal is not kebab-only.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -169,6 +169,41 @@ describe("Create", () => {
|
||||
expect(screen.getByText("Custom Footer")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a danger Remove in the left footer when showRemoveButton is true", () => {
|
||||
const onRemove = vi.fn();
|
||||
renderWithProviders(
|
||||
<Create
|
||||
{...defaultProps}
|
||||
showBackButton={false}
|
||||
showRemoveButton
|
||||
onRemove={onRemove}
|
||||
showNextButton
|
||||
nextButtonText="Save"
|
||||
/>,
|
||||
);
|
||||
const removeButton = screen.getByRole("button", { name: "Remove" });
|
||||
expect(removeButton).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Back" })).not.toBeInTheDocument();
|
||||
fireEvent.click(removeButton);
|
||||
expect(onRemove).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("prefers Remove over Back when both would occupy the left slot", () => {
|
||||
renderWithProviders(
|
||||
<Create
|
||||
{...defaultProps}
|
||||
showBackButton
|
||||
showRemoveButton
|
||||
onBack={vi.fn()}
|
||||
onRemove={vi.fn()}
|
||||
showNextButton
|
||||
nextButtonText="Save"
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Remove" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Back" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses responsive width at baseline (matches Login modal)", () => {
|
||||
renderWithProviders(
|
||||
<Create {...defaultProps}>Create dialog content</Create>,
|
||||
|
||||
Reference in New Issue
Block a user