diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/columns.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/columns.test.tsx index 9d254b0d27f6b..a37157905bef9 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/columns.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/columns.test.tsx @@ -11,6 +11,7 @@ import { TestProviders } from '../../mock'; import { useMountAppended } from '../../utils/use_mount_appended'; import { mockBrowserFields } from '../../containers/source/mock'; import { EventFieldsData } from './types'; +import { get } from 'lodash/fp'; jest.mock('../../lib/kibana'); interface Column { @@ -78,13 +79,13 @@ describe('getColumns', () => { }); }); - describe('add to timeline', () => { - test('it renders an add to timeline button', () => { + describe('overflow button', () => { + test('it renders an overflow button', () => { const wrapper = mount( {actionsColumn.render(testValue, testData)} ) as ReactWrapper; - expect(wrapper.find('[data-test-subj="hover-actions-add-timeline"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="more-actions-agent.id"]').exists()).toBeTruthy(); }); }); @@ -95,8 +96,32 @@ describe('getColumns', () => { ) as ReactWrapper; expect( - wrapper.find('[data-test-subj="hover-actions-toggle-column"]').exists() - ).toBeTruthy(); + get(['items', 0, 'key'], wrapper.find('[data-test-subj="more-actions-agent.id"]').props()) + ).toEqual('hover-actions-toggle-column'); + }); + }); + + describe('add to timeline', () => { + test('it renders an add to timeline button', () => { + const wrapper = mount( + {actionsColumn.render(testValue, testData)} + ) as ReactWrapper; + + expect( + get(['items', 1, 'key'], wrapper.find('[data-test-subj="more-actions-agent.id"]').props()) + ).toEqual('hover-actions-add-timeline'); + }); + }); + + describe('topN', () => { + test('it renders a show topN button', () => { + const wrapper = mount( + {actionsColumn.render(testValue, testData)} + ) as ReactWrapper; + + expect( + get(['items', 2, 'key'], wrapper.find('[data-test-subj="more-actions-agent.id"]').props()) + ).toEqual('hover-actions-show-top-n'); }); }); @@ -106,7 +131,9 @@ describe('getColumns', () => { {actionsColumn.render(testValue, testData)} ) as ReactWrapper; - expect(wrapper.find('[data-test-subj="hover-actions-copy-button"]').exists()).toBeTruthy(); + expect( + get(['items', 3, 'key'], wrapper.find('[data-test-subj="more-actions-agent.id"]').props()) + ).toEqual('hover-actions-copy-button'); }); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.test.tsx index 28a90e94c0ca4..4c31db473ae32 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.test.tsx @@ -14,6 +14,7 @@ import { EventFieldsBrowser } from './event_fields_browser'; import { mockBrowserFields } from '../../containers/source/mock'; import { useMountAppended } from '../../utils/use_mount_appended'; import { TimelineTabs } from '../../../../common/types/timeline'; +import { get } from 'lodash/fp'; jest.mock('../../lib/kibana'); @@ -116,7 +117,7 @@ describe('EventFieldsBrowser', () => { expect(wrapper.find('[data-test-subj="hover-actions-filter-out"]').exists()).toBeTruthy(); }); - test('it renders an add to timeline button', () => { + test('it renders an overflow button', () => { const wrapper = mount( { ); - expect(wrapper.find('[data-test-subj="hover-actions-add-timeline"]').exists()).toBeTruthy(); + expect(wrapper.find('[data-test-subj="more-actions-@timestamp"]').exists()).toBeTruthy(); }); test('it renders a column toggle button', () => { @@ -146,8 +147,26 @@ describe('EventFieldsBrowser', () => { ); expect( - wrapper.find('[data-test-subj="hover-actions-toggle-column"]').first().exists() - ).toBeTruthy(); + get(['items', 0, 'key'], wrapper.find('[data-test-subj="more-actions-@timestamp"]').props()) + ).toEqual('hover-actions-toggle-column'); + }); + + test('it renders an add to timeline button', () => { + const wrapper = mount( + + + + ); + + expect( + get(['items', 1, 'key'], wrapper.find('[data-test-subj="more-actions-@timestamp"]').props()) + ).toEqual('hover-actions-add-timeline'); }); test('it renders a copy button', () => { @@ -163,7 +182,9 @@ describe('EventFieldsBrowser', () => { ); - expect(wrapper.find('[data-test-subj="hover-actions-copy-button"]').exists()).toBeTruthy(); + expect( + get(['items', 2, 'key'], wrapper.find('[data-test-subj="more-actions-@timestamp"]').props()) + ).toEqual('hover-actions-copy-button'); }); }); diff --git a/x-pack/plugins/timelines/public/mock/mock_hover_actions.tsx b/x-pack/plugins/timelines/public/mock/mock_hover_actions.tsx index ee877d637fc8f..0a8542713da68 100644 --- a/x-pack/plugins/timelines/public/mock/mock_hover_actions.tsx +++ b/x-pack/plugins/timelines/public/mock/mock_hover_actions.tsx @@ -13,5 +13,9 @@ export const mockHoverActions = { getCopyButton: () => <>{'Copy button'}, getFilterForValueButton: () => <>{'Filter button'}, getFilterOutValueButton: () => <>{'Filter out button'}, - getOverflowButton: () => <>{'Overflow button'}, + getOverflowButton: (props: { field: string }) => ( +
+ {'Overflow button'} +
+ ), };