diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.test.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.test.tsx new file mode 100644 index 000000000000..e5d53df63882 --- /dev/null +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.test.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { shallow } from 'enzyme'; +import OverflowButton from './overflow'; + +describe('OverflowButton', () => { + const props = { + field: 'host.name', + ownFocus: false, + showTooltip: true, + value: 'mac', + closePopOver: jest.fn(), + items: [
], + isOverflowPopoverOpen: false, + }; + test('should render a popover', () => { + const wrapper = shallow(); + expect(wrapper.find('EuiPopover').exists()).toBeTruthy(); + }); + + test('the popover always contains a class that hides it when an overlay (e.g. the inspect modal) is displayed', () => { + const wrapper = shallow(); + expect(wrapper.find('EuiPopover').prop('panelClassName')).toEqual('withHoverActions__popover'); + }); + + test('should enable repositionOnScroll', () => { + const wrapper = shallow(); + expect(wrapper.find('EuiPopover').prop('repositionOnScroll')).toEqual(true); + }); + + test('should render a tooltip if showTooltip is true', () => { + const testProps = { + ...props, + showTooltip: true, + }; + const wrapper = shallow(); + expect(wrapper.find('EuiToolTip').exists()).toBeTruthy(); + }); +}); diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx index a10c96f3aa0a..aa582504f4f7 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx @@ -97,6 +97,7 @@ const OverflowButton: React.FC = React.memo( closePopover={closePopOver} panelPaddingSize="none" panelClassName="withHoverActions__popover" + repositionOnScroll={true} anchorPosition="downLeft" >