From 37340ed531ec00751b22af85102d902dd5bb101b Mon Sep 17 00:00:00 2001 From: sai6855 Date: Thu, 22 Aug 2024 10:38:29 +0530 Subject: [PATCH] fix --- .../test-utils/src/describeConformance.tsx | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/packages-internal/test-utils/src/describeConformance.tsx b/packages-internal/test-utils/src/describeConformance.tsx index dca94fd89fb34d..f2f82293fd15bb 100644 --- a/packages-internal/test-utils/src/describeConformance.tsx +++ b/packages-internal/test-utils/src/describeConformance.tsx @@ -91,7 +91,7 @@ function throwMissingPropError(field: string): never { * the root component. */ export function testClassName( - element: React.ReactElement, + element: React.ReactElement, getOptions: () => ConformanceOptions, ) { it('applies the className to the root component', async () => { @@ -120,7 +120,7 @@ export function testComponentProp( element: React.ReactElement< HTMLElement & { component?: string | ((props: {}) => React.ReactElement); - 'data-testid': string; + 'data-testid'?: string; } >, getOptions: () => ConformanceOptions, @@ -158,7 +158,12 @@ export function testComponentProp( * MUI components spread additional props to its root. */ export function testPropsSpread( - element: React.ReactElement, + element: React.ReactElement< + HTMLElement & { + 'data-testid'?: string; + 'data-test-props-spread'?: string; + } + >, getOptions: () => ConformanceOptions, ) { it(`spreads props to the root component`, async () => { @@ -213,7 +218,7 @@ export function describeRef( * Tests that the root component has the root class */ export function testRootClass( - element: React.ReactElement }>, + element: React.ReactElement }>, getOptions: () => ConformanceOptions, ) { it('applies the root class to the root component if it has this class', async () => { @@ -267,12 +272,13 @@ function forEachSlot( function testSlotsProp( element: React.ReactElement< - HTMLElement & { - slots: Record; - slotProps: Record; - components: Record; - componentsProps: Record; - } + HTMLElement & + Partial<{ + slots: Record; + slotProps: Record; + components: Record; + componentsProps: Record; + }> >, getOptions: () => ConformanceOptions, ) { @@ -448,7 +454,7 @@ function testSlotsProp( function testSlotPropsProp( element: React.ReactElement< - HTMLElement & { slotProps: Record; componentsProps: Record } + HTMLElement & { slotProps?: Record; componentsProps?: Record } >, getOptions: () => ConformanceOptions, ) { @@ -535,7 +541,7 @@ function testSlotPropsProp( } function testSlotPropsCallback( - element: React.ReactElement }>, + element: React.ReactElement }>, getOptions: () => ConformanceOptions, ) { const { render, slots } = getOptions(); @@ -567,7 +573,7 @@ function testSlotPropsCallback( */ function testComponentsProp( element: React.ReactElement< - HTMLElement & { components: Record; 'data-testid': string } + HTMLElement & { components?: Record; 'data-testid'?: string } >, getOptions: () => ConformanceOptions, ) { @@ -887,7 +893,7 @@ function testThemeStyleOverrides( * Components from @inheritComponent */ function testThemeVariants( - element: React.ReactElement, + element: React.ReactElement, getOptions: () => ConformanceOptions, ) { describe('theme variants:', () => { @@ -1040,7 +1046,7 @@ const fullSuite = { * components. */ function describeConformance( - minimalElement: React.ReactElement, + minimalElement: React.ReactElement, getOptions: () => ConformanceOptions, ) { let originalMatchmedia: typeof window.matchMedia;