-
-
-
- {content}
+ renderTarget={ref => (
+
+ {React.Children.only(children)}
)}
-
+ renderElement={ref => {
+ return showTooltip ? (
+
+ ) : null;
+ }}
+ />
);
}
}
diff --git a/src/features/left-sidebar/__tests__/LeftSidebarLinkCallout.test.js b/src/features/left-sidebar/__tests__/LeftSidebarLinkCallout.test.js
index 3a08f5ec22..75457bb083 100644
--- a/src/features/left-sidebar/__tests__/LeftSidebarLinkCallout.test.js
+++ b/src/features/left-sidebar/__tests__/LeftSidebarLinkCallout.test.js
@@ -1,8 +1,13 @@
import * as React from 'react';
+import { mount, shallow } from 'enzyme';
import sinon from 'sinon';
import LeftSidebarLinkCallout from '../LeftSidebarLinkCallout';
+const findTetherComponent = wrapper => {
+ return wrapper.findWhere(node => node.prop('renderTarget') && node.prop('renderElement'));
+};
+
describe('components/tooltip/LeftSidebarLinkCallout', () => {
const sandbox = sinon.sandbox.create();
@@ -40,8 +45,13 @@ describe('components/tooltip/LeftSidebarLinkCallout', () => {
content:
Hi
,
onClose: sandbox.mock(),
};
- const wrapper = getWrapper({ callout });
- const btn = wrapper.find('.nav-link-callout-close-button');
+ const wrapper = mount(
+
+ Test Child
+ ,
+ );
+ const tetherComponent = findTetherComponent(wrapper);
+ const btn = tetherComponent.find('.nav-link-callout-close-button').first();
btn.simulate('click');
});
@@ -54,8 +64,21 @@ describe('components/tooltip/LeftSidebarLinkCallout', () => {
});
test('should add class provided to nav-link-callout component', () => {
- const wrapper = getWrapper({ isShown: true, navLinkClassName: 'testClass' });
- const callout = wrapper.find('.nav-link-callout');
+ const wrapper = mount(
+
Hi ,
+ onClose: () => {},
+ }}
+ isShown={true}
+ navLinkClassName="testClass"
+ >
+