Skip to main content

Function: prettyWidget()

prettyWidget(container, options): string

Defined in: pretty-widget.ts:176

Formats a widget tree as a readable string for debugging.

Renders the widget hierarchy in an HTML-like format with accessibility attributes like role, data-testid, and text content.

Parameters

ParameterTypeDescription
containerContainerThe container widget or application to format
optionsPrettyWidgetOptionsFormatting options for length and highlighting

Returns

string

Formatted string representation of the widget tree

Example

import { prettyWidget } from "@gtkx/testing";

console.log(prettyWidget(application));
// Output:
// <GtkApplicationWindow role="window">
// <GtkButton role="button">
// Click me
// </GtkButton>
// </GtkApplicationWindow>