-
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.
Browse files
Browse the repository at this point in the history
* Fix edit policy page navigation * Fix edit policy page navigation * Add links to PR for explanation * Added more tests and linked to a github issue about navigation issues * Fix decoding function for undefined values * Fix type check issues * Renamed dollar sign to percent sign, added a method for (double) encoded paths and better description in test names * Deleted Index Management from required bundles in ILM * Fixed merge conflicts * Revert "Deleted Index Management from required bundles in ILM" This reverts commit 5a735df Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
5875571
commit 8c2c9cc
Showing
22 changed files
with
448 additions
and
43 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
74 changes: 74 additions & 0 deletions
74
x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.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,74 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { act } from 'react-dom/test-utils'; | ||
import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; | ||
import { App } from '../../../public/application/app'; | ||
import { TestSubjects } from '../helpers'; | ||
import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock'; | ||
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public/context'; | ||
|
||
const breadcrumbService = createBreadcrumbsMock(); | ||
|
||
const AppWithContext = (props: any) => { | ||
return ( | ||
<KibanaContextProvider services={{ breadcrumbService }}> | ||
<App {...props} /> | ||
</KibanaContextProvider> | ||
); | ||
}; | ||
|
||
const getTestBedConfig = (initialEntries: string[]): TestBedConfig => ({ | ||
memoryRouter: { | ||
initialEntries, | ||
}, | ||
defaultProps: { | ||
getUrlForApp: () => {}, | ||
navigateToApp: () => {}, | ||
}, | ||
}); | ||
|
||
const initTestBed = (initialEntries: string[]) => | ||
registerTestBed(AppWithContext, getTestBedConfig(initialEntries))(); | ||
|
||
export interface AppTestBed extends TestBed<TestSubjects> { | ||
actions: { | ||
clickPolicyNameLink: () => void; | ||
clickCreatePolicyButton: () => void; | ||
}; | ||
} | ||
|
||
export const setup = async (initialEntries: string[]): Promise<AppTestBed> => { | ||
const testBed = await initTestBed(initialEntries); | ||
|
||
const clickPolicyNameLink = async () => { | ||
const { component, find } = testBed; | ||
await act(async () => { | ||
find('policyTablePolicyNameLink').simulate('click', { button: 0 }); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
const clickCreatePolicyButton = async () => { | ||
const { component, find } = testBed; | ||
await act(async () => { | ||
find('createPolicyButton').simulate('click', { button: 0 }); | ||
}); | ||
component.update(); | ||
}; | ||
|
||
return { | ||
...testBed, | ||
actions: { clickPolicyNameLink, clickCreatePolicyButton }, | ||
}; | ||
}; | ||
|
||
export const getEncodedPolicyEditPath = (policyName: string): string => | ||
`/policies/edit/${encodeURIComponent(policyName)}`; | ||
|
||
export const getDoubleEncodedPolicyEditPath = (policyName: string): string => | ||
encodeURI(getEncodedPolicyEditPath(policyName)); |
Oops, something went wrong.