-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into eui-v92.1.0
- Loading branch information
Showing
15 changed files
with
177 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// This size is also tracked with a variable in solution_nav.tsx, if updated | ||
// update there as well | ||
$solutionNavWidth: 248px; | ||
$solutionNavCollapsedWidth: $euiSizeXXL; |
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
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
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
80 changes: 80 additions & 0 deletions
80
...security_solution/public/timelines/components/modal/actions/open_timeline_button.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,80 @@ | ||
/* | ||
* 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 { render, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { OpenTimelineButton } from './open_timeline_button'; | ||
import { TestProviders } from '../../../../common/mock/test_providers'; | ||
import { useParams } from 'react-router-dom'; | ||
import { TimelineType } from '../../../../../common/api/timeline'; | ||
import { useStartTransaction } from '../../../../common/lib/apm/use_start_transaction'; | ||
import { useSourcererDataView } from '../../../../common/containers/sourcerer'; | ||
import { useTimelineStatus } from '../../open_timeline/use_timeline_status'; | ||
|
||
jest.mock('../../../../common/lib/apm/use_start_transaction'); | ||
jest.mock('../../../../common/containers/sourcerer'); | ||
jest.mock('../../open_timeline/use_timeline_status'); | ||
jest.mock('react-redux', () => { | ||
const origin = jest.requireActual('react-redux'); | ||
return { | ||
...origin, | ||
useDispatch: jest.fn(), | ||
}; | ||
}); | ||
jest.mock('react-router-dom', () => { | ||
const actual = jest.requireActual('react-router-dom'); | ||
return { | ||
...actual, | ||
useParams: jest.fn(), | ||
}; | ||
}); | ||
jest.mock('../../../../common/lib/kibana', () => { | ||
const actual = jest.requireActual('../../../../common/lib/kibana'); | ||
return { | ||
...actual, | ||
useNavigation: () => ({ | ||
navigateTo: jest.fn(), | ||
}), | ||
}; | ||
}); | ||
|
||
const renderOpenTimelineButton = () => | ||
render( | ||
<TestProviders> | ||
<OpenTimelineButton /> | ||
</TestProviders> | ||
); | ||
|
||
describe('OpenTimelineButton', () => { | ||
it('should render the button', () => { | ||
const { getByTestId, queryByTestId } = renderOpenTimelineButton(); | ||
|
||
expect(getByTestId('timeline-modal-open-timeline-button')).toBeInTheDocument(); | ||
expect(getByTestId('timeline-modal-open-timeline-button')).toHaveTextContent('Open'); | ||
|
||
expect(queryByTestId('open-timeline-modal')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should open the modal after clicking on the button', async () => { | ||
(useParams as jest.Mock).mockReturnValue({ tabName: TimelineType.template }); | ||
(useStartTransaction as jest.Mock).mockReturnValue({ startTransaction: jest.fn() }); | ||
(useSourcererDataView as jest.Mock).mockReturnValue({ dataViewId: '', selectedPatterns: [] }); | ||
(useTimelineStatus as jest.Mock).mockReturnValue({ | ||
timelineStatus: 'active', | ||
templateTimelineFilter: null, | ||
installPrepackagedTimelines: jest.fn(), | ||
}); | ||
|
||
const { getByTestId } = renderOpenTimelineButton(); | ||
|
||
getByTestId('timeline-modal-open-timeline-button').click(); | ||
|
||
await waitFor(() => { | ||
expect(getByTestId('open-timeline-modal')).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
Oops, something went wrong.