forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] expandable flyout - expandable mode only for sign…
…al documents (elastic#163557)
- Loading branch information
1 parent
d74f4d3
commit f38a37c
Showing
6 changed files
with
127 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/security_solution/public/flyout/right/header.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* 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 { render } from '@testing-library/react'; | ||
import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context'; | ||
import { TestProviders } from '../../common/mock'; | ||
import { RightPanelContext } from './context'; | ||
import { mockContextValue } from './mocks/mock_right_panel_context'; | ||
import { PanelHeader } from './header'; | ||
import { | ||
COLLAPSE_DETAILS_BUTTON_TEST_ID, | ||
EXPAND_DETAILS_BUTTON_TEST_ID, | ||
} from './components/test_ids'; | ||
import { mockFlyoutContextValue } from '../shared/mocks/mock_flyout_context'; | ||
|
||
describe('<PanelHeader />', () => { | ||
it('should render expand details button if flyout is expandable', () => { | ||
const { getByTestId } = render( | ||
<TestProviders> | ||
<ExpandableFlyoutContext.Provider value={mockFlyoutContextValue}> | ||
<RightPanelContext.Provider value={mockContextValue}> | ||
<PanelHeader | ||
flyoutIsExpandable={true} | ||
selectedTabId={'overview'} | ||
setSelectedTabId={() => window.alert('test')} | ||
tabs={[]} | ||
/> | ||
</RightPanelContext.Provider> | ||
</ExpandableFlyoutContext.Provider> | ||
</TestProviders> | ||
); | ||
|
||
expect(getByTestId(EXPAND_DETAILS_BUTTON_TEST_ID)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not render expand details button if flyout is not expandable', () => { | ||
const { queryByTestId } = render( | ||
<TestProviders> | ||
<ExpandableFlyoutContext.Provider value={mockFlyoutContextValue}> | ||
<RightPanelContext.Provider value={mockContextValue}> | ||
<PanelHeader | ||
flyoutIsExpandable={false} | ||
selectedTabId={'overview'} | ||
setSelectedTabId={() => window.alert('test')} | ||
tabs={[]} | ||
/> | ||
</RightPanelContext.Provider> | ||
</ExpandableFlyoutContext.Provider> | ||
</TestProviders> | ||
); | ||
|
||
expect(queryByTestId(EXPAND_DETAILS_BUTTON_TEST_ID)).not.toBeInTheDocument(); | ||
expect(queryByTestId(COLLAPSE_DETAILS_BUTTON_TEST_ID)).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters