diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx index 41d86a5d370f0..afc346f55e4c3 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx @@ -17,22 +17,28 @@ import { pluginServices } from '../../../services/plugin_services'; import { DashboardGrid } from './dashboard_grid'; import { DashboardContainer } from '../../embeddable/dashboard_container'; import { getSampleDashboardInput } from '../../../mocks'; - -jest.mock('./dashboard_grid_item', () => ({ - DashboardGridItem: require('react').forwardRef((props, ref) => { - const className = - props.expandedPanelId === undefined - ? 'regularPanel' - : props.expandedPanelId === props.id - ? 'expandedPanel' - : 'hiddenPanel'; - return ( -
- mockDashboardGridItem -
- ); - }), -})); +import type { Props as DashboardGridItemProps } from './dashboard_grid_item'; + +jest.mock('./dashboard_grid_item', () => { + return { + // eslint-disable-next-line @typescript-eslint/no-var-requires + DashboardGridItem: require('react').forwardRef( + (props: DashboardGridItemProps, ref: HTMLDivElement) => { + const className = + props.expandedPanelId === undefined + ? 'regularPanel' + : props.expandedPanelId === props.id + ? 'expandedPanel' + : 'hiddenPanel'; + return ( +
+ mockDashboardGridItem +
+ ); + } + ), + }; +}); const DashboardServicesProvider = pluginServices.getContextProvider(); diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx index 6e09254fed0d0..1c8b3d992187d 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx @@ -22,7 +22,7 @@ import { useDashboardContainerContext } from '../../dashboard_container_renderer type DivProps = Pick, 'className' | 'style' | 'children'>; -interface Props extends DivProps { +export interface Props extends DivProps { id: DashboardPanelState['explicitInput']['id']; index?: number; type: DashboardPanelState['type'];