Function: render()
render(
element,options?):Promise<RenderResult>
Defined in: render.tsx:100
Renders a React element for testing.
Creates a GTK application context and renders the element, returning query methods and utilities for interacting with the rendered widgets.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | ReactNode | The React element to render |
options? | RenderOptions | Render options including wrapper configuration |
Returns
Promise<RenderResult>
A promise resolving to query methods and utilities
Example
import { render, screen } from "@gtkx/testing";
test("button click", async () => {
await render(<MyButton />);
const button = await screen.findByRole(Gtk.AccessibleRole.BUTTON);
await userEvent.click(button);
});