Replace individual mocks for withTooltip with global mock (#5962)

This commit is contained in:
Janne Savolainen authored and GitHub committed 2022-08-02 10:06:37 -04:00
1 parent 57e4e29a16
commit 83232440dc
38 files changed
+1347 -753

No files matched your search

@@ -0,0 +1,24 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import React from "react";
export const withTooltip =
(Target: any) =>
({ tooltip, tooltipOverrideDisabled, ...props }: any) => {
if (tooltip) {
const testId = props["data-testid"];
return (
<>
<Target {...props} />
<div data-testid={testId && `tooltip-content-for-${testId}`}>
{tooltip.children || tooltip}
</div>
</>
);
}
return <Target {...props} />;
};