From 8b159d2b582f7cf0b411cc61bca61b62428bddc4 Mon Sep 17 00:00:00 2001 From: Esteban Beltran Date: Wed, 16 Feb 2022 15:29:16 +0100 Subject: [PATCH] apply suggested renaming --- .../components/cases_context/cases_context_reducer.ts | 2 +- ...ntext_ui.test.tsx => cases_global_components.test.tsx} | 6 +++--- .../{cases_context_ui.tsx => cases_global_components.tsx} | 4 ++-- .../cases/public/components/cases_context/index.tsx | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) rename x-pack/plugins/cases/public/components/cases_context/{cases_context_ui.test.tsx => cases_global_components.test.tsx} (88%) rename x-pack/plugins/cases/public/components/cases_context/{cases_context_ui.tsx => cases_global_components.tsx} (80%) diff --git a/x-pack/plugins/cases/public/components/cases_context/cases_context_reducer.ts b/x-pack/plugins/cases/public/components/cases_context/cases_context_reducer.ts index 9cd239f2da1b2..f948072323214 100644 --- a/x-pack/plugins/cases/public/components/cases_context/cases_context_reducer.ts +++ b/x-pack/plugins/cases/public/components/cases_context/cases_context_reducer.ts @@ -7,7 +7,7 @@ import { CreateCaseFlyoutProps } from '../create/flyout'; -export const initialCasesContextState = (): CasesContextState => { +export const getInitialCasesContextState = (): CasesContextState => { return { createCaseFlyout: { isFlyoutOpen: false, diff --git a/x-pack/plugins/cases/public/components/cases_context/cases_context_ui.test.tsx b/x-pack/plugins/cases/public/components/cases_context/cases_global_components.test.tsx similarity index 88% rename from x-pack/plugins/cases/public/components/cases_context/cases_context_ui.test.tsx rename to x-pack/plugins/cases/public/components/cases_context/cases_global_components.test.tsx index 566d8e2033a36..4d9a101887b84 100644 --- a/x-pack/plugins/cases/public/components/cases_context/cases_context_ui.test.tsx +++ b/x-pack/plugins/cases/public/components/cases_context/cases_global_components.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { AppMockRenderer, createAppMockRenderer } from '../../common/mock'; import { getCreateCaseFlyoutLazyNoProvider } from '../../methods/get_create_case_flyout'; -import { CasesContextUI } from './cases_context_ui'; +import { CasesGlobalComponents } from './cases_global_components'; jest.mock('../../methods/get_create_case_flyout'); @@ -32,7 +32,7 @@ describe('Cases context UI', () => { }, }, }; - appMock.render(); + appMock.render(); expect(getCreateCaseFlyoutLazyNoProviderMock).toHaveBeenCalledWith({ attachments: [] }); }); it('should not render the create case flyout when isFlyoutOpen is true', async () => { @@ -41,7 +41,7 @@ describe('Cases context UI', () => { isFlyoutOpen: false, }, }; - appMock.render(); + appMock.render(); expect(getCreateCaseFlyoutLazyNoProviderMock).not.toHaveBeenCalled(); }); }); diff --git a/x-pack/plugins/cases/public/components/cases_context/cases_context_ui.tsx b/x-pack/plugins/cases/public/components/cases_context/cases_global_components.tsx similarity index 80% rename from x-pack/plugins/cases/public/components/cases_context/cases_context_ui.tsx rename to x-pack/plugins/cases/public/components/cases_context/cases_global_components.tsx index 671d8a7e467b1..42ff36e201df4 100644 --- a/x-pack/plugins/cases/public/components/cases_context/cases_context_ui.tsx +++ b/x-pack/plugins/cases/public/components/cases_context/cases_global_components.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { getCreateCaseFlyoutLazyNoProvider } from '../../methods'; import { CasesContextState } from './cases_context_reducer'; -export const CasesContextUI = React.memo(({ state }: { state: CasesContextState }) => { +export const CasesGlobalComponents = React.memo(({ state }: { state: CasesContextState }) => { return ( <> {state.createCaseFlyout.isFlyoutOpen && state.createCaseFlyout.props !== undefined @@ -18,4 +18,4 @@ export const CasesContextUI = React.memo(({ state }: { state: CasesContextState ); }); -CasesContextUI.displayName = 'CasesContextUi'; +CasesGlobalComponents.displayName = 'CasesContextUi'; diff --git a/x-pack/plugins/cases/public/components/cases_context/index.tsx b/x-pack/plugins/cases/public/components/cases_context/index.tsx index 34d2b342c572c..763f055dd968b 100644 --- a/x-pack/plugins/cases/public/components/cases_context/index.tsx +++ b/x-pack/plugins/cases/public/components/cases_context/index.tsx @@ -13,10 +13,10 @@ import { useApplication } from './use_application'; import { CasesContextStoreAction, casesContextReducer, - initialCasesContextState, + getInitialCasesContextState, } from './cases_context_reducer'; import { CasesContextFeatures, CasesFeatures } from '../../containers/types'; -import { CasesContextUI } from './cases_context_ui'; +import { CasesGlobalComponents } from './cases_global_components'; export interface CasesContextValue { owner: string[]; @@ -45,7 +45,7 @@ export const CasesProvider: React.FC<{ value: CasesContextProps }> = ({ value: { owner, userCanCrud, basePath = DEFAULT_BASE_PATH, features = {} }, }) => { const { appId, appTitle } = useApplication(); - const [state, dispatch] = useReducer(casesContextReducer, initialCasesContextState()); + const [state, dispatch] = useReducer(casesContextReducer, getInitialCasesContextState()); const [value, setValue] = useState(() => ({ owner, userCanCrud, @@ -76,7 +76,7 @@ export const CasesProvider: React.FC<{ value: CasesContextProps }> = ({ return isCasesContextValue(value) ? ( - + {children} ) : null;