mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Security Solution] Enable repositionOnScroll for overflow popovers (#110584)
* enable repositionOnScroll * unit test * update test case Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
508d045f90
commit
9dec97b5f4
2 changed files with 46 additions and 0 deletions
|
@ -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: [<div />],
|
||||
isOverflowPopoverOpen: false,
|
||||
};
|
||||
test('should render a popover', () => {
|
||||
const wrapper = shallow(<OverflowButton {...props} />);
|
||||
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(<OverflowButton {...props} />);
|
||||
expect(wrapper.find('EuiPopover').prop('panelClassName')).toEqual('withHoverActions__popover');
|
||||
});
|
||||
|
||||
test('should enable repositionOnScroll', () => {
|
||||
const wrapper = shallow(<OverflowButton {...props} />);
|
||||
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(<OverflowButton {...testProps} />);
|
||||
expect(wrapper.find('EuiToolTip').exists()).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -97,6 +97,7 @@ const OverflowButton: React.FC<OverflowButtonProps> = React.memo(
|
|||
closePopover={closePopOver}
|
||||
panelPaddingSize="none"
|
||||
panelClassName="withHoverActions__popover"
|
||||
repositionOnScroll={true}
|
||||
anchorPosition="downLeft"
|
||||
>
|
||||
<StyledEuiContextMenuPanel items={items} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue