For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/reactlynx-testing-library/Interface.RenderOptions.md.
Lynx
  • English
  • reactlynx-testing-library / RenderOptions

    RenderOptions<Q>

    The options for render.

    Type Parameters

    Type ParameterDefault type
    Q extends Queriestypeof queries

    Properties

    enableBackgroundThread?

    optional enableBackgroundThread: boolean;

    Render your component in the background thread or not.

    Note that all user code in the top level will be executed in the background thread by default. (eg. __BACKGROUND__ is true in the top level)

    Default Value

    true

    Defined in

    index.d.ts:1482


    enableMainThread?

    optional enableMainThread: boolean;

    Render your component in the main thread or not.

    It is recommended to use this option only when you need to test the IFR behavior.

    Default Value

    false

    Defined in

    index.d.ts:1474


    queries?

    optional queries: Q;

    Queries to bind. Overrides the default set from DOM Testing Library unless merged.

    Example

    // Example, a function to traverse table contents
    import * as tableQueries from 'my-table-query-library'
    import { queries } from '@lynx-js/react/testing-library'
    
    const { getByRowColumn, getByText } = render(<MyTable />, {
      queries: {...queries, ...tableQueries},
    })
    

    Defined in

    index.d.ts:1433


    wrapper?

    optional wrapper: JSXElementConstructor<object>;

    Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating reusable custom render functions for common data providers. See setup for examples.

    Type declaration

    children
    children: ReactNode;

    Example

    import { render } from '@lynx-js/react/testing-library'
    import { ThemeProvider } from 'my-ui-lib'
    import { TranslationProvider } from 'my-i18n-lib'
    import defaultStrings from 'i18n/en-x-default'
    
    const AllTheProviders = ({children}) => {
      return (
        <ThemeProvider theme="light">
          <TranslationProvider messages={defaultStrings}>
            {children}
          </TranslationProvider>
        </ThemeProvider>
      )
    }
    
    const customRender = (ui, options) =>
      render(ui, { wrapper: AllTheProviders, ...options })
    
    // re-export everything
    export * from '@lynx-js/react/testing-library'
    
    // override render method
    export { customRender as render }

    Defined in

    index.d.ts:1466

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.