-
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.
[Ingest Pipeline] Allow to provide a redirect path and a tab in compo…
…nent template edit UI (#134910)
- Loading branch information
Showing
15 changed files
with
258 additions
and
23 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
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
67 changes: 67 additions & 0 deletions
67
...plates/component_template_wizard/component_template_edit/component_template_edit.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,67 @@ | ||
/* | ||
* 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 { renderHook } from '@testing-library/react-hooks'; | ||
import { createMemoryHistory } from 'history'; | ||
import { useStepFromQueryString } from './component_template_edit'; | ||
|
||
describe('useStepFromQueryString', () => { | ||
it('should return undefined if no step is set in the url', () => { | ||
const history = createMemoryHistory(); | ||
history.push('/app/management/data/index_management/edit_component_template'); | ||
|
||
const { | ||
result: { | ||
current: { activeStep }, | ||
}, | ||
} = renderHook(() => useStepFromQueryString(history)); | ||
|
||
expect(activeStep).not.toBeDefined(); | ||
}); | ||
|
||
it('should return the step if set in the url', () => { | ||
const history = createMemoryHistory(); | ||
history.push('/app/management/data/index_management/edit_component_template?step=mappings'); | ||
|
||
const { | ||
result: { | ||
current: { activeStep }, | ||
}, | ||
} = renderHook(() => useStepFromQueryString(history)); | ||
|
||
expect(activeStep).toBe('mappings'); | ||
}); | ||
|
||
it('should not update history on step change if no step is set in the url', () => { | ||
const history = createMemoryHistory(); | ||
history.push('/app/management/data/index_management/edit_component_template'); | ||
|
||
const { | ||
result: { | ||
current: { updateStep }, | ||
}, | ||
} = renderHook(() => useStepFromQueryString(history)); | ||
|
||
updateStep('aliases'); | ||
|
||
expect(history.location.search).toBe(''); | ||
}); | ||
|
||
it('should update history on step change if a step is set in the url', () => { | ||
const history = createMemoryHistory(); | ||
history.push('/app/management/data/index_management/edit_component_template?step=mappings'); | ||
|
||
const { | ||
result: { | ||
current: { updateStep }, | ||
}, | ||
} = renderHook(() => useStepFromQueryString(history)); | ||
|
||
updateStep('aliases'); | ||
expect(history.location.search).toBe('?step=aliases'); | ||
}); | ||
}); |
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
Oops, something went wrong.