@gtkx/testing 1.0.0-rc.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/accessible-native.d.ts +16 -0
- package/dist/accessible-native.d.ts.map +1 -0
- package/dist/accessible-native.js +206 -0
- package/dist/accessible-native.js.map +1 -0
- package/dist/act.d.ts +1 -3
- package/dist/act.d.ts.map +1 -1
- package/dist/act.js +1 -1
- package/dist/act.js.map +1 -1
- package/dist/build-queries.d.ts +27 -10
- package/dist/build-queries.d.ts.map +1 -1
- package/dist/build-queries.js +22 -24
- package/dist/build-queries.js.map +1 -1
- package/dist/cleanup-registry.d.ts +1 -1
- package/dist/cleanup-registry.d.ts.map +1 -1
- package/dist/cleanup-registry.js.map +1 -1
- package/dist/config.d.ts +8 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +10 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -1
- package/dist/errors.js.map +1 -1
- package/dist/fire-event.d.ts +35 -6
- package/dist/fire-event.d.ts.map +1 -1
- package/dist/fire-event.js +23 -7
- package/dist/fire-event.js.map +1 -1
- package/dist/frame-sync.d.ts +3 -2
- package/dist/frame-sync.d.ts.map +1 -1
- package/dist/frame-sync.js +19 -9
- package/dist/frame-sync.js.map +1 -1
- package/dist/harness-window.d.ts +5 -0
- package/dist/harness-window.d.ts.map +1 -0
- package/dist/harness-window.js +17 -0
- package/dist/harness-window.js.map +1 -0
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +5 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +5 -0
- package/dist/internal.js.map +1 -0
- package/dist/matchers.d.ts +88 -46
- package/dist/matchers.d.ts.map +1 -1
- package/dist/matchers.js +178 -20
- package/dist/matchers.js.map +1 -1
- package/dist/pretty-format.d.ts +2 -0
- package/dist/pretty-format.d.ts.map +1 -0
- package/dist/pretty-format.js +2 -0
- package/dist/pretty-format.js.map +1 -0
- package/dist/pretty-widget.d.ts +5 -2
- package/dist/pretty-widget.d.ts.map +1 -1
- package/dist/pretty-widget.js +75 -57
- package/dist/pretty-widget.js.map +1 -1
- package/dist/production.d.ts +8 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +34 -0
- package/dist/production.js.map +1 -0
- package/dist/queries.d.ts +98 -56
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +123 -83
- package/dist/queries.js.map +1 -1
- package/dist/query-helpers.d.ts +44 -0
- package/dist/query-helpers.d.ts.map +1 -0
- package/dist/query-helpers.js +57 -0
- package/dist/query-helpers.js.map +1 -0
- package/dist/render-children.d.ts +9 -0
- package/dist/render-children.d.ts.map +1 -0
- package/dist/render-children.js +11 -0
- package/dist/render-children.js.map +1 -0
- package/dist/render.d.ts +12 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +52 -16
- package/dist/render.js.map +1 -1
- package/dist/role-helpers.d.ts +12 -3
- package/dist/role-helpers.d.ts.map +1 -1
- package/dist/role-helpers.js +15 -5
- package/dist/role-helpers.js.map +1 -1
- package/dist/role-naming.d.ts +5 -0
- package/dist/role-naming.d.ts.map +1 -0
- package/dist/role-naming.js +96 -0
- package/dist/role-naming.js.map +1 -0
- package/dist/screenshot.d.ts +12 -20
- package/dist/screenshot.d.ts.map +1 -1
- package/dist/screenshot.js +179 -93
- package/dist/screenshot.js.map +1 -1
- package/dist/timers.d.ts +9 -0
- package/dist/timers.d.ts.map +1 -0
- package/dist/timers.js +21 -0
- package/dist/timers.js.map +1 -0
- package/dist/traversal.d.ts +7 -1
- package/dist/traversal.d.ts.map +1 -1
- package/dist/traversal.js +40 -6
- package/dist/traversal.js.map +1 -1
- package/dist/types.d.ts +32 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/user-event/adjustment.d.ts +3 -0
- package/dist/user-event/adjustment.d.ts.map +1 -1
- package/dist/user-event/adjustment.js +25 -3
- package/dist/user-event/adjustment.js.map +1 -1
- package/dist/user-event/click.d.ts +44 -8
- package/dist/user-event/click.d.ts.map +1 -1
- package/dist/user-event/click.js +176 -44
- package/dist/user-event/click.js.map +1 -1
- package/dist/user-event/column-header-click.d.ts +4 -0
- package/dist/user-event/column-header-click.d.ts.map +1 -0
- package/dist/user-event/column-header-click.js +55 -0
- package/dist/user-event/column-header-click.js.map +1 -0
- package/dist/user-event/event-wrapper.d.ts.map +1 -1
- package/dist/user-event/event-wrapper.js +34 -20
- package/dist/user-event/event-wrapper.js.map +1 -1
- package/dist/user-event/index.d.ts +80 -13
- package/dist/user-event/index.d.ts.map +1 -1
- package/dist/user-event/index.js +44 -26
- package/dist/user-event/index.js.map +1 -1
- package/dist/user-event/indexed-children.d.ts +10 -0
- package/dist/user-event/indexed-children.d.ts.map +1 -0
- package/dist/user-event/indexed-children.js +50 -0
- package/dist/user-event/indexed-children.js.map +1 -0
- package/dist/user-event/keyboard.d.ts.map +1 -1
- package/dist/user-event/keyboard.js +115 -31
- package/dist/user-event/keyboard.js.map +1 -1
- package/dist/user-event/list-row-click.d.ts +4 -0
- package/dist/user-event/list-row-click.d.ts.map +1 -0
- package/dist/user-event/list-row-click.js +38 -0
- package/dist/user-event/list-row-click.js.map +1 -0
- package/dist/user-event/native-click.d.ts +6 -0
- package/dist/user-event/native-click.d.ts.map +1 -0
- package/dist/user-event/native-click.js +36 -0
- package/dist/user-event/native-click.js.map +1 -0
- package/dist/user-event/notebook-tab-click.d.ts +5 -0
- package/dist/user-event/notebook-tab-click.d.ts.map +1 -0
- package/dist/user-event/notebook-tab-click.js +39 -0
- package/dist/user-event/notebook-tab-click.js.map +1 -0
- package/dist/user-event/pointer.d.ts +1 -1
- package/dist/user-event/pointer.d.ts.map +1 -1
- package/dist/user-event/pointer.js +33 -9
- package/dist/user-event/pointer.js.map +1 -1
- package/dist/user-event/selection.d.ts +11 -8
- package/dist/user-event/selection.d.ts.map +1 -1
- package/dist/user-event/selection.js +49 -38
- package/dist/user-event/selection.js.map +1 -1
- package/dist/user-event/text.d.ts +12 -5
- package/dist/user-event/text.d.ts.map +1 -1
- package/dist/user-event/text.js +151 -46
- package/dist/user-event/text.js.map +1 -1
- package/dist/wait-for.d.ts.map +1 -1
- package/dist/wait-for.js +4 -3
- package/dist/wait-for.js.map +1 -1
- package/dist/widget-accessible-properties.d.ts +14 -26
- package/dist/widget-accessible-properties.d.ts.map +1 -1
- package/dist/widget-accessible-properties.js +135 -190
- package/dist/widget-accessible-properties.js.map +1 -1
- package/dist/widget-getters.d.ts +11 -0
- package/dist/widget-getters.d.ts.map +1 -0
- package/dist/widget-getters.js +46 -0
- package/dist/widget-getters.js.map +1 -0
- package/dist/window-state.d.ts +10 -0
- package/dist/window-state.d.ts.map +1 -0
- package/dist/window-state.js +41 -0
- package/dist/window-state.js.map +1 -0
- package/dist/within.d.ts +3 -2
- package/dist/within.d.ts.map +1 -1
- package/dist/within.js +3 -2
- package/dist/within.js.map +1 -1
- package/package.json +21 -8
- package/src/accessible-native.ts +333 -0
- package/src/act.ts +1 -1
- package/src/build-queries.ts +47 -41
- package/src/cleanup-registry.ts +1 -1
- package/src/config.ts +10 -1
- package/src/errors.ts +12 -1
- package/src/fire-event.ts +61 -8
- package/src/frame-sync.ts +30 -9
- package/src/harness-window.ts +23 -0
- package/src/index.ts +18 -11
- package/src/internal.ts +12 -0
- package/src/matchers.ts +457 -72
- package/src/pretty-format.ts +1 -0
- package/src/pretty-widget.ts +98 -70
- package/src/production.ts +51 -0
- package/src/queries.ts +127 -89
- package/src/query-helpers.ts +97 -0
- package/src/render-children.ts +25 -0
- package/src/render.tsx +77 -17
- package/src/role-helpers.ts +16 -5
- package/src/role-naming.ts +99 -0
- package/src/screenshot.ts +266 -104
- package/src/timers.ts +31 -0
- package/src/traversal.ts +66 -6
- package/src/types.ts +34 -17
- package/src/user-event/adjustment.ts +31 -3
- package/src/user-event/click.ts +248 -52
- package/src/user-event/column-header-click.ts +76 -0
- package/src/user-event/event-wrapper.ts +41 -23
- package/src/user-event/index.ts +130 -40
- package/src/user-event/indexed-children.ts +75 -0
- package/src/user-event/keyboard.ts +161 -43
- package/src/user-event/list-row-click.ts +54 -0
- package/src/user-event/native-click.ts +51 -0
- package/src/user-event/notebook-tab-click.ts +57 -0
- package/src/user-event/pointer.ts +48 -9
- package/src/user-event/selection.ts +67 -41
- package/src/user-event/text.ts +192 -46
- package/src/wait-for.ts +4 -4
- package/src/widget-accessible-properties.ts +183 -230
- package/src/widget-getters.ts +85 -0
- package/src/window-state.ts +70 -0
- package/src/within.ts +3 -2
package/dist/matchers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAEH,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,GAClB,MAAM,mCAAmC,CAAC;AAwG3C,MAAM,YAAY,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAC7C,MAAM,mBAAmB,GAAgB,WAAW,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAC;AAC3G,MAAM,oBAAoB,G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AC,IAAI,cAAc,CAAC,MAAM,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,IAAI;YACjG,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;KACrF,CAAC;AACN,CAAC;AAED,gHAAgH;AAChH,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAChC,IAAI,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO;IACX,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;AACrC,CAAC,CAAC;AAsCF,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,GAInB,CAAC","sourcesContent":["/// <reference types=\"@vitest/expect\" />\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { getDefaultNormalizer } from \"./normalize.js\";\nimport { formatRole } from \"./role-helpers.js\";\nimport {\n type CheckedState,\n getWidgetAccessibleName,\n getWidgetCheckedState,\n getWidgetDescribedByText,\n getWidgetDisplayValue,\n getWidgetErrorMessage,\n getWidgetExpandedState,\n getWidgetInvalidState,\n getWidgetLabelText,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetRequiredState,\n getWidgetSelectedState,\n getWidgetSelection,\n getWidgetTextContent,\n getWidgetValue,\n hasDisplayValue,\n isWidgetDisabled,\n isWidgetVisible,\n} from \"./widget-accessible-properties.js\";\n\n/** The expected value for a text matcher: an exact string or a regular expression. */\ntype TextExpectation = string | RegExp;\n\n/** Options controlling how `toHaveTextContent` normalizes the text it reads. */\ntype TextContentOptions = {\n /**\n * When true (the default), trim the text and collapse runs of whitespace into single spaces\n * before comparing. When false, only replace non-breaking spaces with regular ones.\n */\n normalizeWhitespace?: boolean | undefined;\n};\n\n/** The expected value for a style class: an exact class name or a regular expression. */\ntype ClassExpectation = string | RegExp;\n/** The outcome of a matcher: whether it passed, and the failure text built on demand. */\ntype MatcherResult = { pass: boolean; message: () => string };\n/** The matcher state bound as `this`, supplying the test runner's deep equality check. */\ntype MatcherContext = { equals: (actual: unknown, expected: unknown) => boolean };\n/** Compares text read from the received widget; with no expected value, asserts the text is non-empty. */\ntype TextMatcher = (received: unknown, expected?: TextExpectation) => MatcherResult;\n/** Asserts a single state of the received widget, taking no expected value. */\ntype StateMatcher = (received: unknown) => MatcherResult;\ntype TextMatcherContext = { matcherName: string; widget: Gtk.Widget; actual: string | null };\ntype ClassArguments = { expected: ClassExpectation[]; isExact: boolean };\n\n/** A text matcher that also takes normalization options for the text it reads. */\ntype TextContentMatcher = (\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n) => MatcherResult;\n\n/** Signatures of the widget assertion matchers, keyed by the name each is registered under. */\ntype MatcherImplementations = {\n /** Asserts the text an editable widget or combo box shows; with no argument, that it is not empty. */\n toHaveDisplayValue: TextMatcher;\n /** Asserts the widget's own text, or its descendants' when it has none, contains or matches the expectation. */\n toHaveTextContent: TextContentMatcher;\n /** Asserts the widget's accessible name; with no argument, that it has one. */\n toHaveAccessibleName: TextMatcher;\n /**\n * Asserts the joined accessible names of the widget's `described-by` targets, falling back to its\n * `description` and then to its tooltip.\n */\n toHaveAccessibleDescription: TextMatcher;\n /** Asserts the joined accessible names of the widget's `error-message` targets, read only while it is invalid. */\n toHaveAccessibleErrorMessage: TextMatcher;\n /** Asserts the widget's placeholder text; with no argument, that it has some. */\n toHavePlaceholderText: TextMatcher;\n /** Asserts the text currently selected in an editable widget. */\n toHaveSelection: TextMatcher;\n /** Asserts the widget's checked state is checked rather than unchecked or mixed. */\n toBeChecked: StateMatcher;\n /** Asserts the widget's checked state is mixed. */\n toBePartiallyChecked: StateMatcher;\n /** Asserts a `Gtk.ToggleButton` is active, and throws for any other widget. */\n toBePressed: StateMatcher;\n /** Asserts a `Gtk.Expander` or the row behind a `Gtk.TreeExpander` is expanded, and throws for anything else. */\n toBeExpanded: StateMatcher;\n /**\n * Asserts a `Gtk.ListBoxRow` or `Gtk.FlowBoxChild` is selected, or that a widget in a selectable role\n * carries the selected state flag, and throws for anything else.\n */\n toBeSelected: StateMatcher;\n /** Asserts the widget is insensitive, or sits inside an insensitive ancestor. */\n toBeDisabled: StateMatcher;\n /** Asserts the widget and all of its ancestors are sensitive. */\n toBeEnabled: StateMatcher;\n /** Asserts the widget and its ancestors are all visible, and that none of them is fully transparent. */\n toBeVisible: StateMatcher;\n /** Asserts the widget's root is a window that is still in the toplevel list. */\n toBeRooted: StateMatcher;\n /** Asserts the widget has neither a child nor label text. */\n toBeEmpty: StateMatcher;\n /** Asserts the widget's accessible invalid state is set to anything other than false. */\n toBeInvalid: StateMatcher;\n /** Asserts the widget's accessible invalid state is unset or false. */\n toBeValid: StateMatcher;\n /** Asserts the widget's accessible required state. */\n toBeRequired: StateMatcher;\n /** Asserts the widget holds the platform focus state. */\n toHaveFocus: StateMatcher;\n /** Asserts a widget's numeric value, or its display value when a string is given. */\n toHaveValue: (received: unknown, expected?: number | string) => MatcherResult;\n /** Asserts the widget's accessible role. */\n toHaveRole: (received: unknown, expected: Gtk.AccessibleRole) => MatcherResult;\n /** Asserts the widget is, or is an ancestor of, the given widget. */\n toContainElement: (received: unknown, descendant: Gtk.Widget | null) => MatcherResult;\n /**\n * Asserts the widget carries every given style class, each a name, a space-separated list, or a pattern.\n * Pass `{ exact: true }` last to require exactly that set, which rules out patterns.\n */\n toHaveClass: (received: unknown, ...args: unknown[]) => MatcherResult;\n /**\n * Asserts a GObject property, named as in GObject and looked up by its camel-cased accessor, equals the\n * expected value. With no expected value, asserts the property is set. GObject values compare by identity.\n */\n toHaveObjectProperty: (this: MatcherContext, received: unknown, ...args: unknown[]) => MatcherResult;\n};\n\ntype ExpectExtend = { extend: (m: MatcherImplementations) => void };\n\nconst registration = { isRegistered: false };\nconst displayValueMatcher: TextMatcher = textMatcher(\"toHaveDisplayValue\", getWidgetDisplayValue, \"exact\");\nconst toHaveAccessibleName: TextMatcher = textMatcher(\"toHaveAccessibleName\", getWidgetAccessibleName, \"exact\");\n\nconst toHaveAccessibleDescription: TextMatcher = textMatcher(\n \"toHaveAccessibleDescription\",\n getWidgetDescribedByText,\n \"exact\",\n);\n\nconst toHaveAccessibleErrorMessage: TextMatcher = textMatcher(\n \"toHaveAccessibleErrorMessage\",\n readErrorMessageText,\n \"exact\",\n);\n\nconst toHavePlaceholderText: TextMatcher = textMatcher(\"toHavePlaceholderText\", getWidgetPlaceholderText, \"exact\");\nconst toHaveSelection: TextMatcher = textMatcher(\"toHaveSelection\", getWidgetSelection, \"exact\");\nconst toBePressed: StateMatcher = booleanStateMatcher(\"toBePressed\", \"pressed\", getWidgetPressedState);\nconst toBeExpanded: StateMatcher = booleanStateMatcher(\"toBeExpanded\", \"expanded\", getWidgetExpandedState);\nconst toBeSelected: StateMatcher = booleanStateMatcher(\"toBeSelected\", \"selected\", getWidgetSelectedState);\nconst toBeRequired: StateMatcher = booleanStateMatcher(\"toBeRequired\", \"required\", getWidgetRequiredState);\n\n/** The widget assertion matchers keyed by name, suitable for passing to `expect.extend`. */\nconst matchers: MatcherImplementations = {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHavePlaceholderText,\n toHaveSelection,\n toBeChecked,\n toBePartiallyChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n toBeDisabled,\n toBeEnabled,\n toBeVisible,\n toBeRooted,\n toBeEmpty,\n toBeInvalid,\n toBeValid,\n toBeRequired,\n toHaveFocus,\n toHaveValue,\n toHaveRole,\n toContainElement,\n toHaveClass,\n toHaveObjectProperty,\n};\n\nconst asWidget = (received: unknown, matcherName: string): Gtk.Widget => {\n if (!(received instanceof Gtk.Widget)) {\n throw new TypeError(`${matcherName}: received value must be a Gtk.Widget, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst asObject = (received: unknown, matcherName: string): GObject.Object => {\n if (!(received instanceof GObject.Object)) {\n throw new TypeError(`${matcherName}: received value must be a GObject, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst describeWidget = (widget: Gtk.Widget): string => {\n const role = Gtk.AccessibleRole[widget.getAccessibleRole()];\n const name = getWidgetAccessibleName(widget);\n\n return name === null ? `<${role}>` : `<${role} name=${JSON.stringify(name)}>`;\n};\n\nconst describeObject = (object: GObject.Object): string =>\n object instanceof Gtk.Widget ? describeWidget(object) : `<${object.constructor.name}>`;\n\nconst isTextMatch = (actual: string, expected: TextExpectation, mode: \"exact\" | \"substring\"): boolean => {\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(actual);\n }\n\n return mode === \"exact\" ? actual === expected : actual.includes(expected);\n};\n\nconst describeExpected = (expected: TextExpectation): string =>\n expected instanceof RegExp ? String(expected) : JSON.stringify(expected);\n\nconst negationPrefix = (isPass: boolean): string => (isPass ? \"not \" : \"\");\n\nconst nonEmptyResult = ({ matcherName, widget, actual }: TextMatcherContext): MatcherResult => {\n const isPass = actual !== null && actual !== \"\";\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have a non-empty value for ${matcherName}, ` +\n `but got ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n};\n\nconst matchedResult = (context: TextMatcherContext, expected: TextExpectation, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}${context.matcherName} ${describeExpected(expected)}, ` +\n `but received ${JSON.stringify(context.actual)}\\n${describeWidget(context.widget)}`,\n});\n\nconst stateResult = (widget: Gtk.Widget, stateName: string, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () => `expected widget ${negationPrefix(isPass)}to be ${stateName}\\n${describeWidget(widget)}`,\n});\n\nconst camelCase = (name: string): string =>\n name.replaceAll(/-([a-z])/g, (_match, letter: string) => letter.toUpperCase());\n\nconst isAsymmetricMatcher = (value: unknown): boolean =>\n typeof value === \"object\" && value !== null && typeof Reflect.get(value, \"asymmetricMatch\") === \"function\";\n\nconst isEqualValue = (context: MatcherContext, actual: unknown, expected: unknown): boolean => {\n if (isAsymmetricMatcher(expected)) {\n return context.equals(actual, expected);\n }\n\n if (actual instanceof GObject.Object || expected instanceof GObject.Object) {\n return Object.is(actual, expected);\n }\n\n return context.equals(actual, expected);\n};\n\nconst isClassMatch = (actual: string[], expected: ClassExpectation): boolean =>\n expected instanceof RegExp ? actual.some((name) => expected.test(name)) : actual.includes(expected);\n\nconst isWidgetRooted = (widget: Gtk.Widget): boolean => {\n const root = widget.getRoot();\n\n if (root === null) {\n return false;\n }\n\n if (root instanceof Gtk.Window) {\n return Gtk.Window.listToplevels().includes(root);\n }\n\n return true;\n};\n\nconst globalExpect = (): ExpectExtend | null => {\n const candidate: unknown = Reflect.get(globalThis, \"expect\");\n\n if (candidate && typeof (candidate as ExpectExtend).extend === \"function\") {\n return candidate as ExpectExtend;\n }\n\n return null;\n};\n\nfunction readErrorMessageText(widget: Gtk.Widget): string | null {\n const state = getWidgetInvalidState(widget);\n\n if (state === null || state === Gtk.AccessibleInvalidState.FALSE) {\n return null;\n }\n\n const targets = getWidgetErrorMessage(widget);\n\n if (targets === null) {\n return null;\n }\n\n const texts = targets.map((target) => getWidgetAccessibleName(target)).filter((text) => text !== null);\n\n return texts.length > 0 ? texts.join(\" \") : null;\n}\n\nfunction assertReadableProperty(object: GObject.Object, name: string, property: string, value: unknown): void {\n if (typeof value === \"function\") {\n throw new TypeError(\n `toHaveObjectProperty: \"${name}\" is shadowed by a method of the same name; ` +\n `call ${property}() and assert on its result instead`,\n );\n }\n\n if (value === undefined && !Reflect.has(object, property)) {\n throw new TypeError(\n `toHaveObjectProperty: no readable property \"${name}\" on ${describeObject(object)}; ` +\n \"construct-only and write-only properties cannot be read back\",\n );\n }\n}\n\nfunction readObjectProperty(object: GObject.Object, name: string): unknown {\n const property = camelCase(name);\n const value: unknown = Reflect.get(object, property);\n assertReadableProperty(object, name, property, value);\n\n return value;\n}\n\nfunction classEntries(entry: unknown): ClassExpectation[] {\n return entry instanceof RegExp ? [entry] : String(entry).split(/\\s+/).filter(Boolean);\n}\n\nfunction parseClassArguments(args: unknown[]): ClassArguments {\n const last = args.at(-1);\n const isOptions = typeof last === \"object\" && last !== null && !(last instanceof RegExp);\n const isExact = isOptions && Reflect.get(last, \"exact\") === true;\n const entries = isOptions ? args.slice(0, -1) : args;\n\n return { expected: entries.flatMap((entry) => classEntries(entry)), isExact };\n}\n\nfunction exactClassResult(widget: Gtk.Widget, actual: string[], expected: ClassExpectation[]): MatcherResult {\n if (expected.some((entry) => entry instanceof RegExp)) {\n throw new TypeError(\"toHaveClass: the exact option cannot be combined with a regular expression\");\n }\n\n const names = expected.map(String);\n const isPass = names.length === actual.length && names.every((name) => actual.includes(name));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have exactly the classes ${JSON.stringify(names)}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction textMatcher(\n matcherName: string,\n read: (widget: Gtk.Widget) => string | null,\n mode: \"exact\" | \"substring\",\n): TextMatcher {\n return (received: unknown, expected?: TextExpectation): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const actual = read(widget);\n const context: TextMatcherContext = { matcherName, widget, actual };\n\n if (expected === undefined) {\n return nonEmptyResult(context);\n }\n\n return matchedResult(context, expected, actual !== null && isTextMatch(actual, expected, mode));\n };\n}\n\nfunction normalizeTextContent(text: string, options?: TextContentOptions): string {\n if (options?.normalizeWhitespace === false) {\n return text.replaceAll(\"\\u{A0}\", \" \");\n }\n\n return getDefaultNormalizer()(text);\n}\n\nfunction readTextContent(widget: Gtk.Widget, options?: TextContentOptions): string | null {\n const text = getWidgetTextContent(widget);\n\n return text === null ? null : normalizeTextContent(text, options);\n}\n\nfunction toHaveTextContent(\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n): MatcherResult {\n const read = (widget: Gtk.Widget): string | null => readTextContent(widget, options);\n\n return textMatcher(\"toHaveTextContent\", read, \"substring\")(received, expected);\n}\n\nfunction notApplicable(matcherName: string, stateName: string, widget: Gtk.Widget): Error {\n return new Error(\n `${matcherName}: widget does not expose a ${stateName} ` +\n `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\\n${describeWidget(widget)}`,\n );\n}\n\nfunction booleanStateMatcher(\n matcherName: string,\n stateName: string,\n read: (widget: Gtk.Widget) => boolean | null,\n): StateMatcher {\n return (received: unknown): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const state = read(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, `${stateName} state`, widget);\n }\n\n return stateResult(widget, stateName, state);\n };\n}\n\nfunction readCheckedState(widget: Gtk.Widget, matcherName: string): CheckedState {\n const state = getWidgetCheckedState(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, \"checked state\", widget);\n }\n\n return state;\n}\n\nfunction toBeChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeChecked\");\n\n return stateResult(widget, \"checked\", readCheckedState(widget, \"toBeChecked\") === \"checked\");\n}\n\nfunction toBePartiallyChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBePartiallyChecked\");\n\n return stateResult(widget, \"partially checked\", readCheckedState(widget, \"toBePartiallyChecked\") === \"mixed\");\n}\n\nfunction toHaveDisplayValue(received: unknown, expected?: TextExpectation): MatcherResult {\n const widget = asWidget(received, \"toHaveDisplayValue\");\n\n if (!hasDisplayValue(widget)) {\n throw notApplicable(\"toHaveDisplayValue\", \"display value\", widget);\n }\n\n return displayValueMatcher(received, expected);\n}\n\nfunction toHaveValue(received: unknown, expected?: number | string): MatcherResult {\n const widget = asWidget(received, \"toHaveValue\");\n\n if (typeof expected === \"string\") {\n return displayValueMatcher(received, expected);\n }\n\n const actual = getWidgetValue(widget).now;\n\n if (actual === null) {\n throw notApplicable(\"toHaveValue\", \"numeric value\", widget);\n }\n\n const isPass = expected === undefined || actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have value ${String(expected)}, ` +\n `but received ${String(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toBeDisabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeDisabled\");\n\n return stateResult(widget, \"disabled\", isWidgetDisabled(widget));\n}\n\nfunction toBeEnabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEnabled\");\n\n return stateResult(widget, \"enabled\", !isWidgetDisabled(widget));\n}\n\nfunction toBeVisible(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeVisible\");\n\n return stateResult(widget, \"visible\", isWidgetVisible(widget));\n}\n\nfunction toBeRooted(received: unknown): MatcherResult {\n if (received === null) {\n return { pass: false, message: () => \"expected a widget to be rooted in a window, but received null\" };\n }\n\n const widget = asWidget(received, \"toBeRooted\");\n\n return stateResult(widget, \"rooted in a window\", isWidgetRooted(widget));\n}\n\nfunction toBeEmpty(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEmpty\");\n\n return stateResult(widget, \"empty\", widget.getFirstChild() === null && getWidgetLabelText(widget) === null);\n}\n\nfunction toBeInvalid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeInvalid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"invalid\", state !== null && state !== Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toBeValid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeValid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"valid\", state === null || state === Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toHaveFocus(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toHaveFocus\");\n\n return stateResult(widget, \"focused\", widget.getPlatformState(Gtk.AccessiblePlatformState.FOCUSED));\n}\n\nfunction toHaveRole(received: unknown, expected: Gtk.AccessibleRole): MatcherResult {\n const widget = asWidget(received, \"toHaveRole\");\n const actual = widget.getAccessibleRole();\n const isPass = actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have role '${formatRole(expected)}', ` +\n `but received '${formatRole(actual)}'\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toContainElement(received: unknown, descendant: Gtk.Widget | null): MatcherResult {\n const widget = asWidget(received, \"toContainElement\");\n const isPass = descendant !== null && (descendant === widget || descendant.isAncestor(widget));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to contain ` +\n `${descendant === null ? \"null\" : describeWidget(descendant)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveClass(received: unknown, ...args: unknown[]): MatcherResult {\n const widget = asWidget(received, \"toHaveClass\");\n const actual = widget.getCssClasses();\n const { expected, isExact } = parseClassArguments(args);\n\n if (isExact) {\n return exactClassResult(widget, actual, expected);\n }\n\n if (expected.length === 0) {\n return stateResult(widget, \"given any style class\", actual.length > 0);\n }\n\n const isPass = expected.every((entry) => isClassMatch(actual, entry));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have class ${expected.map(String).join(\", \")}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveObjectProperty(this: MatcherContext, received: unknown, ...args: unknown[]): MatcherResult {\n const object = asObject(received, \"toHaveObjectProperty\");\n const [name, expected] = args;\n const actual = readObjectProperty(object, String(name));\n\n if (args.length < 2) {\n const isSet = actual !== null && actual !== undefined;\n\n return {\n pass: isSet,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isSet)}to have a value for property ` +\n `\"${String(name)}\", but received ${JSON.stringify(actual)}`,\n };\n }\n\n /* eslint-disable-next-line unicorn/no-this-outside-of-class --\n expect.extend invokes matchers with the matcher state as `this` */\n const isPass = isEqualValue(this, actual, expected);\n\n return {\n pass: isPass,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isPass)}to have property \"${String(name)}\" ` +\n `equal to ${JSON.stringify(expected)}, but received ${JSON.stringify(actual)}`,\n };\n}\n\n/** Registers the widget matchers on the global `expect`, when one is available. Safe to call more than once. */\nconst registerMatchers = (): void => {\n if (registration.isRegistered) {\n return;\n }\n\n const expect = globalExpect();\n\n if (!expect) {\n return;\n }\n\n expect.extend(matchers);\n registration.isRegistered = true;\n};\n\ndeclare module \"@vitest/expect\" {\n /* eslint-disable @typescript-eslint/consistent-type-definitions -- declaration merging requires interfaces */\n interface WidgetMatchers {\n toHaveDisplayValue(expected?: TextExpectation): void;\n toHaveTextContent(expected?: TextExpectation, options?: TextContentOptions): void;\n toHaveAccessibleName(expected?: TextExpectation): void;\n toHaveAccessibleDescription(expected?: TextExpectation): void;\n toHaveAccessibleErrorMessage(expected?: TextExpectation): void;\n toHavePlaceholderText(expected?: TextExpectation): void;\n toHaveSelection(expected?: TextExpectation): void;\n toBeChecked(): void;\n toBePartiallyChecked(): void;\n toBePressed(): void;\n toBeExpanded(): void;\n toBeSelected(): void;\n toBeDisabled(): void;\n toBeEnabled(): void;\n toBeVisible(): void;\n toBeRooted(): void;\n toBeEmpty(): void;\n toBeInvalid(): void;\n toBeValid(): void;\n toBeRequired(): void;\n toHaveFocus(): void;\n toHaveValue(expected?: number | string): void;\n toHaveRole(expected: Gtk.AccessibleRole): void;\n toContainElement(descendant: Gtk.Widget | null): void;\n toHaveClass(...args: (ClassExpectation | { exact: boolean })[]): void;\n toHaveObjectProperty(name: string, expected?: unknown): void;\n }\n\n interface Assertion extends WidgetMatchers {}\n interface AsymmetricMatchersContaining extends WidgetMatchers {}\n /* eslint-enable @typescript-eslint/consistent-type-definitions */\n}\n\nexport {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHavePlaceholderText,\n toHaveSelection,\n toBeChecked,\n toBePartiallyChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n toBeDisabled,\n toBeEnabled,\n toBeVisible,\n toBeRooted,\n toBeEmpty,\n toBeInvalid,\n toBeValid,\n toBeRequired,\n toHaveFocus,\n toHaveValue,\n toHaveRole,\n toContainElement,\n toHaveClass,\n toHaveObjectProperty,\n matchers,\n registerMatchers,\n type ClassExpectation,\n type TextContentOptions,\n type TextExpectation,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EACH,2BAA2B,EAE3B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,mBAAmB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,cAAc,EACd,cAAc,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAEH,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,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C,IAAI,cAAc,CAAC,MAAM,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,IAAI;YACjG,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;KACrF,CAAC;AACN,CAAC;AAED,gHAAgH;AAChH,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAChC,IAAI,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO;IACX,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;AACrC,CAAC,CAAC;AA8DF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAwE,CAAC","sourcesContent":["import type { SyncExpectationResult } from \"@vitest/expect\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ByRoleOptions, Matcher, MatcherOptions } from \"./types.js\";\nimport {\n ACCESSIBLE_NUMBER_TOLERANCE,\n type AccessibleAttributeValue,\n isAccessibleNumberMatch,\n isAccessibleNumberProperty,\n readAccessibleProperty,\n readAccessibleState,\n} from \"./accessible-native.js\";\nimport { getDefaultNormalizer } from \"./normalize.js\";\nimport {\n queryAllByDisplayValue,\n queryAllByLabelText,\n queryAllByPlaceholderText,\n queryAllByRole,\n queryAllByText,\n} from \"./queries.js\";\nimport { formatRole } from \"./role-helpers.js\";\nimport { type Container, descendants } from \"./traversal.js\";\nimport {\n type CheckedState,\n getWidgetAccessibleName,\n getWidgetCheckedState,\n getWidgetDescribedByText,\n getWidgetDisplayValue,\n getWidgetErrorMessage,\n getWidgetInvalidState,\n getWidgetLabelText,\n getWidgetPressedState,\n getWidgetRequiredState,\n getWidgetSelection,\n getWidgetTextContent,\n getWidgetValueNow,\n hasDisplayValue,\n isWidgetDisabled,\n isWidgetValueMatch,\n isWidgetVisible,\n} from \"./widget-accessible-properties.js\";\nimport { getTypeTag } from \"./widget-getters.js\";\nimport { isWindowActivated } from \"./window-state.js\";\n\n/** The expected value for a text matcher: an exact string or a regular expression. */\ntype TextExpectation = string | RegExp;\n\n/** Options controlling how `toHaveTextContent` normalizes the text it reads. */\ntype TextContentOptions = {\n /**\n * When true (the default), trim the text and collapse runs of whitespace into single spaces\n * before comparing. When false, only replace non-breaking spaces with regular ones.\n */\n normalizeWhitespace?: boolean | undefined;\n};\n\n/** The expected value for a style class: an exact class name or a regular expression. */\ntype ClassExpectation = string | RegExp;\n/** The outcome of a matcher: whether it passed, and the failure text built on demand. */\ntype MatcherResult = Pick<SyncExpectationResult, \"message\" | \"pass\">;\n\n/** The matcher state bound as `this`, supplying the test runner's deep equality check. */\ntype MatcherContext = {\n /** Compares a received value against an expected one, resolving asymmetric matchers. */\n equals: (actual: unknown, expected: unknown) => boolean;\n};\n\n/** Compares text read from the received widget; with no expected value, asserts the text is non-empty. */\ntype TextMatcher = (received: unknown, expected?: TextExpectation) => MatcherResult;\n/** Asserts a single state of the received widget, taking no expected value. */\ntype StateMatcher = (received: unknown) => MatcherResult;\n/** Trailing arguments of the `ByRole` query family, as a containment matcher takes them. */\ntype RoleQueryArgs = [role: Gtk.AccessibleRole, options?: ByRoleOptions];\n/** Trailing arguments of the text-based query families, as a containment matcher takes them. */\ntype TextQueryArgs = [text: Matcher, options?: MatcherOptions];\n/** Counts the descendants a query family finds under the received widget. */\ntype ContainmentMatcher<Args extends unknown[]> = (received: unknown, ...args: Args) => MatcherResult;\ntype TextMatcherContext = { matcherName: string; widget: Gtk.Widget; actual: string | null };\ntype ClassArguments = { expected: ClassExpectation[]; isExact: boolean };\ntype QueryAll<Args extends unknown[]> = (container: Container, ...args: Args) => Gtk.Widget[];\n\ntype BooleanAccessibleState =\n Gtk.AccessibleState.BUSY |\n Gtk.AccessibleState.DISABLED |\n Gtk.AccessibleState.EXPANDED |\n Gtk.AccessibleState.HIDDEN |\n Gtk.AccessibleState.SELECTED |\n Gtk.AccessibleState.VISITED;\n\ntype TristateAccessibleState = Gtk.AccessibleState.CHECKED | Gtk.AccessibleState.PRESSED;\n\ntype StringAccessibleProperty =\n Gtk.AccessibleProperty.DESCRIPTION |\n Gtk.AccessibleProperty.HELP_TEXT |\n Gtk.AccessibleProperty.KEY_SHORTCUTS |\n Gtk.AccessibleProperty.LABEL |\n Gtk.AccessibleProperty.PLACEHOLDER |\n Gtk.AccessibleProperty.ROLE_DESCRIPTION |\n Gtk.AccessibleProperty.VALUE_TEXT;\n\ntype BooleanAccessibleProperty =\n Gtk.AccessibleProperty.HAS_POPUP |\n Gtk.AccessibleProperty.MODAL |\n Gtk.AccessibleProperty.MULTI_LINE |\n Gtk.AccessibleProperty.MULTI_SELECTABLE |\n Gtk.AccessibleProperty.READ_ONLY |\n Gtk.AccessibleProperty.REQUIRED;\n\ntype NumberAccessibleProperty =\n Gtk.AccessibleProperty.LEVEL |\n Gtk.AccessibleProperty.VALUE_MAX |\n Gtk.AccessibleProperty.VALUE_MIN |\n Gtk.AccessibleProperty.VALUE_NOW;\n\n/** A text matcher that also takes normalization options for the text it reads. */\ntype TextContentMatcher = (\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n) => MatcherResult;\n\n/** Signatures of the widget assertion matchers, keyed by the name each is registered under. */\ntype MatcherImplementations = {\n /** Asserts the text an editable widget or combo box shows; with no argument, that it is not empty. */\n toHaveDisplayValue: TextMatcher;\n /** Asserts the widget's own text, or its descendants' when it has none, contains or matches the expectation. */\n toHaveTextContent: TextContentMatcher;\n /** Asserts the widget's accessible name; with no argument, that it has one. */\n toHaveAccessibleName: TextMatcher;\n /**\n * Asserts the joined accessible names of the widget's `described-by` targets, falling back to its\n * `description` and then to its tooltip.\n */\n toHaveAccessibleDescription: TextMatcher;\n /** Asserts the joined accessible names of the widget's `error-message` targets, read only while it is invalid. */\n toHaveAccessibleErrorMessage: TextMatcher;\n /** Asserts the text currently selected in an editable widget. */\n toHaveSelection: TextMatcher;\n /**\n * Asserts an accessible state GTK holds for the widget, taking the value type that state carries.\n * With no expected value, asserts only that the state is set to something determinate.\n */\n toHaveAccessibleState: (\n received: unknown,\n state: Gtk.AccessibleState,\n expected?: boolean | number,\n ) => MatcherResult;\n /**\n * Asserts an accessible property GTK holds for the widget, taking the value type that property\n * carries. With no expected value, asserts only that the property is set. Numeric properties\n * compare the way `toHaveValue` and the `value` option of the `ByRole` queries do, within 0.001.\n */\n toHaveAccessibleProperty: (\n received: unknown,\n property: Gtk.AccessibleProperty,\n expected?: AccessibleAttributeValue,\n ) => MatcherResult;\n /** Asserts the widget's checked state is checked rather than unchecked or mixed. */\n toBeChecked: StateMatcher;\n /** Asserts the widget's checked state is mixed. */\n toBePartiallyChecked: StateMatcher;\n /** Asserts a `Gtk.ToggleButton` is active, and throws for any other widget. */\n toBePressed: StateMatcher;\n /** Asserts the widget's accessible pressed state is mixed, and throws when it exposes none. */\n toBePartiallyPressed: StateMatcher;\n /** Asserts the widget is insensitive, or sits inside an insensitive ancestor. */\n toBeDisabled: StateMatcher;\n /** Asserts the widget and all of its ancestors are sensitive. */\n toBeEnabled: StateMatcher;\n /** Asserts the widget and its ancestors are all visible, and that none of them is fully transparent. */\n toBeVisible: StateMatcher;\n /** Asserts the widget's root is a window that is still in the toplevel list. */\n toBeRooted: StateMatcher;\n /** Asserts the widget has neither a child nor label text. */\n toBeEmptyWidget: StateMatcher;\n /** Asserts the widget's accessible invalid state is set to anything other than false. */\n toBeInvalid: StateMatcher;\n /** Asserts the widget's accessible invalid state is unset or false. */\n toBeValid: StateMatcher;\n /** Asserts the widget's accessible required state. */\n toBeRequired: StateMatcher;\n /** Asserts the widget holds the platform focus state. */\n toHaveFocus: StateMatcher;\n /**\n * Asserts a widget's numeric value, or its display value when a string is given.\n *\n * Numbers come from the accessibility tree, which GTK keeps to a resolution of 0.001: it drops an\n * update whose value is nearer than that to the one already published, so a widget that moves by\n * less keeps its previous value. Numbers therefore match within 0.001, the same tolerance the\n * `value` option of the `ByRole` queries and `toHaveAccessibleProperty` apply. That option reads\n * the same tree, where the maximum of a paged widget such as a scrollbar is the last value it can\n * reach, its adjustment's upper bound less one page.\n */\n toHaveValue: (received: unknown, expected?: number | string) => MatcherResult;\n /** Asserts the widget's accessible role. */\n toHaveRole: (received: unknown, expected: Gtk.AccessibleRole) => MatcherResult;\n /** Asserts the widget is, or is an ancestor of, the given widget. */\n toContainElement: (received: unknown, descendant: Gtk.Widget | null) => MatcherResult;\n /** Asserts the widget comes before the given widget in the widget tree, neither containing the other. */\n toAppearBefore: (received: unknown, other: Gtk.Widget) => MatcherResult;\n /** Asserts the widget comes after the given widget in the widget tree, neither containing the other. */\n toAppearAfter: (received: unknown, other: Gtk.Widget) => MatcherResult;\n /** Asserts at least one widget under the received one matches the `ByRole` query. */\n toContainAnyByRole: ContainmentMatcher<RoleQueryArgs>;\n /** Asserts exactly one widget under the received one matches the `ByRole` query. */\n toContainOneByRole: ContainmentMatcher<RoleQueryArgs>;\n /** Asserts at least one widget under the received one matches the `ByText` query. */\n toContainAnyByText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts exactly one widget under the received one matches the `ByText` query. */\n toContainOneByText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts at least one widget under the received one matches the `ByLabelText` query. */\n toContainAnyByLabelText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts exactly one widget under the received one matches the `ByLabelText` query. */\n toContainOneByLabelText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts at least one widget under the received one matches the `ByPlaceholderText` query. */\n toContainAnyByPlaceholderText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts exactly one widget under the received one matches the `ByPlaceholderText` query. */\n toContainOneByPlaceholderText: ContainmentMatcher<TextQueryArgs>;\n /** Asserts at least one widget under the received one matches the `ByDisplayValue` query. */\n toContainAnyByDisplayValue: ContainmentMatcher<TextQueryArgs>;\n /** Asserts exactly one widget under the received one matches the `ByDisplayValue` query. */\n toContainOneByDisplayValue: ContainmentMatcher<TextQueryArgs>;\n /**\n * Asserts the widget carries every given style class, each a name, a space-separated list, or a pattern.\n * Pass `{ exact: true }` last to require exactly that set, which rules out patterns.\n */\n toHaveClass: (received: unknown, ...args: unknown[]) => MatcherResult;\n /**\n * Asserts a GObject property, named as in GObject and looked up by its camel-cased accessor, equals the\n * expected value. With no expected value, asserts the property is set. GObject values compare by identity.\n */\n toHaveObjectProperty: (this: MatcherContext, received: unknown, ...args: unknown[]) => MatcherResult;\n};\n\ntype ExpectExtend = { extend: (m: MatcherImplementations) => void };\n\ntype AttributeExpectation = {\n label: string;\n comparison: string;\n expected: AccessibleAttributeValue;\n actual: AccessibleAttributeValue | null;\n isPass: boolean;\n isReadingRounded: boolean;\n};\n\nconst registration = { isRegistered: false };\nconst MIXED_TRISTATE: number = Gtk.AccessibleTristate.MIXED;\nconst ROUNDED_READING = \", which the accessibility tree rounds to six significant digits\";\nconst displayValueMatcher: TextMatcher = textMatcher(\"toHaveDisplayValue\", getWidgetDisplayValue, \"exact\");\nconst toHaveAccessibleName: TextMatcher = textMatcher(\"toHaveAccessibleName\", getWidgetAccessibleName, \"exact\");\n\nconst toHaveAccessibleDescription: TextMatcher = textMatcher(\n \"toHaveAccessibleDescription\",\n getWidgetDescribedByText,\n \"exact\",\n);\n\nconst toHaveAccessibleErrorMessage: TextMatcher = textMatcher(\n \"toHaveAccessibleErrorMessage\",\n readErrorMessageText,\n \"exact\",\n);\n\nconst toHaveSelection: TextMatcher = textMatcher(\"toHaveSelection\", getWidgetSelection, \"exact\");\nconst toBePressed: StateMatcher = booleanStateMatcher(\"toBePressed\", \"pressed\", getWidgetPressedState);\nconst toBeRequired: StateMatcher = booleanStateMatcher(\"toBeRequired\", \"required\", getWidgetRequiredState);\n\nconst toContainAnyByRole: ContainmentMatcher<RoleQueryArgs> = containmentMatcher(\n \"toContainAnyByRole\",\n false,\n queryAllByRole,\n);\n\nconst toContainOneByRole: ContainmentMatcher<RoleQueryArgs> = containmentMatcher(\n \"toContainOneByRole\",\n true,\n queryAllByRole,\n);\n\nconst toContainAnyByText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainAnyByText\",\n false,\n queryAllByText,\n);\n\nconst toContainOneByText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainOneByText\",\n true,\n queryAllByText,\n);\n\nconst toContainAnyByLabelText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainAnyByLabelText\",\n false,\n queryAllByLabelText,\n);\n\nconst toContainOneByLabelText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainOneByLabelText\",\n true,\n queryAllByLabelText,\n);\n\nconst toContainAnyByPlaceholderText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainAnyByPlaceholderText\",\n false,\n queryAllByPlaceholderText,\n);\n\nconst toContainOneByPlaceholderText: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainOneByPlaceholderText\",\n true,\n queryAllByPlaceholderText,\n);\n\nconst toContainAnyByDisplayValue: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainAnyByDisplayValue\",\n false,\n queryAllByDisplayValue,\n);\n\nconst toContainOneByDisplayValue: ContainmentMatcher<TextQueryArgs> = containmentMatcher(\n \"toContainOneByDisplayValue\",\n true,\n queryAllByDisplayValue,\n);\n\n/** The widget assertion matchers keyed by name, suitable for passing to `expect.extend`. */\nconst matchers: MatcherImplementations = {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHaveSelection,\n toHaveAccessibleState,\n toHaveAccessibleProperty,\n toBeChecked,\n toBePartiallyChecked,\n toBePressed,\n toBePartiallyPressed,\n toBeDisabled,\n toBeEnabled,\n toBeVisible,\n toBeRooted,\n toBeEmptyWidget,\n toBeInvalid,\n toBeValid,\n toBeRequired,\n toHaveFocus,\n toHaveValue,\n toHaveRole,\n toContainElement,\n toAppearBefore,\n toAppearAfter,\n toContainAnyByRole,\n toContainOneByRole,\n toContainAnyByText,\n toContainOneByText,\n toContainAnyByLabelText,\n toContainOneByLabelText,\n toContainAnyByPlaceholderText,\n toContainOneByPlaceholderText,\n toContainAnyByDisplayValue,\n toContainOneByDisplayValue,\n toHaveClass,\n toHaveObjectProperty,\n};\n\nconst asWidget = (received: unknown, matcherName: string): Gtk.Widget => {\n if (!(received instanceof Gtk.Widget)) {\n throw new TypeError(`${matcherName}: received value must be a Gtk.Widget, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst asObject = (received: unknown, matcherName: string): GObject.Object => {\n if (!(received instanceof GObject.Object)) {\n throw new TypeError(`${matcherName}: received value must be a GObject, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst describeWidget = (widget: Gtk.Widget): string => {\n const role = Gtk.AccessibleRole[widget.getAccessibleRole()];\n const name = getWidgetAccessibleName(widget);\n\n return name === null ? `<${role}>` : `<${role} name=${JSON.stringify(name)}>`;\n};\n\nconst describeObject = (object: GObject.Object): string =>\n object instanceof Gtk.Widget ? describeWidget(object) : `<${getTypeTag(object)}>`;\n\nconst isTextMatch = (actual: string, expected: TextExpectation, mode: \"exact\" | \"substring\"): boolean => {\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(actual);\n }\n\n return mode === \"exact\" ? actual === expected : actual.includes(expected);\n};\n\nconst describeExpected = (expected: TextExpectation): string =>\n expected instanceof RegExp ? String(expected) : JSON.stringify(expected);\n\nconst negationPrefix = (isPass: boolean): string => (isPass ? \"not \" : \"\");\n\nconst nonEmptyResult = ({ matcherName, widget, actual }: TextMatcherContext): MatcherResult => {\n const isPass = actual !== null && actual !== \"\";\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have a non-empty value for ${matcherName}, ` +\n `but got ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n};\n\nconst matchedResult = (context: TextMatcherContext, expected: TextExpectation, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}${context.matcherName} ${describeExpected(expected)}, ` +\n `but received ${JSON.stringify(context.actual)}\\n${describeWidget(context.widget)}`,\n});\n\nconst stateResult = (widget: Gtk.Widget, stateName: string, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () => `expected widget ${negationPrefix(isPass)}to be ${stateName}\\n${describeWidget(widget)}`,\n});\n\nconst isHoldingFocus = (widget: Gtk.Widget, root: Gtk.Window): boolean => {\n const focus = root.getFocus();\n\n return focus !== null && (focus === widget || focus.isAncestor(widget));\n};\n\nconst isFocusHeldByInactiveWindow = (widget: Gtk.Widget): boolean => {\n const root = widget.getRoot();\n\n return root instanceof Gtk.Window && !isWindowActivated(root) && isHoldingFocus(widget, root);\n};\n\nconst focusResult = (widget: Gtk.Widget, isPass: boolean): MatcherResult => {\n if (isPass || !isFocusHeldByInactiveWindow(widget)) {\n return stateResult(widget, \"focused\", isPass);\n }\n\n return {\n pass: false,\n message: () =>\n \"expected widget to be focused: its window has given it the focus, \" +\n `but that window is not active\\n${describeWidget(widget)}`,\n };\n};\n\nconst describeAttributeValue = (value: AccessibleAttributeValue | null): string =>\n value === null ? \"unset\" : JSON.stringify(value);\n\nconst attributeSetResult = (\n widget: Gtk.Widget,\n label: string,\n actual: AccessibleAttributeValue | null,\n): MatcherResult => {\n const isSet = actual !== null;\n\n return {\n pass: isSet,\n message: () => `expected widget ${negationPrefix(isSet)}to have ${label} set\\n${describeWidget(widget)}`,\n };\n};\n\nconst describeReading = (expectation: AttributeExpectation): string =>\n `${describeAttributeValue(expectation.actual)}${expectation.isReadingRounded ? ROUNDED_READING : \"\"}`;\n\nconst attributeValueResult = (widget: Gtk.Widget, expectation: AttributeExpectation): MatcherResult => ({\n pass: expectation.isPass,\n message: () =>\n `expected widget ${negationPrefix(expectation.isPass)}to have ${expectation.label} ` +\n `${expectation.comparison} ${describeAttributeValue(expectation.expected)}, but received ` +\n `${describeReading(expectation)}\\n${describeWidget(widget)}`,\n});\n\nconst orderResult = (widget: Gtk.Widget, other: Gtk.Widget, position: string, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to appear ${position} ${describeWidget(other)} ` +\n `in the widget tree\\n${describeWidget(widget)}`,\n});\n\nconst getTreeRoot = (widget: Gtk.Widget): Gtk.Widget => {\n let root = widget;\n let parent = root.getParent();\n\n while (parent) {\n root = parent;\n parent = root.getParent();\n }\n\n return root;\n};\n\nconst isSeparateWidget = (first: Gtk.Widget, second: Gtk.Widget): boolean =>\n first !== second && !first.isAncestor(second) && !second.isAncestor(first);\n\nconst isPrecedingWidget = (root: Gtk.Widget, first: Gtk.Widget, second: Gtk.Widget): boolean => {\n for (const widget of descendants(root)) {\n if (widget === first) {\n return true;\n }\n\n if (widget === second) {\n return false;\n }\n }\n\n return false;\n};\n\nconst isAppearingBefore = (first: Gtk.Widget, second: Gtk.Widget): boolean => {\n const root = getTreeRoot(first);\n\n return isSeparateWidget(first, second) && root === getTreeRoot(second) && isPrecedingWidget(root, first, second);\n};\n\nconst camelCase = (name: string): string =>\n name.replaceAll(/-([a-z])/g, (_match, letter: string) => letter.toUpperCase());\n\nconst isAsymmetricMatcher = (value: unknown): boolean =>\n typeof value === \"object\" && value !== null && typeof Reflect.get(value, \"asymmetricMatch\") === \"function\";\n\nconst isEqualValue = (context: MatcherContext, actual: unknown, expected: unknown): boolean => {\n if (isAsymmetricMatcher(expected)) {\n return context.equals(actual, expected);\n }\n\n if (actual instanceof GObject.Object || expected instanceof GObject.Object) {\n return Object.is(actual, expected);\n }\n\n return context.equals(actual, expected);\n};\n\nconst isClassMatch = (actual: string[], expected: ClassExpectation): boolean =>\n expected instanceof RegExp ? actual.some((name) => expected.test(name)) : actual.includes(expected);\n\nconst isWidgetRooted = (widget: Gtk.Widget): boolean => {\n const root = widget.getRoot();\n\n if (root === null) {\n return false;\n }\n\n if (root instanceof Gtk.Window) {\n return Gtk.Window.listToplevels().includes(root);\n }\n\n return true;\n};\n\nconst globalExpect = (): ExpectExtend | null => {\n const candidate: unknown = Reflect.get(globalThis, \"expect\");\n\n if (candidate && typeof (candidate as ExpectExtend).extend === \"function\") {\n return candidate as ExpectExtend;\n }\n\n return null;\n};\n\nfunction readErrorMessageText(widget: Gtk.Widget): string | null {\n const state = getWidgetInvalidState(widget);\n\n if (state === null || state === Gtk.AccessibleInvalidState.FALSE) {\n return null;\n }\n\n const targets = getWidgetErrorMessage(widget);\n\n if (targets === null) {\n return null;\n }\n\n const texts = targets.map((target) => getWidgetAccessibleName(target)).filter((text) => text !== null);\n\n return texts.length > 0 ? texts.join(\" \") : null;\n}\n\nfunction assertReadableProperty(object: GObject.Object, name: string, property: string, value: unknown): void {\n if (typeof value === \"function\") {\n throw new TypeError(\n `toHaveObjectProperty: \"${name}\" is shadowed by a method of the same name; ` +\n `call ${property}() and assert on its result instead`,\n );\n }\n\n if (value === undefined && !Reflect.has(object, property)) {\n throw new TypeError(\n `toHaveObjectProperty: no readable property \"${name}\" on ${describeObject(object)}; ` +\n \"construct-only and write-only properties cannot be read back\",\n );\n }\n}\n\nfunction readObjectProperty(object: GObject.Object, name: string): unknown {\n const property = camelCase(name);\n const value: unknown = Reflect.get(object, property);\n assertReadableProperty(object, name, property, value);\n\n return value;\n}\n\nfunction classEntries(entry: unknown): ClassExpectation[] {\n return entry instanceof RegExp ? [entry] : String(entry).split(/\\s+/).filter(Boolean);\n}\n\nfunction parseClassArguments(args: unknown[]): ClassArguments {\n const last = args.at(-1);\n const isOptions = typeof last === \"object\" && last !== null && !(last instanceof RegExp);\n const isExact = isOptions && Reflect.get(last, \"exact\") === true;\n const entries = isOptions ? args.slice(0, -1) : args;\n\n return { expected: entries.flatMap((entry) => classEntries(entry)), isExact };\n}\n\nfunction exactClassResult(widget: Gtk.Widget, actual: string[], expected: ClassExpectation[]): MatcherResult {\n if (expected.some((entry) => entry instanceof RegExp)) {\n throw new TypeError(\"toHaveClass: the exact option cannot be combined with a regular expression\");\n }\n\n const names = expected.map(String);\n const isPass = names.length === actual.length && names.every((name) => actual.includes(name));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have exactly the classes ${JSON.stringify(names)}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction textMatcher(\n matcherName: string,\n read: (widget: Gtk.Widget) => string | null,\n mode: \"exact\" | \"substring\",\n): TextMatcher {\n return (received: unknown, expected?: TextExpectation): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const actual = read(widget);\n const context: TextMatcherContext = { matcherName, widget, actual };\n\n if (expected === undefined) {\n return nonEmptyResult(context);\n }\n\n return matchedResult(context, expected, actual !== null && isTextMatch(actual, expected, mode));\n };\n}\n\nfunction normalizeTextContent(text: string, options?: TextContentOptions): string {\n if (options?.normalizeWhitespace === false) {\n return text.replaceAll(\"\\u{A0}\", \" \");\n }\n\n return getDefaultNormalizer()(text);\n}\n\nfunction readTextContent(widget: Gtk.Widget, options?: TextContentOptions): string | null {\n const text = getWidgetTextContent(widget);\n\n return text === null ? null : normalizeTextContent(text, options);\n}\n\nfunction toHaveTextContent(\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n): MatcherResult {\n const read = (widget: Gtk.Widget): string | null => readTextContent(widget, options);\n\n return textMatcher(\"toHaveTextContent\", read, \"substring\")(received, expected);\n}\n\nfunction notApplicable(matcherName: string, stateName: string, widget: Gtk.Widget): Error {\n return new Error(\n `${matcherName}: widget does not expose a ${stateName} ` +\n `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\\n${describeWidget(widget)}`,\n );\n}\n\nfunction booleanStateMatcher(\n matcherName: string,\n stateName: string,\n read: (widget: Gtk.Widget) => boolean | null,\n): StateMatcher {\n return (received: unknown): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const state = read(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, `${stateName} state`, widget);\n }\n\n return stateResult(widget, stateName, state);\n };\n}\n\nfunction containmentMatcher<Args extends unknown[]>(\n matcherName: string,\n isSingle: boolean,\n queryAll: QueryAll<Args>,\n): ContainmentMatcher<Args> {\n const quantity = isSingle ? \"exactly one widget\" : \"any widget\";\n\n return (received: unknown, ...args: Args): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const matches = queryAll(widget, ...args);\n const isPass = isSingle ? matches.length === 1 : matches.length > 0;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to contain ${quantity} matching ${matcherName}, ` +\n `but found ${String(matches.length)}\\n${describeWidget(widget)}`,\n };\n };\n}\n\nfunction toHaveAccessibleState(\n received: unknown,\n state: Gtk.AccessibleState,\n expected?: boolean | number,\n): MatcherResult {\n const widget = asWidget(received, \"toHaveAccessibleState\");\n const actual = readAccessibleState(widget, state);\n const label = `accessible state ${Gtk.AccessibleState[state]}`;\n\n if (expected === undefined) {\n return attributeSetResult(widget, label, actual);\n }\n\n const wanted = typeof expected === \"boolean\" ? Number(expected) : expected;\n\n return attributeValueResult(widget, {\n label,\n comparison: \"equal to\",\n expected: wanted,\n actual,\n isPass: actual === wanted,\n isReadingRounded: false,\n });\n}\n\nconst propertyLabel = (property: Gtk.AccessibleProperty): string =>\n `accessible property ${Gtk.AccessibleProperty[property]}`;\n\nconst propertyExpectation = (\n widget: Gtk.Widget,\n property: Gtk.AccessibleProperty,\n expected: AccessibleAttributeValue,\n actual: AccessibleAttributeValue | null,\n): AttributeExpectation => {\n const label = propertyLabel(property);\n\n if (typeof expected === \"number\" && isAccessibleNumberProperty(property)) {\n return {\n label,\n comparison: `within ${String(ACCESSIBLE_NUMBER_TOLERANCE)} of`,\n expected,\n actual,\n isPass: isAccessibleNumberMatch(widget, property, expected),\n isReadingRounded: actual !== null,\n };\n }\n\n return { label, comparison: \"equal to\", expected, actual, isPass: actual === expected, isReadingRounded: false };\n};\n\nfunction toHaveAccessibleProperty(\n received: unknown,\n property: Gtk.AccessibleProperty,\n expected?: AccessibleAttributeValue,\n): MatcherResult {\n const widget = asWidget(received, \"toHaveAccessibleProperty\");\n const actual = readAccessibleProperty(widget, property);\n\n if (expected === undefined) {\n return attributeSetResult(widget, propertyLabel(property), actual);\n }\n\n return attributeValueResult(widget, propertyExpectation(widget, property, expected, actual));\n}\n\nfunction toBePartiallyPressed(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBePartiallyPressed\");\n const state = readAccessibleState(widget, Gtk.AccessibleState.PRESSED);\n\n if (state === null) {\n throw notApplicable(\"toBePartiallyPressed\", \"pressed state\", widget);\n }\n\n return stateResult(widget, \"partially pressed\", state === MIXED_TRISTATE);\n}\n\nfunction toAppearBefore(received: unknown, other: Gtk.Widget): MatcherResult {\n const widget = asWidget(received, \"toAppearBefore\");\n const target = asWidget(other, \"toAppearBefore\");\n\n return orderResult(widget, target, \"before\", isAppearingBefore(widget, target));\n}\n\nfunction toAppearAfter(received: unknown, other: Gtk.Widget): MatcherResult {\n const widget = asWidget(received, \"toAppearAfter\");\n const target = asWidget(other, \"toAppearAfter\");\n\n return orderResult(widget, target, \"after\", isAppearingBefore(target, widget));\n}\n\nfunction readCheckedState(widget: Gtk.Widget, matcherName: string): CheckedState {\n const state = getWidgetCheckedState(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, \"checked state\", widget);\n }\n\n return state;\n}\n\nfunction toBeChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeChecked\");\n\n return stateResult(widget, \"checked\", readCheckedState(widget, \"toBeChecked\") === \"checked\");\n}\n\nfunction toBePartiallyChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBePartiallyChecked\");\n\n return stateResult(widget, \"partially checked\", readCheckedState(widget, \"toBePartiallyChecked\") === \"mixed\");\n}\n\nfunction toHaveDisplayValue(received: unknown, expected?: TextExpectation): MatcherResult {\n const widget = asWidget(received, \"toHaveDisplayValue\");\n\n if (!hasDisplayValue(widget)) {\n throw notApplicable(\"toHaveDisplayValue\", \"display value\", widget);\n }\n\n return displayValueMatcher(received, expected);\n}\n\nconst describeValueExpectation = (expected: number | undefined): string =>\n expected === undefined ? \"set\" : `within ${String(ACCESSIBLE_NUMBER_TOLERANCE)} of ${String(expected)}`;\n\nfunction toHaveValue(received: unknown, expected?: number | string): MatcherResult {\n const widget = asWidget(received, \"toHaveValue\");\n\n if (typeof expected === \"string\") {\n return displayValueMatcher(received, expected);\n }\n\n const actual = getWidgetValueNow(widget);\n\n if (actual === null) {\n throw notApplicable(\"toHaveValue\", \"numeric value\", widget);\n }\n\n const isPass = expected === undefined || isWidgetValueMatch(widget, \"now\", expected);\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have value ${describeValueExpectation(expected)}, ` +\n `but received ${String(actual)}${ROUNDED_READING}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toBeDisabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeDisabled\");\n\n return stateResult(widget, \"disabled\", isWidgetDisabled(widget));\n}\n\nfunction toBeEnabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEnabled\");\n\n return stateResult(widget, \"enabled\", !isWidgetDisabled(widget));\n}\n\nfunction toBeVisible(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeVisible\");\n\n return stateResult(widget, \"visible\", isWidgetVisible(widget));\n}\n\nfunction toBeRooted(received: unknown): MatcherResult {\n if (received === null) {\n return { pass: false, message: () => \"expected a widget to be rooted in a window, but received null\" };\n }\n\n const widget = asWidget(received, \"toBeRooted\");\n\n return stateResult(widget, \"rooted in a window\", isWidgetRooted(widget));\n}\n\nfunction toBeEmptyWidget(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEmptyWidget\");\n\n return stateResult(widget, \"empty\", widget.getFirstChild() === null && getWidgetLabelText(widget) === null);\n}\n\nfunction toBeInvalid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeInvalid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"invalid\", state !== null && state !== Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toBeValid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeValid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"valid\", state === null || state === Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toHaveFocus(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toHaveFocus\");\n\n return focusResult(widget, widget.getPlatformState(Gtk.AccessiblePlatformState.FOCUSED));\n}\n\nfunction toHaveRole(received: unknown, expected: Gtk.AccessibleRole): MatcherResult {\n const widget = asWidget(received, \"toHaveRole\");\n const actual = widget.getAccessibleRole();\n const isPass = actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have role '${formatRole(expected)}', ` +\n `but received '${formatRole(actual)}'\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toContainElement(received: unknown, descendant: Gtk.Widget | null): MatcherResult {\n const widget = asWidget(received, \"toContainElement\");\n const isPass = descendant !== null && (descendant === widget || descendant.isAncestor(widget));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to contain ` +\n `${descendant === null ? \"null\" : describeWidget(descendant)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveClass(received: unknown, ...args: unknown[]): MatcherResult {\n const widget = asWidget(received, \"toHaveClass\");\n const actual = widget.getCssClasses();\n const { expected, isExact } = parseClassArguments(args);\n\n if (isExact) {\n return exactClassResult(widget, actual, expected);\n }\n\n if (expected.length === 0) {\n return stateResult(widget, \"given any style class\", actual.length > 0);\n }\n\n const isPass = expected.every((entry) => isClassMatch(actual, entry));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have class ${expected.map(String).join(\", \")}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveObjectProperty(this: MatcherContext, received: unknown, ...args: unknown[]): MatcherResult {\n const object = asObject(received, \"toHaveObjectProperty\");\n const [name, expected] = args;\n const actual = readObjectProperty(object, String(name));\n\n if (args.length < 2) {\n const isSet = actual !== null && actual !== undefined;\n\n return {\n pass: isSet,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isSet)}to have a value for property ` +\n `\"${String(name)}\", but received ${JSON.stringify(actual)}`,\n };\n }\n\n const isPass = isEqualValue(this, actual, expected);\n\n return {\n pass: isPass,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isPass)}to have property \"${String(name)}\" ` +\n `equal to ${JSON.stringify(expected)}, but received ${JSON.stringify(actual)}`,\n };\n}\n\n/** Registers the widget matchers on the global `expect`, when one is available. Safe to call more than once. */\nconst registerMatchers = (): void => {\n if (registration.isRegistered) {\n return;\n }\n\n const expect = globalExpect();\n\n if (!expect) {\n return;\n }\n\n expect.extend(matchers);\n registration.isRegistered = true;\n};\n\ndeclare module \"@vitest/expect\" {\n /* eslint-disable @typescript-eslint/consistent-type-definitions -- declaration merging requires interfaces */\n interface WidgetMatchers {\n toHaveDisplayValue(expected?: TextExpectation): void;\n toHaveTextContent(expected?: TextExpectation, options?: TextContentOptions): void;\n toHaveAccessibleName(expected?: TextExpectation): void;\n toHaveAccessibleDescription(expected?: TextExpectation): void;\n toHaveAccessibleErrorMessage(expected?: TextExpectation): void;\n toHaveSelection(expected?: TextExpectation): void;\n /* eslint-disable-next-line unicorn/consistent-boolean-name -- expected is the jest-dom matcher argument name */\n toHaveAccessibleState(state: BooleanAccessibleState, expected?: boolean): void;\n toHaveAccessibleState(state: TristateAccessibleState, expected?: Gtk.AccessibleTristate): void;\n toHaveAccessibleState(state: Gtk.AccessibleState.INVALID, expected?: Gtk.AccessibleInvalidState): void;\n toHaveAccessibleProperty(property: StringAccessibleProperty, expected?: string): void;\n /* eslint-disable-next-line unicorn/consistent-boolean-name -- expected is the jest-dom matcher argument name */\n toHaveAccessibleProperty(property: BooleanAccessibleProperty, expected?: boolean): void;\n toHaveAccessibleProperty(property: NumberAccessibleProperty, expected?: number): void;\n toHaveAccessibleProperty(\n property: Gtk.AccessibleProperty.AUTOCOMPLETE,\n expected?: Gtk.AccessibleAutocomplete,\n ): void;\n toHaveAccessibleProperty(property: Gtk.AccessibleProperty.ORIENTATION, expected?: Gtk.Orientation): void;\n toHaveAccessibleProperty(property: Gtk.AccessibleProperty.SORT, expected?: Gtk.AccessibleSort): void;\n toBeChecked(): void;\n toBePartiallyChecked(): void;\n toBePressed(): void;\n toBePartiallyPressed(): void;\n toBeDisabled(): void;\n toBeEnabled(): void;\n toBeVisible(): void;\n toBeRooted(): void;\n toBeEmptyWidget(): void;\n toBeInvalid(): void;\n toBeValid(): void;\n toBeRequired(): void;\n toHaveFocus(): void;\n toHaveValue(expected?: number | string): void;\n toHaveRole(expected: Gtk.AccessibleRole): void;\n toContainElement(descendant: Gtk.Widget | null): void;\n toAppearBefore(other: Gtk.Widget): void;\n toAppearAfter(other: Gtk.Widget): void;\n toContainAnyByRole(...args: RoleQueryArgs): void;\n toContainOneByRole(...args: RoleQueryArgs): void;\n toContainAnyByText(...args: TextQueryArgs): void;\n toContainOneByText(...args: TextQueryArgs): void;\n toContainAnyByLabelText(...args: TextQueryArgs): void;\n toContainOneByLabelText(...args: TextQueryArgs): void;\n toContainAnyByPlaceholderText(...args: TextQueryArgs): void;\n toContainOneByPlaceholderText(...args: TextQueryArgs): void;\n toContainAnyByDisplayValue(...args: TextQueryArgs): void;\n toContainOneByDisplayValue(...args: TextQueryArgs): void;\n toHaveClass(...args: (ClassExpectation | { exact: boolean })[]): void;\n toHaveObjectProperty(name: string, expected?: unknown): void;\n }\n\n interface Assertion extends WidgetMatchers {}\n interface AsymmetricMatchersContaining extends WidgetMatchers {}\n /* eslint-enable @typescript-eslint/consistent-type-definitions */\n}\n\nexport { matchers, registerMatchers, type ClassExpectation, type TextContentOptions, type TextExpectation };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-format.d.ts","sourceRoot":"","sources":["../src/pretty-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-format.js","sourceRoot":"","sources":["../src/pretty-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC","sourcesContent":["export * as prettyFormat from \"@vitest/pretty-format\";\n"]}
|
package/dist/pretty-widget.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
+
import { type PrettyFormatOptions } from "@vitest/pretty-format";
|
|
2
3
|
import { type Container } from "./traversal.js";
|
|
3
4
|
/** Produces the value of the `id` attribute printed first on a widget's opening tag. */
|
|
4
5
|
type WidgetIdResolver = (widget: Gtk.Widget) => string;
|
|
@@ -15,6 +16,8 @@ type PrettyWidgetOptions = {
|
|
|
15
16
|
getId?: WidgetIdResolver;
|
|
16
17
|
/** Stops descending past this depth, replacing deeper children with a summary line. */
|
|
17
18
|
maxDepth?: number;
|
|
19
|
+
/** Forwarded to pretty-format, which does the printing; `indent` and `min` shape the layout. */
|
|
20
|
+
prettyFormatOptions?: PrettyFormatOptions;
|
|
18
21
|
};
|
|
19
22
|
/**
|
|
20
23
|
* Renders a widget tree as an indented, HTML-like string showing each widget's
|
|
@@ -32,5 +35,5 @@ declare const prettyWidget: (container: Container, options?: PrettyWidgetOptions
|
|
|
32
35
|
* @param options Formatting options passed through to {@link prettyWidget}.
|
|
33
36
|
*/
|
|
34
37
|
declare const logWidget: (container: Container | Container[], options?: PrettyWidgetOptions) => void;
|
|
35
|
-
export {
|
|
38
|
+
export { logWidget, prettyWidget, type PrettyWidgetOptions };
|
|
36
39
|
//# sourceMappingURL=pretty-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pretty-widget.d.ts","sourceRoot":"","sources":["../src/pretty-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pretty-widget.d.ts","sourceRoot":"","sources":["../src/pretty-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAuC,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEtG,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,gBAAgB,CAAC;AAIhF,wFAAwF;AACxF,KAAK,gBAAgB,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC;AAEvD;;;GAGG;AACH,KAAK,mBAAmB,GAAG;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC7C,CAAC;AAqMF;;;;;;;GAOG;AACH,QAAA,MAAM,YAAY,GAAI,WAAW,SAAS,EAAE,UAAS,mBAAwB,KAAG,MAmB/E,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,SAAS,GAAI,WAAW,SAAS,GAAG,SAAS,EAAE,EAAE,UAAU,mBAAmB,KAAG,IAMtF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
package/dist/pretty-widget.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import * as Gtk from "@gtkx/gi/gtk";
|
|
1
2
|
import { sortStringsBy } from "@gtkx/utils";
|
|
3
|
+
import { format } from "@vitest/pretty-format";
|
|
2
4
|
import { formatRole } from "./role-helpers.js";
|
|
3
|
-
import { roots } from "./traversal.js";
|
|
4
|
-
import {
|
|
5
|
+
import { descendants, isOnScreen, roots } from "./traversal.js";
|
|
6
|
+
import { getWidgetText } from "./widget-accessible-properties.js";
|
|
7
|
+
import { getTypeTag } from "./widget-getters.js";
|
|
5
8
|
const DEFAULT_MAX_LENGTH = 7000;
|
|
6
|
-
const INDENT = " ";
|
|
7
|
-
const ansi = {
|
|
8
|
-
cyan: "\u{1B}[36m",
|
|
9
|
-
yellow: "\u{1B}[33m",
|
|
10
|
-
green: "\u{1B}[32m",
|
|
11
|
-
reset: "\u{1B}[0m",
|
|
12
|
-
};
|
|
13
9
|
const buildAttrs = (widget, getId) => {
|
|
14
10
|
const attrs = [];
|
|
15
11
|
if (getId) {
|
|
@@ -26,6 +22,9 @@ const buildAttrs = (widget, getId) => {
|
|
|
26
22
|
if (!widget.getVisible()) {
|
|
27
23
|
attrs.push(["accessible-hidden", "true"]);
|
|
28
24
|
}
|
|
25
|
+
if (!isOnScreen(widget)) {
|
|
26
|
+
attrs.push(["mapped", "false"]);
|
|
27
|
+
}
|
|
29
28
|
const idAttrs = attrs.filter(([key]) => key === "id");
|
|
30
29
|
const otherAttrs = sortStringsBy(attrs.filter(([key]) => key !== "id"), ([key]) => key);
|
|
31
30
|
return [...idAttrs, ...otherAttrs];
|
|
@@ -42,21 +41,11 @@ const isHighlightSupported = () => {
|
|
|
42
41
|
}
|
|
43
42
|
return process.stdout.isTTY;
|
|
44
43
|
};
|
|
45
|
-
const
|
|
46
|
-
if (!isEnabled) {
|
|
47
|
-
const identity = (s) => s;
|
|
48
|
-
return { tag: identity, attr: identity, value: identity };
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
tag: (s) => `${ansi.cyan}${s}${ansi.reset}`,
|
|
52
|
-
attr: (s) => `${ansi.yellow}${s}${ansi.reset}`,
|
|
53
|
-
value: (s) => `${ansi.green}${s}${ansi.reset}`,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
44
|
+
const paint = (color, text) => `${color.open}${text}${color.close}`;
|
|
56
45
|
const escapeAttrValue = (value) => value.replaceAll('"', """);
|
|
57
46
|
const formatAttr = (key, value, colors) => {
|
|
58
47
|
const quoted = `"${escapeAttrValue(value)}"`;
|
|
59
|
-
return ` ${colors.
|
|
48
|
+
return ` ${paint(colors.prop, key)}=${paint(colors.value, quoted)}`;
|
|
60
49
|
};
|
|
61
50
|
const formatAttrs = (attrs, colors) => attrs.map(([key, value]) => formatAttr(key, value, colors)).join("");
|
|
62
51
|
const countChildren = (widget) => {
|
|
@@ -68,53 +57,83 @@ const countChildren = (widget) => {
|
|
|
68
57
|
}
|
|
69
58
|
return count;
|
|
70
59
|
};
|
|
71
|
-
const
|
|
72
|
-
const { getId, colors } = ctx;
|
|
73
|
-
const indent = INDENT.repeat(depth);
|
|
74
|
-
const count = countChildren(widget);
|
|
60
|
+
const depthLimitReason = (widget, getId) => {
|
|
75
61
|
const hint = getId ? ` (pass rootId="${getId(widget)}" or raise maxDepth to expand)` : "";
|
|
62
|
+
return `hidden${hint}`;
|
|
63
|
+
};
|
|
64
|
+
const hasMappedDescendant = (widget) => {
|
|
65
|
+
for (const descendant of descendants(widget)) {
|
|
66
|
+
if (isOnScreen(descendant)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
const collapseReasonFor = (widget, depth, ctx) => {
|
|
73
|
+
if (!widget.getFirstChild()) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (!isOnScreen(widget) && !hasMappedDescendant(widget)) {
|
|
77
|
+
return "not mapped";
|
|
78
|
+
}
|
|
79
|
+
if (ctx.maxDepth !== undefined && depth >= ctx.maxDepth) {
|
|
80
|
+
return depthLimitReason(widget, ctx.getId);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
84
|
+
const formatCollapsedChildrenLine = (widget, indentation, config, reason) => {
|
|
85
|
+
const count = countChildren(widget);
|
|
76
86
|
const plural = count === 1 ? "" : "s";
|
|
77
|
-
const summary = `… ${String(count)} child widget${plural}
|
|
78
|
-
return `${
|
|
87
|
+
const summary = `… ${String(count)} child widget${plural} ${reason}`;
|
|
88
|
+
return `${indentation}${config.indent}${paint(config.colors.tag, summary)}${config.spacingOuter}`;
|
|
79
89
|
};
|
|
80
|
-
const formatChildren = (widget, depth, ctx) => {
|
|
90
|
+
const formatChildren = (widget, indentation, depth, ctx) => {
|
|
81
91
|
let output = "";
|
|
82
92
|
let child = widget.getFirstChild();
|
|
83
93
|
while (child) {
|
|
84
|
-
output += formatWidget(child, depth + 1, ctx);
|
|
94
|
+
output += formatWidget(child, indentation + ctx.config.indent, depth + 1, ctx);
|
|
85
95
|
child = child.getNextSibling();
|
|
86
96
|
}
|
|
87
97
|
return output;
|
|
88
98
|
};
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
output += formatChildren(widget, depth, ctx);
|
|
111
|
-
output += `${indent}${closeTag}\n`;
|
|
112
|
-
return output;
|
|
99
|
+
const formatBody = (widget, indentation, depth, ctx) => {
|
|
100
|
+
const collapseReason = collapseReasonFor(widget, depth, ctx);
|
|
101
|
+
if (collapseReason === null) {
|
|
102
|
+
return formatChildren(widget, indentation, depth, ctx);
|
|
103
|
+
}
|
|
104
|
+
return formatCollapsedChildrenLine(widget, indentation, ctx.config, collapseReason);
|
|
105
|
+
};
|
|
106
|
+
const formatWidget = (widget, indentation, depth, ctx) => {
|
|
107
|
+
const { config } = ctx;
|
|
108
|
+
const tag = getTypeTag(widget);
|
|
109
|
+
const attrs = formatAttrs(buildAttrs(widget, ctx.getId), config.colors);
|
|
110
|
+
const openTag = `${paint(config.colors.tag, "<" + tag)}${attrs}${paint(config.colors.tag, ">")}`;
|
|
111
|
+
const closeTag = paint(config.colors.tag, `</${tag}>`);
|
|
112
|
+
const text = getWidgetText(widget);
|
|
113
|
+
const openLine = `${indentation}${openTag}${config.spacingOuter}`;
|
|
114
|
+
if (!text && !widget.getFirstChild()) {
|
|
115
|
+
return openLine;
|
|
116
|
+
}
|
|
117
|
+
const textLine = text ? `${indentation}${config.indent}${text}${config.spacingOuter}` : "";
|
|
118
|
+
const body = formatBody(widget, indentation, depth, ctx);
|
|
119
|
+
return `${openLine}${textLine}${body}${indentation}${closeTag}${config.spacingOuter}`;
|
|
113
120
|
};
|
|
121
|
+
const createWidgetPlugin = (options) => ({
|
|
122
|
+
test: (value) => value instanceof Gtk.Widget,
|
|
123
|
+
serialize: (widget, config, indentation) => formatWidget(widget, indentation, 0, { getId: options.getId, config, maxDepth: options.maxDepth }),
|
|
124
|
+
});
|
|
114
125
|
const resolveMaxLength = (options) => {
|
|
115
126
|
const envLimit = process.env.DEBUG_PRINT_LIMIT ? Number(process.env.DEBUG_PRINT_LIMIT) : DEFAULT_MAX_LENGTH;
|
|
116
127
|
return options.maxLength ?? envLimit;
|
|
117
128
|
};
|
|
129
|
+
const formatOptions = (options) => {
|
|
130
|
+
const { plugins, ...rest } = options.prettyFormatOptions ?? {};
|
|
131
|
+
return {
|
|
132
|
+
highlight: options.shouldHighlight ?? isHighlightSupported(),
|
|
133
|
+
...rest,
|
|
134
|
+
plugins: [createWidgetPlugin(options), ...(plugins ?? [])],
|
|
135
|
+
};
|
|
136
|
+
};
|
|
118
137
|
/**
|
|
119
138
|
* Renders a widget tree as an indented, HTML-like string showing each widget's
|
|
120
139
|
* tag, accessible attributes, and text content.
|
|
@@ -128,11 +147,10 @@ const prettyWidget = (container, options = {}) => {
|
|
|
128
147
|
if (maxLength === 0) {
|
|
129
148
|
return "";
|
|
130
149
|
}
|
|
131
|
-
const
|
|
132
|
-
const colors = createColors(shouldHighlight);
|
|
150
|
+
const prettyFormatOptions = formatOptions(options);
|
|
133
151
|
let output = "";
|
|
134
152
|
for (const root of roots(container)) {
|
|
135
|
-
output +=
|
|
153
|
+
output += format(root, prettyFormatOptions);
|
|
136
154
|
}
|
|
137
155
|
if (output.length > maxLength) {
|
|
138
156
|
return `${output.slice(0, maxLength)}...`;
|
|
@@ -151,5 +169,5 @@ const logWidget = (container, options) => {
|
|
|
151
169
|
console.log(prettyWidget(target, options));
|
|
152
170
|
}
|
|
153
171
|
};
|
|
154
|
-
export {
|
|
172
|
+
export { logWidget, prettyWidget };
|
|
155
173
|
//# sourceMappingURL=pretty-widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pretty-widget.js","sourceRoot":"","sources":["../src/pretty-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAkB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAgCtE,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,MAAM,IAAI,GAAG;IACT,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,WAAW;CACrB,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,MAAkB,EAAE,KAAmC,EAAsB,EAAE;IAC/F,MAAM,KAAK,GAAuB,EAAE,CAAC;IAErC,IAAI,KAAK,EAAE,CAAC;QACR,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE9B,IAAI,IAA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B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QAC5B,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;IAC9C,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,SAAkC,EAAE,OAA6B,EAAQ,EAAE;IAC1F,MAAM,UAAU,GAAgB,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEnF,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,SAAS,EAA4B,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport { sortStringsBy } from \"@gtkx/utils\";\nimport { formatRole } from \"./role-helpers.js\";\nimport { type Container, roots } from \"./traversal.js\";\nimport { getWidgetNodeText } from \"./widget-accessible-properties.js\";\n\n/** Produces the value of the `id` attribute printed first on a widget's opening tag. */\ntype WidgetIdResolver = (widget: Gtk.Widget) => string;\n\n/**\n * Options controlling how a widget tree is rendered to a string by\n * {@link prettyWidget} and {@link logWidget}.\n */\ntype PrettyWidgetOptions = {\n /** Truncates the output once it exceeds this many characters. */\n maxLength?: number;\n /** Whether to apply ANSI color highlighting; defaults to the terminal capabilities. */\n shouldHighlight?: boolean;\n /** Resolves an `id` attribute to show for each widget. */\n getId?: WidgetIdResolver;\n /** Stops descending past this depth, replacing deeper children with a summary line. */\n maxDepth?: number;\n};\n\ntype Colors = {\n tag: (s: string) => string;\n attr: (s: string) => string;\n value: (s: string) => string;\n};\n\ntype FormatContext = {\n getId: WidgetIdResolver | undefined;\n colors: Colors;\n maxDepth: number | undefined;\n};\n\nconst DEFAULT_MAX_LENGTH = 7000;\nconst INDENT = \" \";\n\nconst ansi = {\n cyan: \"\\u{1B}[36m\",\n yellow: \"\\u{1B}[33m\",\n green: \"\\u{1B}[32m\",\n reset: \"\\u{1B}[0m\",\n};\n\nconst buildAttrs = (widget: Gtk.Widget, getId: WidgetIdResolver | undefined): [string, string][] => {\n const attrs: [string, string][] = [];\n\n if (getId) {\n attrs.push([\"id\", getId(widget)]);\n }\n\n const name = widget.getName();\n\n if (name) {\n attrs.push([\"name\", name]);\n }\n\n attrs.push([\"role\", formatRole(widget.getAccessibleRole())]);\n\n if (!widget.getSensitive()) {\n attrs.push([\"accessible-disabled\", \"true\"]);\n }\n\n if (!widget.getVisible()) {\n attrs.push([\"accessible-hidden\", \"true\"]);\n }\n\n const idAttrs = attrs.filter(([key]) => key === \"id\");\n\n const otherAttrs = sortStringsBy(\n attrs.filter(([key]) => key !== \"id\"),\n ([key]) => key,\n );\n\n return [...idAttrs, ...otherAttrs];\n};\n\nconst isHighlightSupported = (): boolean => {\n if (typeof process === \"undefined\") {\n return false;\n }\n\n if (process.env.COLORS === \"false\" || process.env.NO_COLOR) {\n return false;\n }\n\n if (process.env.COLORS === \"true\" || process.env.FORCE_COLOR) {\n return true;\n }\n\n return process.stdout.isTTY;\n};\n\nconst createColors = (isEnabled: boolean): Colors => {\n if (!isEnabled) {\n const identity = (s: string): string => s;\n\n return { tag: identity, attr: identity, value: identity };\n }\n\n return {\n tag: (s) => `${ansi.cyan}${s}${ansi.reset}`,\n attr: (s) => `${ansi.yellow}${s}${ansi.reset}`,\n value: (s) => `${ansi.green}${s}${ansi.reset}`,\n };\n};\n\nconst escapeAttrValue = (value: string): string => value.replaceAll('\"', \""\");\n\nconst formatAttr = (key: string, value: string, colors: Colors): string => {\n const quoted = `\"${escapeAttrValue(value)}\"`;\n\n return ` ${colors.attr(key)}=${colors.value(quoted)}`;\n};\n\nconst formatAttrs = (attrs: [string, string][], colors: Colors): string =>\n attrs.map(([key, value]) => formatAttr(key, value, colors)).join(\"\");\n\nconst countChildren = (widget: Gtk.Widget): number => {\n let count = 0;\n let child = widget.getFirstChild();\n\n while (child) {\n count += 1;\n child = child.getNextSibling();\n }\n\n return count;\n};\n\nconst formatHiddenChildrenLine = (widget: Gtk.Widget, depth: number, ctx: FormatContext): string => {\n const { getId, colors } = ctx;\n const indent = INDENT.repeat(depth);\n const count = countChildren(widget);\n const hint = getId ? ` (pass rootId=\"${getId(widget)}\" or raise maxDepth to expand)` : \"\";\n const plural = count === 1 ? \"\" : \"s\";\n const summary = `… ${String(count)} child widget${plural} hidden${hint}`;\n\n return `${indent}${INDENT}${colors.tag(summary)}\\n`;\n};\n\nconst formatChildren = (widget: Gtk.Widget, depth: number, ctx: FormatContext): string => {\n let output = \"\";\n let child = widget.getFirstChild();\n\n while (child) {\n output += formatWidget(child, depth + 1, ctx);\n child = child.getNextSibling();\n }\n\n return output;\n};\n\nconst formatWidget = (widget: Gtk.Widget, depth: number, ctx: FormatContext): string => {\n const { getId, colors, maxDepth } = ctx;\n const indent = INDENT.repeat(depth);\n const tag = widget.constructor.name;\n const attrs = formatAttrs(buildAttrs(widget, getId), colors);\n const openTag = `${colors.tag(\"<\")}${colors.tag(tag)}${attrs}${colors.tag(\">\")}`;\n const closeTag = `${colors.tag(\"</\")}${colors.tag(tag)}${colors.tag(\">\")}`;\n const text = getWidgetNodeText(widget);\n const firstChild = widget.getFirstChild();\n\n if (!text && !firstChild) {\n return `${indent}${openTag}\\n`;\n }\n\n let output = `${indent}${openTag}\\n`;\n\n if (text) {\n output += `${indent}${INDENT}${text}\\n`;\n }\n\n if (firstChild && maxDepth !== undefined && depth >= maxDepth) {\n output += formatHiddenChildrenLine(widget, depth, ctx);\n output += `${indent}${closeTag}\\n`;\n\n return output;\n }\n\n output += formatChildren(widget, depth, ctx);\n output += `${indent}${closeTag}\\n`;\n\n return output;\n};\n\nconst resolveMaxLength = (options: PrettyWidgetOptions): number => {\n const envLimit = process.env.DEBUG_PRINT_LIMIT ? Number(process.env.DEBUG_PRINT_LIMIT) : DEFAULT_MAX_LENGTH;\n\n return options.maxLength ?? envLimit;\n};\n\n/**\n * Renders a widget tree as an indented, HTML-like string showing each widget's\n * tag, accessible attributes, and text content.\n *\n * @param container The scope whose widget tree is formatted.\n * @param options Formatting options such as truncation length and highlighting.\n * @returns The formatted representation of the tree.\n */\nconst prettyWidget = (container: Container, options: PrettyWidgetOptions = {}): string => {\n const maxLength = resolveMaxLength(options);\n\n if (maxLength === 0) {\n return \"\";\n }\n\n const shouldHighlight = options.shouldHighlight ?? isHighlightSupported();\n const colors = createColors(shouldHighlight);\n let output = \"\";\n\n for (const root of roots(container)) {\n output += formatWidget(root, 0, { getId: options.getId, colors, maxDepth: options.maxDepth });\n }\n\n if (output.length > maxLength) {\n return `${output.slice(0, maxLength)}...`;\n }\n\n return output.trimEnd();\n};\n\n/**\n * Prints one or more widget trees to the console using {@link prettyWidget}.\n *\n * @param container A single scope or an array of scopes to format and print.\n * @param options Formatting options passed through to {@link prettyWidget}.\n */\nconst logWidget = (container: Container | Container[], options?: PrettyWidgetOptions): void => {\n const containers: Container[] = Array.isArray(container) ? container : [container];\n\n for (const target of containers) {\n console.log(prettyWidget(target, options));\n }\n};\n\nexport { prettyWidget, logWidget, type PrettyWidgetOptions };\n"]}
|
|
1
|
+
{"version":3,"file":"pretty-widget.js","sourceRoot":"","sources":["../src/pretty-widget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa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AAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEnF,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,YAAY,EAA4B,CAAC","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\";\nimport { sortStringsBy } from \"@gtkx/utils\";\nimport { type Config, format, type NewPlugin, type PrettyFormatOptions } from \"@vitest/pretty-format\";\nimport { formatRole } from \"./role-helpers.js\";\nimport { type Container, descendants, isOnScreen, roots } from \"./traversal.js\";\nimport { getWidgetText } from \"./widget-accessible-properties.js\";\nimport { getTypeTag } from \"./widget-getters.js\";\n\n/** Produces the value of the `id` attribute printed first on a widget's opening tag. */\ntype WidgetIdResolver = (widget: Gtk.Widget) => string;\n\n/**\n * Options controlling how a widget tree is rendered to a string by\n * {@link prettyWidget} and {@link logWidget}.\n */\ntype PrettyWidgetOptions = {\n /** Truncates the output once it exceeds this many characters. */\n maxLength?: number;\n /** Whether to apply ANSI color highlighting; defaults to the terminal capabilities. */\n shouldHighlight?: boolean;\n /** Resolves an `id` attribute to show for each widget. */\n getId?: WidgetIdResolver;\n /** Stops descending past this depth, replacing deeper children with a summary line. */\n maxDepth?: number;\n /** Forwarded to pretty-format, which does the printing; `indent` and `min` shape the layout. */\n prettyFormatOptions?: PrettyFormatOptions;\n};\n\ntype Color = { open: string; close: string };\n\ntype FormatContext = {\n getId: WidgetIdResolver | undefined;\n config: Config;\n maxDepth: number | undefined;\n};\n\nconst DEFAULT_MAX_LENGTH = 7000;\n\nconst buildAttrs = (widget: Gtk.Widget, getId: WidgetIdResolver | undefined): [string, string][] => {\n const attrs: [string, string][] = [];\n\n if (getId) {\n attrs.push([\"id\", getId(widget)]);\n }\n\n const name = widget.getName();\n\n if (name) {\n attrs.push([\"name\", name]);\n }\n\n attrs.push([\"role\", formatRole(widget.getAccessibleRole())]);\n\n if (!widget.getSensitive()) {\n attrs.push([\"accessible-disabled\", \"true\"]);\n }\n\n if (!widget.getVisible()) {\n attrs.push([\"accessible-hidden\", \"true\"]);\n }\n\n if (!isOnScreen(widget)) {\n attrs.push([\"mapped\", \"false\"]);\n }\n\n const idAttrs = attrs.filter(([key]) => key === \"id\");\n\n const otherAttrs = sortStringsBy(\n attrs.filter(([key]) => key !== \"id\"),\n ([key]) => key,\n );\n\n return [...idAttrs, ...otherAttrs];\n};\n\nconst isHighlightSupported = (): boolean => {\n if (typeof process === \"undefined\") {\n return false;\n }\n\n if (process.env.COLORS === \"false\" || process.env.NO_COLOR) {\n return false;\n }\n\n if (process.env.COLORS === \"true\" || process.env.FORCE_COLOR) {\n return true;\n }\n\n return process.stdout.isTTY;\n};\n\nconst paint = (color: Color, text: string): string => `${color.open}${text}${color.close}`;\nconst escapeAttrValue = (value: string): string => value.replaceAll('\"', \""\");\n\nconst formatAttr = (key: string, value: string, colors: Config[\"colors\"]): string => {\n const quoted = `\"${escapeAttrValue(value)}\"`;\n\n return ` ${paint(colors.prop, key)}=${paint(colors.value, quoted)}`;\n};\n\nconst formatAttrs = (attrs: [string, string][], colors: Config[\"colors\"]): string =>\n attrs.map(([key, value]) => formatAttr(key, value, colors)).join(\"\");\n\nconst countChildren = (widget: Gtk.Widget): number => {\n let count = 0;\n let child = widget.getFirstChild();\n\n while (child) {\n count += 1;\n child = child.getNextSibling();\n }\n\n return count;\n};\n\nconst depthLimitReason = (widget: Gtk.Widget, getId: WidgetIdResolver | undefined): string => {\n const hint = getId ? ` (pass rootId=\"${getId(widget)}\" or raise maxDepth to expand)` : \"\";\n\n return `hidden${hint}`;\n};\n\nconst hasMappedDescendant = (widget: Gtk.Widget): boolean => {\n for (const descendant of descendants(widget)) {\n if (isOnScreen(descendant)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst collapseReasonFor = (widget: Gtk.Widget, depth: number, ctx: FormatContext): string | null => {\n if (!widget.getFirstChild()) {\n return null;\n }\n\n if (!isOnScreen(widget) && !hasMappedDescendant(widget)) {\n return \"not mapped\";\n }\n\n if (ctx.maxDepth !== undefined && depth >= ctx.maxDepth) {\n return depthLimitReason(widget, ctx.getId);\n }\n\n return null;\n};\n\nconst formatCollapsedChildrenLine = (\n widget: Gtk.Widget,\n indentation: string,\n config: Config,\n reason: string,\n): string => {\n const count = countChildren(widget);\n const plural = count === 1 ? \"\" : \"s\";\n const summary = `… ${String(count)} child widget${plural} ${reason}`;\n\n return `${indentation}${config.indent}${paint(config.colors.tag, summary)}${config.spacingOuter}`;\n};\n\nconst formatChildren = (widget: Gtk.Widget, indentation: string, depth: number, ctx: FormatContext): string => {\n let output = \"\";\n let child = widget.getFirstChild();\n\n while (child) {\n output += formatWidget(child, indentation + ctx.config.indent, depth + 1, ctx);\n child = child.getNextSibling();\n }\n\n return output;\n};\n\nconst formatBody = (widget: Gtk.Widget, indentation: string, depth: number, ctx: FormatContext): string => {\n const collapseReason = collapseReasonFor(widget, depth, ctx);\n\n if (collapseReason === null) {\n return formatChildren(widget, indentation, depth, ctx);\n }\n\n return formatCollapsedChildrenLine(widget, indentation, ctx.config, collapseReason);\n};\n\nconst formatWidget = (widget: Gtk.Widget, indentation: string, depth: number, ctx: FormatContext): string => {\n const { config } = ctx;\n const tag = getTypeTag(widget);\n const attrs = formatAttrs(buildAttrs(widget, ctx.getId), config.colors);\n const openTag = `${paint(config.colors.tag, \"<\" + tag)}${attrs}${paint(config.colors.tag, \">\")}`;\n const closeTag = paint(config.colors.tag, `</${tag}>`);\n const text = getWidgetText(widget);\n const openLine = `${indentation}${openTag}${config.spacingOuter}`;\n\n if (!text && !widget.getFirstChild()) {\n return openLine;\n }\n\n const textLine = text ? `${indentation}${config.indent}${text}${config.spacingOuter}` : \"\";\n const body = formatBody(widget, indentation, depth, ctx);\n\n return `${openLine}${textLine}${body}${indentation}${closeTag}${config.spacingOuter}`;\n};\n\nconst createWidgetPlugin = (options: PrettyWidgetOptions): NewPlugin => ({\n test: (value: unknown): boolean => value instanceof Gtk.Widget,\n serialize: (widget: Gtk.Widget, config: Config, indentation: string): string =>\n formatWidget(widget, indentation, 0, { getId: options.getId, config, maxDepth: options.maxDepth }),\n});\n\nconst resolveMaxLength = (options: PrettyWidgetOptions): number => {\n const envLimit = process.env.DEBUG_PRINT_LIMIT ? Number(process.env.DEBUG_PRINT_LIMIT) : DEFAULT_MAX_LENGTH;\n\n return options.maxLength ?? envLimit;\n};\n\nconst formatOptions = (options: PrettyWidgetOptions): PrettyFormatOptions => {\n const { plugins, ...rest } = options.prettyFormatOptions ?? {};\n\n return {\n highlight: options.shouldHighlight ?? isHighlightSupported(),\n ...rest,\n plugins: [createWidgetPlugin(options), ...(plugins ?? [])],\n };\n};\n\n/**\n * Renders a widget tree as an indented, HTML-like string showing each widget's\n * tag, accessible attributes, and text content.\n *\n * @param container The scope whose widget tree is formatted.\n * @param options Formatting options such as truncation length and highlighting.\n * @returns The formatted representation of the tree.\n */\nconst prettyWidget = (container: Container, options: PrettyWidgetOptions = {}): string => {\n const maxLength = resolveMaxLength(options);\n\n if (maxLength === 0) {\n return \"\";\n }\n\n const prettyFormatOptions = formatOptions(options);\n let output = \"\";\n\n for (const root of roots(container)) {\n output += format(root, prettyFormatOptions);\n }\n\n if (output.length > maxLength) {\n return `${output.slice(0, maxLength)}...`;\n }\n\n return output.trimEnd();\n};\n\n/**\n * Prints one or more widget trees to the console using {@link prettyWidget}.\n *\n * @param container A single scope or an array of scopes to format and print.\n * @param options Formatting options passed through to {@link prettyWidget}.\n */\nconst logWidget = (container: Container | Container[], options?: PrettyWidgetOptions): void => {\n const containers: Container[] = Array.isArray(container) ? container : [container];\n\n for (const target of containers) {\n console.log(prettyWidget(target, options));\n }\n};\n\nexport { logWidget, prettyWidget, type PrettyWidgetOptions };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type ProductionRenderResult = {
|
|
3
|
+
rerender: (element: ReactNode) => Promise<void>;
|
|
4
|
+
};
|
|
5
|
+
declare const render: (element: ReactNode) => Promise<ProductionRenderResult>;
|
|
6
|
+
declare const cleanup: () => Promise<void>;
|
|
7
|
+
export { cleanup, render };
|
|
8
|
+
//# sourceMappingURL=production.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../src/production.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,sBAAsB,GAAG;IAC1B,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,CAAC;AAgBF,QAAA,MAAM,MAAM,GAAU,SAAS,SAAS,KAAG,OAAO,CAAC,sBAAsB,CAcxE,CAAC;AAEF,QAAA,MAAM,OAAO,QAAa,OAAO,CAAC,IAAI,CAQrC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC"}
|