mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[SecuritySolution] It should return to the origin app and path after editing markdown from the dashboard (#167927)
## Summary
issue:
https://github.com/elastic/kibana/issues/167786
In this PR:
a35bd617
-5805-4e60-a1e6-7ba559756ef0
### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
parent
a69957e0fc
commit
dfd35c6361
2 changed files with 44 additions and 1 deletions
|
@ -224,6 +224,49 @@ describe('getTopNavConfig', () => {
|
|||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('navigates to origin app and path on cancel', async () => {
|
||||
const vis = {
|
||||
savedVis: {
|
||||
id: 'test',
|
||||
sharingSavedObjectProps: {
|
||||
outcome: 'conflict',
|
||||
aliasTargetId: 'alias_id',
|
||||
},
|
||||
},
|
||||
vis: {
|
||||
type: {
|
||||
title: 'TSVB',
|
||||
},
|
||||
},
|
||||
} as VisualizeEditorVisInstance;
|
||||
const mockNavigateToApp = jest.fn();
|
||||
const topNavLinks = getTopNavConfig(
|
||||
{
|
||||
hasUnsavedChanges: false,
|
||||
setHasUnsavedChanges: jest.fn(),
|
||||
hasUnappliedChanges: false,
|
||||
onOpenInspector: jest.fn(),
|
||||
originatingApp: 'testApp',
|
||||
originatingPath: '/testPath',
|
||||
setOriginatingApp: jest.fn(),
|
||||
visInstance: vis,
|
||||
stateContainer,
|
||||
visualizationIdFromUrl: undefined,
|
||||
stateTransfer: createEmbeddableStateTransferMock(),
|
||||
} as unknown as TopNavConfigParams,
|
||||
{
|
||||
...services,
|
||||
application: { navigateToApp: mockNavigateToApp },
|
||||
} as unknown as VisualizeServices
|
||||
);
|
||||
|
||||
const executionFunction = topNavLinks.find(({ id }) => id === 'cancel')?.run;
|
||||
const mockAnchorElement = document.createElement('div');
|
||||
await executionFunction?.(mockAnchorElement);
|
||||
expect(mockNavigateToApp).toHaveBeenCalledWith('testApp', { path: '/testPath' });
|
||||
});
|
||||
|
||||
test('returns correct links for by reference visualization', () => {
|
||||
const vis = {
|
||||
savedVis: {
|
||||
|
|
|
@ -258,7 +258,7 @@ export const getTopNavConfig = (
|
|||
|
||||
const navigateToOriginatingApp = () => {
|
||||
if (originatingApp) {
|
||||
application.navigateToApp(originatingApp);
|
||||
application.navigateToApp(originatingApp, { path: originatingPath });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue