From fac40c154ad9b1cfe718e886613d9e3ba59d2068 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Fri, 2 Aug 2019 13:18:12 -0500 Subject: [PATCH] TS fixes --- src/components/steps/index.ts | 2 ++ src/components/steps/step.tsx | 5 +---- src/components/steps/step_horizontal.test.tsx | 10 ++++------ src/components/steps/step_horizontal.tsx | 13 +++++++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/steps/index.ts b/src/components/steps/index.ts index 7fdbaed1084..88fb7b8c660 100644 --- a/src/components/steps/index.ts +++ b/src/components/steps/index.ts @@ -5,3 +5,5 @@ export { EuiSteps } from './steps'; export { EuiSubSteps } from './sub_steps'; export { EuiStepsHorizontal } from './steps_horizontal'; + +export { EuiStepStatus } from './step_number'; diff --git a/src/components/steps/step.tsx b/src/components/steps/step.tsx index 2354dbebd8a..5271c3e4a99 100644 --- a/src/components/steps/step.tsx +++ b/src/components/steps/step.tsx @@ -44,16 +44,13 @@ export const EuiStep: FunctionComponent = ({ return (
- {/* // EuiI18n has trouble with the string setting - // @ts-ignore */} { + default={({ status }: { status?: EuiStepStatus }) => { if (status === 'incomplete') return 'Incomplete Step'; return 'Step'; }} values={{ status }}> - {/* // @ts-ignore */} {(ariaLabel: string) => ( { describe('onClick', () => { test('is called when clicked', () => { - const onClickHandler = sinon.stub(); + const onClickHandler = jest.fn(); const component = mount( @@ -71,11 +69,11 @@ describe('EuiStepHorizontal', () => { component.simulate('click'); - sinon.assert.calledOnce(onClickHandler); + expect(onClickHandler).toBeCalledTimes(1); }); test("isn't called when clicked if it's disabled", () => { - const onClickHandler = sinon.stub(); + const onClickHandler = jest.fn(); const component = mount( @@ -83,7 +81,7 @@ describe('EuiStepHorizontal', () => { component.simulate('click'); - sinon.assert.notCalled(onClickHandler); + expect(onClickHandler).not.toBeCalled(); }); }); }); diff --git a/src/components/steps/step_horizontal.tsx b/src/components/steps/step_horizontal.tsx index 405e917fe74..c17dd8729cb 100644 --- a/src/components/steps/step_horizontal.tsx +++ b/src/components/steps/step_horizontal.tsx @@ -70,11 +70,17 @@ export const EuiStepHorizontal: FunctionComponent< }; return ( - // EuiI18n has trouble with the string setting - // @ts-ignore { + default={({ + step, + title, + disabled, + isComplete, + }: Pick< + EuiStepHorizontalProps, + 'step' | 'title' | 'disabled' | 'isComplete' + >) => { let titleAppendix = ''; if (disabled) { titleAppendix = ' is disabled'; @@ -85,7 +91,6 @@ export const EuiStepHorizontal: FunctionComponent< return `Step ${step}: ${title}${titleAppendix}`; }} values={{ step, title, disabled, isComplete }}> - {/* // @ts-ignore */} {(buttonTitle: string) => (