diff --git a/test/native/helpers.js b/test/native/helpers.js index 22a0c7bb56f253..b5e39752bb830c 100644 --- a/test/native/helpers.js +++ b/test/native/helpers.js @@ -34,7 +34,16 @@ provideToNativeHtml.mockImplementation( ( html ) => { serializedHtml = html; } ); -export function initializeEditor( props ) { +/** + * Initialize an editor for test assertions. + * + * @param {Object} props Properties passed to the editor component. + * @param {string} props.initialHtml String of block editor HTML to parse and render. + * @param {Object} [options] Configuration options for the editor. + * @param {import('react').ReactNode} [options.component] A specific editor component to render. + * @return {import('@testing-library/react-native').RenderAPI} A Testing Library screen. + */ +export function initializeEditor( props, { component = Editor } = {} ) { // Portions of the React Native Animation API rely upon these APIs. However, // Jest's 'legacy' fake timer mutate these globals, which breaks the Animated // API. We preserve the original implementations to restore them later. @@ -49,8 +58,9 @@ export function initializeEditor( props ) { jest.useFakeTimers( 'legacy' ); // Arrange + const EditorComponent = component; const screen = render( -