Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/react/src/components/Dialog/Dialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,22 @@ test('should not render close button when forceAction is true', () => {
).not.toBeInTheDocument();
});

test('should not warn when using built-in heading with forceAction', () => {
const consoleWarn = jest
.spyOn(console, 'warn')
.mockImplementation(() => null);

render(
<Dialog {...defaultProps} forceAction>
Test Dialog
</Dialog>
);

expect(consoleWarn).not.toHaveBeenCalled();

consoleWarn.mockRestore();
});

test('should render heading from text', () => {
render(
<Dialog {...defaultProps} heading="title">
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(
? heading.text
: heading}
</DialogHeading>
<DialogCloseButton />
{!forceAction ? <DialogCloseButton /> : null}
</DialogHeader>
) : null}
{children}
Expand Down