@gtkx/testing 1.0.0 → 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 +1 -1
- 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/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/frame-sync.d.ts +2 -2
- package/dist/frame-sync.d.ts.map +1 -1
- package/dist/frame-sync.js +10 -10
- package/dist/frame-sync.js.map +1 -1
- package/dist/harness-window.d.ts +2 -1
- package/dist/harness-window.d.ts.map +1 -1
- package/dist/harness-window.js +12 -1
- package/dist/harness-window.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/matchers.d.ts.map +1 -1
- package/dist/matchers.js +22 -2
- package/dist/matchers.js.map +1 -1
- package/dist/pretty-widget.d.ts.map +1 -1
- package/dist/pretty-widget.js +2 -1
- package/dist/pretty-widget.js.map +1 -1
- package/dist/production.d.ts.map +1 -1
- package/dist/production.js +2 -2
- package/dist/production.js.map +1 -1
- package/dist/render.d.ts +12 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +45 -11
- package/dist/render.js.map +1 -1
- package/dist/role-helpers.d.ts.map +1 -1
- package/dist/role-helpers.js +2 -1
- package/dist/role-helpers.js.map +1 -1
- package/dist/screenshot.d.ts.map +1 -1
- package/dist/screenshot.js +8 -14
- 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 +4 -1
- package/dist/traversal.d.ts.map +1 -1
- package/dist/traversal.js +16 -1
- package/dist/traversal.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/user-event/adjustment.d.ts.map +1 -1
- package/dist/user-event/adjustment.js +2 -1
- package/dist/user-event/adjustment.js.map +1 -1
- package/dist/user-event/click.d.ts +5 -4
- package/dist/user-event/click.d.ts.map +1 -1
- package/dist/user-event/click.js +5 -4
- package/dist/user-event/click.js.map +1 -1
- package/dist/user-event/column-header-click.d.ts.map +1 -1
- package/dist/user-event/column-header-click.js +2 -12
- package/dist/user-event/column-header-click.js.map +1 -1
- package/dist/user-event/event-wrapper.d.ts.map +1 -1
- package/dist/user-event/event-wrapper.js +34 -21
- package/dist/user-event/event-wrapper.js.map +1 -1
- package/dist/user-event/index.d.ts +36 -10
- package/dist/user-event/index.d.ts.map +1 -1
- package/dist/user-event/index.js +4 -3
- package/dist/user-event/index.js.map +1 -1
- package/dist/user-event/keyboard.d.ts.map +1 -1
- package/dist/user-event/keyboard.js +93 -38
- package/dist/user-event/keyboard.js.map +1 -1
- package/dist/user-event/list-row-click.d.ts.map +1 -1
- package/dist/user-event/list-row-click.js +4 -5
- package/dist/user-event/list-row-click.js.map +1 -1
- package/dist/user-event/native-click.d.ts.map +1 -1
- package/dist/user-event/native-click.js +4 -0
- package/dist/user-event/native-click.js.map +1 -1
- 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/text.d.ts +6 -3
- package/dist/user-event/text.d.ts.map +1 -1
- package/dist/user-event/text.js +88 -33
- 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-getters.d.ts +4 -1
- package/dist/widget-getters.d.ts.map +1 -1
- package/dist/widget-getters.js +29 -2
- package/dist/widget-getters.js.map +1 -1
- 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/package.json +15 -7
- package/src/act.ts +1 -1
- package/src/config.ts +10 -1
- package/src/frame-sync.ts +15 -10
- package/src/harness-window.ts +15 -1
- package/src/internal.ts +1 -0
- package/src/matchers.ts +29 -2
- package/src/pretty-widget.ts +2 -1
- package/src/production.ts +2 -3
- package/src/render.tsx +67 -12
- package/src/role-helpers.ts +2 -1
- package/src/screenshot.ts +9 -16
- package/src/timers.ts +31 -0
- package/src/traversal.ts +22 -0
- package/src/types.ts +6 -1
- package/src/user-event/adjustment.ts +2 -1
- package/src/user-event/click.ts +5 -4
- package/src/user-event/column-header-click.ts +2 -16
- package/src/user-event/event-wrapper.ts +41 -25
- package/src/user-event/index.ts +40 -13
- package/src/user-event/keyboard.ts +124 -54
- package/src/user-event/list-row-click.ts +4 -7
- package/src/user-event/native-click.ts +5 -0
- package/src/user-event/notebook-tab-click.ts +57 -0
- package/src/user-event/text.ts +113 -38
- package/src/wait-for.ts +4 -4
- package/src/widget-getters.ts +55 -2
- package/src/window-state.ts +70 -0
package/dist/matchers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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M,KAAK,SAAS,CAAC;QAEtD,OAAO;YACH,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,GAAG,EAAE,CACV,YAAY,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,+BAA+B;gBAC1F,IAAI,MAAM,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;SAClE,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CACV,YAAY,cAAc,CAAC,MAAM,CAAC,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\";\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) : `<${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 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 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 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"]}
|
|
1
|
+
{"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,M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/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"]}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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
|
@@ -4,6 +4,7 @@ import { format } from "@vitest/pretty-format";
|
|
|
4
4
|
import { formatRole } from "./role-helpers.js";
|
|
5
5
|
import { descendants, isOnScreen, roots } from "./traversal.js";
|
|
6
6
|
import { getWidgetText } from "./widget-accessible-properties.js";
|
|
7
|
+
import { getTypeTag } from "./widget-getters.js";
|
|
7
8
|
const DEFAULT_MAX_LENGTH = 7000;
|
|
8
9
|
const buildAttrs = (widget, getId) => {
|
|
9
10
|
const attrs = [];
|
|
@@ -104,7 +105,7 @@ const formatBody = (widget, indentation, depth, ctx) => {
|
|
|
104
105
|
};
|
|
105
106
|
const formatWidget = (widget, indentation, depth, ctx) => {
|
|
106
107
|
const { config } = ctx;
|
|
107
|
-
const tag = widget
|
|
108
|
+
const tag = getTypeTag(widget);
|
|
108
109
|
const attrs = formatAttrs(buildAttrs(widget, ctx.getId), config.colors);
|
|
109
110
|
const openTag = `${paint(config.colors.tag, "<" + tag)}${attrs}${paint(config.colors.tag, ">")}`;
|
|
110
111
|
const closeTag = paint(config.colors.tag, `</${tag}>`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pretty-widget.js","source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B,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,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\";\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 = widget.constructor.name;\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"]}
|
|
1
|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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,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"]}
|
package/dist/production.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production.d.ts","sourceRoot":"","sources":["../src/production.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
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"}
|
package/dist/production.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRoot } from "@gtkx/react";
|
|
2
2
|
import { createHarnessWindow } from "./harness-window.js";
|
|
3
|
+
import { delay } from "./timers.js";
|
|
3
4
|
const SETTLE_TURNS = 3;
|
|
4
5
|
const activeRenders = new Set();
|
|
5
|
-
const turn = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
6
6
|
const settle = async () => {
|
|
7
7
|
for (let index = 0; index < SETTLE_TURNS; index++) {
|
|
8
|
-
await
|
|
8
|
+
await delay(0);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
const render = async (element) => {
|
package/dist/production.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production.js","sourceRoot":"","sources":["../src/production.ts"],"names":[],"mappings":"AAEA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AM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IAED,aAAa,CAAC,KAAK,EAAE,CAAC;IACtB,MAAM,MAAM,EAAE,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ReactNode } from \"react\";\nimport { createRoot, type Root } from \"@gtkx/react\";\nimport { createHarnessWindow } from \"./harness-window.js\";\nimport { delay } from \"./timers.js\";\n\ntype ProductionRenderResult = {\n rerender: (element: ReactNode) => Promise<void>;\n};\n\ntype ActiveRender = {\n root: Root;\n window: Gtk.Window;\n};\n\nconst SETTLE_TURNS = 3;\nconst activeRenders: Set<ActiveRender> = new Set();\n\nconst settle = async (): Promise<void> => {\n for (let index = 0; index < SETTLE_TURNS; index++) {\n await delay(0);\n }\n};\n\nconst render = async (element: ReactNode): Promise<ProductionRenderResult> => {\n const window = createHarnessWindow();\n const root = createRoot(window);\n activeRenders.add({ root, window });\n root.render(element);\n window.present();\n await settle();\n\n return {\n rerender: async (next: ReactNode): Promise<void> => {\n root.render(next);\n await settle();\n },\n };\n};\n\nconst cleanup = async (): Promise<void> => {\n for (const active of activeRenders) {\n active.root.unmount();\n active.window.destroy();\n }\n\n activeRenders.clear();\n await settle();\n};\n\nexport { cleanup, render };\n"]}
|
package/dist/render.d.ts
CHANGED
|
@@ -4,11 +4,22 @@ import type { QueryMap, RenderOptions } from "./types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Renders a React element into a GTK4 widget tree and returns queries
|
|
6
6
|
* scoped to it along with controls for rerendering and unmounting. When no
|
|
7
|
-
* container is supplied, a harness window is created and presented
|
|
7
|
+
* container is supplied, a harness window is created and presented, and the editable it hands the
|
|
8
|
+
* focus to keeps its text unselected, with its caret at the end. The returned promise settles once
|
|
9
|
+
* the window the tree is shown in has been laid out and activation has arrived, so platform state
|
|
10
|
+
* such as focus is already readable when it resolves. A presented harness window is waited on until
|
|
11
|
+
* it is itself active; a window the caller or the tree owns is waited on until the application holds
|
|
12
|
+
* activation, since only a present can claim it. Rendering into a container that is not shown waits
|
|
13
|
+
* for nothing, and a window that never becomes readable within `windowActivationTimeout` throws an
|
|
14
|
+
* error naming the condition that failed rather than resolving with unreadable platform state. A
|
|
15
|
+
* tree mounted into a container that sits outside every toplevel, or inside a window that is not
|
|
16
|
+
* visible, is out of reach of a pointer and a keyboard, so every `userEvent` helper aimed at it
|
|
17
|
+
* rejects after `actionabilityTimeout` naming that condition, and `fireEvent` drives it instead.
|
|
8
18
|
*
|
|
9
19
|
* @param element The React element to render.
|
|
10
20
|
* @param options Optional container, wrapper, custom queries, and other render settings.
|
|
11
21
|
* @returns A render result with bound queries, debug helpers, and lifecycle controls.
|
|
22
|
+
* @throws When the window the tree is shown in is not laid out and activated in time.
|
|
12
23
|
*/
|
|
13
24
|
declare const render: <Q extends QueryMap = Record<never, never>>(element: ReactNode, options?: RenderOptions<Q>) => Promise<RenderResult<Q>>;
|
|
14
25
|
/**
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.tsx"],"names":[],"mappings":"AASA,OAAO,EAAkB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.tsx"],"names":[],"mappings":"AASA,OAAO,EAAkB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAgM7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,GAAU,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3D,SAAS,SAAS,EAClB,UAAU,aAAa,CAAC,CAAC,CAAC,KAC3B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAoDzB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,OAAO,QAAa,OAAO,CAAC,IAAI,CAErC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/render.js
CHANGED
|
@@ -4,23 +4,31 @@ import { createReconcilerRoot, isRootElement, setReconcilerErrorHandler, settleA
|
|
|
4
4
|
import { StrictMode } from "react";
|
|
5
5
|
import { runInAct } from "./act.js";
|
|
6
6
|
import { addToCleanupQueue, runCleanup } from "./cleanup-registry.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { getConfig } from "./config.js";
|
|
8
|
+
import { scheduleWhenWindowReady } from "./frame-sync.js";
|
|
9
|
+
import { createHarnessWindow, presentHarnessWindow } from "./harness-window.js";
|
|
9
10
|
import { logWidget } from "./pretty-widget.js";
|
|
10
11
|
import { logRoles } from "./role-helpers.js";
|
|
11
12
|
import { clearScreen, setScreen } from "./screen.js";
|
|
12
13
|
import { captureScreen } from "./screenshot.js";
|
|
13
14
|
import { roots, TOPLEVELS } from "./traversal.js";
|
|
14
15
|
import { resetClipboard } from "./user-event/index.js";
|
|
16
|
+
import { findPresentedWindowFailure, findRenderedWindowFailure, mappedToplevels } from "./window-state.js";
|
|
15
17
|
import { within } from "./within.js";
|
|
16
18
|
const reconcilerErrors = { lastError: null, isHandlerInstalled: false };
|
|
17
19
|
const activeRenders = new Set();
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const settleWindow = async (window, findFailure, action) => {
|
|
21
|
+
const timeout = getConfig().windowActivationTimeout;
|
|
22
|
+
await new Promise((resolve) => {
|
|
23
|
+
scheduleWhenWindowReady(window, (target) => findFailure(target) === null, timeout, resolve);
|
|
22
24
|
});
|
|
23
|
-
|
|
25
|
+
settleAccessible();
|
|
26
|
+
const failure = window === null ? null : findFailure(window);
|
|
27
|
+
if (failure !== null) {
|
|
28
|
+
throw new Error(`${action} timed out after ${String(timeout)}ms waiting for the window it rendered into: ${failure}. ` +
|
|
29
|
+
"Platform state such as focus is only readable once that window is allocated and active.");
|
|
30
|
+
}
|
|
31
|
+
};
|
|
24
32
|
const update = async (element, root) => {
|
|
25
33
|
await runInAct(() => {
|
|
26
34
|
root.update(element);
|
|
@@ -85,6 +93,21 @@ const resolveResultContainer = (resolved, container, baseElement) => {
|
|
|
85
93
|
}
|
|
86
94
|
return firstToplevelWidget(baseElement);
|
|
87
95
|
};
|
|
96
|
+
const realizedWindow = (root) => root instanceof Gtk.Window && root.getFrameClock() !== null ? root : null;
|
|
97
|
+
const settleTarget = (resolved, container) => {
|
|
98
|
+
if (resolved.window) {
|
|
99
|
+
return realizedWindow(resolved.window);
|
|
100
|
+
}
|
|
101
|
+
if (container instanceof Gtk.Widget) {
|
|
102
|
+
return realizedWindow(container.getRoot());
|
|
103
|
+
}
|
|
104
|
+
return realizedWindow(mappedToplevels()[0] ?? null);
|
|
105
|
+
};
|
|
106
|
+
const settleRender = async (resolved, container, action) => {
|
|
107
|
+
const isPresentedNow = action === "render" && resolved.window !== null;
|
|
108
|
+
const findFailure = isPresentedNow ? findPresentedWindowFailure : findRenderedWindowFailure;
|
|
109
|
+
await settleWindow(settleTarget(resolved, container), findFailure, action);
|
|
110
|
+
};
|
|
88
111
|
const renderErrorHandlers = (options) => ({
|
|
89
112
|
onUncaughtError: handleError,
|
|
90
113
|
onCaughtError: (error, errorInfo) => {
|
|
@@ -104,11 +127,22 @@ const applyEnableAnimations = (areAnimationsEnabled) => {
|
|
|
104
127
|
/**
|
|
105
128
|
* Renders a React element into a GTK4 widget tree and returns queries
|
|
106
129
|
* scoped to it along with controls for rerendering and unmounting. When no
|
|
107
|
-
* container is supplied, a harness window is created and presented
|
|
130
|
+
* container is supplied, a harness window is created and presented, and the editable it hands the
|
|
131
|
+
* focus to keeps its text unselected, with its caret at the end. The returned promise settles once
|
|
132
|
+
* the window the tree is shown in has been laid out and activation has arrived, so platform state
|
|
133
|
+
* such as focus is already readable when it resolves. A presented harness window is waited on until
|
|
134
|
+
* it is itself active; a window the caller or the tree owns is waited on until the application holds
|
|
135
|
+
* activation, since only a present can claim it. Rendering into a container that is not shown waits
|
|
136
|
+
* for nothing, and a window that never becomes readable within `windowActivationTimeout` throws an
|
|
137
|
+
* error naming the condition that failed rather than resolving with unreadable platform state. A
|
|
138
|
+
* tree mounted into a container that sits outside every toplevel, or inside a window that is not
|
|
139
|
+
* visible, is out of reach of a pointer and a keyboard, so every `userEvent` helper aimed at it
|
|
140
|
+
* rejects after `actionabilityTimeout` naming that condition, and `fireEvent` drives it instead.
|
|
108
141
|
*
|
|
109
142
|
* @param element The React element to render.
|
|
110
143
|
* @param options Optional container, wrapper, custom queries, and other render settings.
|
|
111
144
|
* @returns A render result with bound queries, debug helpers, and lifecycle controls.
|
|
145
|
+
* @throws When the window the tree is shown in is not laid out and activated in time.
|
|
112
146
|
*/
|
|
113
147
|
const render = async (element, options) => {
|
|
114
148
|
installErrorHandler();
|
|
@@ -130,8 +164,8 @@ const render = async (element, options) => {
|
|
|
130
164
|
return options?.isReactStrictMode ? _jsx(StrictMode, { children: wrapped }) : wrapped;
|
|
131
165
|
};
|
|
132
166
|
await update(wrap(element), root);
|
|
133
|
-
resolved.window
|
|
134
|
-
await
|
|
167
|
+
presentHarnessWindow(resolved.window);
|
|
168
|
+
await settleRender(resolved, options?.container, "render");
|
|
135
169
|
const container = resolveResultContainer(resolved, options?.container, baseElement);
|
|
136
170
|
const result = {
|
|
137
171
|
...within(baseElement, options?.queries),
|
|
@@ -142,7 +176,7 @@ const render = async (element, options) => {
|
|
|
142
176
|
},
|
|
143
177
|
rerender: async (newElement) => {
|
|
144
178
|
await update(wrap(newElement), root);
|
|
145
|
-
await
|
|
179
|
+
await settleRender(resolved, options?.container, "rerender");
|
|
146
180
|
},
|
|
147
181
|
debug: (element = baseElement, debugOptions) => {
|
|
148
182
|
logWidget(element, debugOptions);
|