diff --git a/packages/framework/esm-react-utils/mock.tsx b/packages/framework/esm-react-utils/mock.tsx index c7dc4ebcc..3bac7b97c 100644 --- a/packages/framework/esm-react-utils/mock.tsx +++ b/packages/framework/esm-react-utils/mock.tsx @@ -37,6 +37,8 @@ export const useSession = jest.fn(() => ({ export const useLayoutType = jest.fn(() => 'desktop'); +export const useRenderableExtensions = jest.fn(() => []); + export const useAssignedExtensions = jest.fn(() => []); export const useExtensionSlotMeta = jest.fn(() => ({})); diff --git a/packages/framework/esm-react-utils/src/extensions.test.tsx b/packages/framework/esm-react-utils/src/extensions.test.tsx index 1f43c7452..aa7053ff0 100644 --- a/packages/framework/esm-react-utils/src/extensions.test.tsx +++ b/packages/framework/esm-react-utils/src/extensions.test.tsx @@ -281,7 +281,11 @@ describe('ExtensionSlot, Extension, and useExtensionSlotMeta', () => { }); test('useRenderableExtensions returns registered extensions', async () => { - registerSimpleExtension('Spanish', 'esm-languages-app', undefined, { + function SpanishExtension({ suffix }) { + return
Spanish{suffix}
; + } + + registerSimpleExtension('Spanish', 'esm-languages-app', SpanishExtension, { code: 'es', }); attach('Box', 'Spanish'); @@ -292,11 +296,11 @@ describe('ExtensionSlot, Extension, and useExtensionSlotMeta', () => { })(() => { const extensions = useRenderableExtensions('Box'); const Ext = extensions[0]; - return ; + return ; }); render(); - await waitFor(() => expect(screen.getByText('Spanish')).toBeInTheDocument()); + await waitFor(() => expect(screen.getByText('Spanish hola')).toBeInTheDocument()); }); }); diff --git a/packages/framework/esm-react-utils/src/useRenderableExtensions.tsx b/packages/framework/esm-react-utils/src/useRenderableExtensions.tsx index 518416182..edfd14ec6 100644 --- a/packages/framework/esm-react-utils/src/useRenderableExtensions.tsx +++ b/packages/framework/esm-react-utils/src/useRenderableExtensions.tsx @@ -32,7 +32,7 @@ export function useRenderableExtensions(name: string): Array (state: Record) => ( + ? extensions.map((extension) => ({ state }: Pick) => (