From c913e1d50fe1b37aff601d457896b16150f351ba Mon Sep 17 00:00:00 2001 From: Stephen Hailey Date: Thu, 24 Oct 2024 15:35:54 +0100 Subject: [PATCH] Convert test to TS --- ...awerContent-test.js => BpkDrawerContent-test.tsx} | 4 ++-- .../bpk-component-drawer/src/BpkDrawerContent.tsx | 12 ++++++------ ...t-test.js.snap => BpkDrawerContent-test.tsx.snap} | 0 3 files changed, 8 insertions(+), 8 deletions(-) rename packages/bpk-component-drawer/src/{BpkDrawerContent-test.js => BpkDrawerContent-test.tsx} (96%) rename packages/bpk-component-drawer/src/__snapshots__/{BpkDrawerContent-test.js.snap => BpkDrawerContent-test.tsx.snap} (100%) diff --git a/packages/bpk-component-drawer/src/BpkDrawerContent-test.js b/packages/bpk-component-drawer/src/BpkDrawerContent-test.tsx similarity index 96% rename from packages/bpk-component-drawer/src/BpkDrawerContent-test.js rename to packages/bpk-component-drawer/src/BpkDrawerContent-test.tsx index 5ec4c86861..acd6e7d7fe 100644 --- a/packages/bpk-component-drawer/src/BpkDrawerContent-test.js +++ b/packages/bpk-component-drawer/src/BpkDrawerContent-test.tsx @@ -16,7 +16,7 @@ * limitations under the License. */ -/* @flow strict */ +import type { ReactElement } from 'react'; import { render } from '@testing-library/react'; @@ -25,7 +25,7 @@ import BpkDrawerContent from './BpkDrawerContent'; jest.mock( 'react-transition-group/Transition', () => - ({ children }) => + ({ children }: { children: (state: string) => ReactElement }) => children('entered'), ); diff --git a/packages/bpk-component-drawer/src/BpkDrawerContent.tsx b/packages/bpk-component-drawer/src/BpkDrawerContent.tsx index 25e2fbafc7..ab50ed0c92 100644 --- a/packages/bpk-component-drawer/src/BpkDrawerContent.tsx +++ b/packages/bpk-component-drawer/src/BpkDrawerContent.tsx @@ -44,12 +44,12 @@ type Props = { contentClassName?: string, closeLabel?: string, closeText?: string, - isDrawerShown: boolean, - hideTitle: boolean, - closeOnScrimClick: boolean, - isIphone: boolean, - isIpad: boolean, - padded: boolean, + isDrawerShown?: boolean, + hideTitle?: boolean, + closeOnScrimClick?: boolean, + isIphone?: boolean, + isIpad?: boolean, + padded?: boolean, }; const BpkDrawerContent = ({ diff --git a/packages/bpk-component-drawer/src/__snapshots__/BpkDrawerContent-test.js.snap b/packages/bpk-component-drawer/src/__snapshots__/BpkDrawerContent-test.tsx.snap similarity index 100% rename from packages/bpk-component-drawer/src/__snapshots__/BpkDrawerContent-test.js.snap rename to packages/bpk-component-drawer/src/__snapshots__/BpkDrawerContent-test.tsx.snap