component', () => {
userEvent.click(button);
expect(onClose).toHaveBeenCalledTimes(1);
});
+
+ it('should render close button if handleCloseAction is provided and call the handler after user click', () => {
+ const onClose = vi.fn();
+ const { getByRole } = renderComponent({
+ ...defaultProps,
+ handleCloseAction: onClose,
+ });
+ const button = getByRole('button');
+ expect(button).toBeInTheDocument();
+ userEvent.click(button);
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/packages/react-components/src/components/Tooltip/components/Info.tsx b/packages/react-components/src/components/Tooltip/components/Info.tsx
index 44d9b6f12..120ed9045 100644
--- a/packages/react-components/src/components/Tooltip/components/Info.tsx
+++ b/packages/react-components/src/components/Tooltip/components/Info.tsx
@@ -21,7 +21,7 @@ export const Info: React.FC
= ({
}) => {
return (
- {closeWithX && (
+ {(closeWithX || handleCloseAction) && (
);
diff --git a/packages/react-components/src/components/Tooltip/components/UserGuide/UserGuideStep.tsx b/packages/react-components/src/components/Tooltip/components/UserGuide/UserGuideStep.tsx
index 6fed2d91b..20024a6e4 100644
--- a/packages/react-components/src/components/Tooltip/components/UserGuide/UserGuideStep.tsx
+++ b/packages/react-components/src/components/Tooltip/components/UserGuide/UserGuideStep.tsx
@@ -83,7 +83,7 @@ export const UserGuideStep: React.FC<{
Step {currentStep} of {stepMax}
- Primary button
+ {currentStep === stepMax ? 'Finish' : 'Next'}