@gtkx/testing 0.20.0 → 1.0.0-rc.1

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.
Files changed (216) hide show
  1. package/README.md +122 -55
  2. package/dist/act.d.ts +19 -0
  3. package/dist/act.d.ts.map +1 -0
  4. package/dist/act.js +48 -0
  5. package/dist/act.js.map +1 -0
  6. package/dist/bound-queries.d.ts +32 -0
  7. package/dist/bound-queries.d.ts.map +1 -0
  8. package/dist/bound-queries.js +2 -0
  9. package/dist/bound-queries.js.map +1 -0
  10. package/dist/build-queries.d.ts +16 -0
  11. package/dist/build-queries.d.ts.map +1 -0
  12. package/dist/build-queries.js +103 -0
  13. package/dist/build-queries.js.map +1 -0
  14. package/dist/cleanup-registry.d.ts +4 -0
  15. package/dist/cleanup-registry.d.ts.map +1 -0
  16. package/dist/cleanup-registry.js +11 -0
  17. package/dist/cleanup-registry.js.map +1 -0
  18. package/dist/config.d.ts +18 -51
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +9 -40
  21. package/dist/config.js.map +1 -1
  22. package/dist/editable.d.ts +7 -0
  23. package/dist/editable.d.ts.map +1 -0
  24. package/dist/editable.js +24 -0
  25. package/dist/editable.js.map +1 -0
  26. package/dist/errors.d.ts +29 -0
  27. package/dist/errors.d.ts.map +1 -0
  28. package/dist/errors.js +119 -0
  29. package/dist/errors.js.map +1 -0
  30. package/dist/fire-event.d.ts +7 -25
  31. package/dist/fire-event.d.ts.map +1 -1
  32. package/dist/fire-event.js +9 -29
  33. package/dist/fire-event.js.map +1 -1
  34. package/dist/frame-sync.d.ts +3 -0
  35. package/dist/frame-sync.d.ts.map +1 -0
  36. package/dist/frame-sync.js +30 -0
  37. package/dist/frame-sync.js.map +1 -0
  38. package/dist/index.d.ts +16 -11
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +10 -6
  41. package/dist/index.js.map +1 -1
  42. package/dist/matchers.d.ts +55 -0
  43. package/dist/matchers.d.ts.map +1 -0
  44. package/dist/matchers.js +103 -0
  45. package/dist/matchers.js.map +1 -0
  46. package/dist/pretty-widget.d.ts +21 -25
  47. package/dist/pretty-widget.d.ts.map +1 -1
  48. package/dist/pretty-widget.js +69 -115
  49. package/dist/pretty-widget.js.map +1 -1
  50. package/dist/queries.d.ts +130 -177
  51. package/dist/queries.d.ts.map +1 -1
  52. package/dist/queries.js +212 -325
  53. package/dist/queries.js.map +1 -1
  54. package/dist/register-test-hooks.d.ts +2 -0
  55. package/dist/register-test-hooks.d.ts.map +1 -0
  56. package/dist/register-test-hooks.js +15 -0
  57. package/dist/register-test-hooks.js.map +1 -0
  58. package/dist/render-hook.d.ts +14 -35
  59. package/dist/render-hook.d.ts.map +1 -1
  60. package/dist/render-hook.js +8 -45
  61. package/dist/render-hook.js.map +1 -1
  62. package/dist/render.d.ts +11 -41
  63. package/dist/render.d.ts.map +1 -1
  64. package/dist/render.js +129 -118
  65. package/dist/render.js.map +1 -1
  66. package/dist/role-helpers.d.ts +16 -51
  67. package/dist/role-helpers.d.ts.map +1 -1
  68. package/dist/role-helpers.js +39 -58
  69. package/dist/role-helpers.js.map +1 -1
  70. package/dist/screen.d.ts +6 -63
  71. package/dist/screen.d.ts.map +1 -1
  72. package/dist/screen.js +21 -109
  73. package/dist/screen.js.map +1 -1
  74. package/dist/screenshot.d.ts +20 -23
  75. package/dist/screenshot.d.ts.map +1 -1
  76. package/dist/screenshot.js +89 -48
  77. package/dist/screenshot.js.map +1 -1
  78. package/dist/suggestions.d.ts +22 -0
  79. package/dist/suggestions.d.ts.map +1 -0
  80. package/dist/suggestions.js +56 -0
  81. package/dist/suggestions.js.map +1 -0
  82. package/dist/traversal.d.ts +10 -8
  83. package/dist/traversal.d.ts.map +1 -1
  84. package/dist/traversal.js +28 -13
  85. package/dist/traversal.js.map +1 -1
  86. package/dist/types.d.ts +103 -172
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/types.js.map +1 -1
  89. package/dist/user-event/adjustment.d.ts +8 -0
  90. package/dist/user-event/adjustment.d.ts.map +1 -0
  91. package/dist/user-event/adjustment.js +33 -0
  92. package/dist/user-event/adjustment.js.map +1 -0
  93. package/dist/user-event/click.d.ts +7 -0
  94. package/dist/user-event/click.d.ts.map +1 -0
  95. package/dist/user-event/click.js +65 -0
  96. package/dist/user-event/click.js.map +1 -0
  97. package/dist/user-event/controller.d.ts +7 -0
  98. package/dist/user-event/controller.d.ts.map +1 -0
  99. package/dist/user-event/controller.js +28 -0
  100. package/dist/user-event/controller.js.map +1 -0
  101. package/dist/user-event/dispatch.d.ts +7 -0
  102. package/dist/user-event/dispatch.d.ts.map +1 -0
  103. package/dist/user-event/dispatch.js +10 -0
  104. package/dist/user-event/dispatch.js.map +1 -0
  105. package/dist/user-event/event-wrapper.d.ts +3 -0
  106. package/dist/user-event/event-wrapper.d.ts.map +1 -0
  107. package/dist/user-event/event-wrapper.js +48 -0
  108. package/dist/user-event/event-wrapper.js.map +1 -0
  109. package/dist/user-event/gesture.d.ts +31 -0
  110. package/dist/user-event/gesture.d.ts.map +1 -0
  111. package/dist/user-event/gesture.js +105 -0
  112. package/dist/user-event/gesture.js.map +1 -0
  113. package/dist/user-event/index.d.ts +44 -0
  114. package/dist/user-event/index.d.ts.map +1 -0
  115. package/dist/user-event/index.js +38 -0
  116. package/dist/user-event/index.js.map +1 -0
  117. package/dist/user-event/keyboard.d.ts +9 -0
  118. package/dist/user-event/keyboard.d.ts.map +1 -0
  119. package/dist/user-event/keyboard.js +173 -0
  120. package/dist/user-event/keyboard.js.map +1 -0
  121. package/dist/user-event/pointer.d.ts +6 -0
  122. package/dist/user-event/pointer.d.ts.map +1 -0
  123. package/dist/user-event/pointer.js +27 -0
  124. package/dist/user-event/pointer.js.map +1 -0
  125. package/dist/user-event/selection.d.ts +4 -0
  126. package/dist/user-event/selection.d.ts.map +1 -0
  127. package/dist/user-event/selection.js +106 -0
  128. package/dist/user-event/selection.js.map +1 -0
  129. package/dist/user-event/state.d.ts +6 -0
  130. package/dist/user-event/state.d.ts.map +1 -0
  131. package/dist/user-event/state.js +2 -0
  132. package/dist/user-event/state.js.map +1 -0
  133. package/dist/user-event/text.d.ts +17 -0
  134. package/dist/user-event/text.d.ts.map +1 -0
  135. package/dist/user-event/text.js +107 -0
  136. package/dist/user-event/text.js.map +1 -0
  137. package/dist/wait-for.d.ts +13 -32
  138. package/dist/wait-for.d.ts.map +1 -1
  139. package/dist/wait-for.js +62 -73
  140. package/dist/wait-for.js.map +1 -1
  141. package/dist/widget-accessible-properties.d.ts +33 -0
  142. package/dist/widget-accessible-properties.d.ts.map +1 -0
  143. package/dist/widget-accessible-properties.js +215 -0
  144. package/dist/widget-accessible-properties.js.map +1 -0
  145. package/dist/within.d.ts +9 -26
  146. package/dist/within.d.ts.map +1 -1
  147. package/dist/within.js +15 -25
  148. package/dist/within.js.map +1 -1
  149. package/package.json +21 -12
  150. package/src/act.ts +68 -0
  151. package/src/bound-queries.ts +36 -0
  152. package/src/build-queries.ts +185 -0
  153. package/src/cleanup-registry.ts +14 -0
  154. package/src/config.ts +28 -59
  155. package/src/editable.ts +30 -0
  156. package/src/errors.ts +130 -0
  157. package/src/fire-event.ts +11 -38
  158. package/src/frame-sync.ts +34 -0
  159. package/src/index.ts +60 -18
  160. package/src/matchers.ts +200 -0
  161. package/src/pretty-widget.ts +99 -138
  162. package/src/queries.ts +321 -425
  163. package/src/register-test-hooks.ts +16 -0
  164. package/src/render-hook.tsx +31 -44
  165. package/src/render.tsx +161 -149
  166. package/src/role-helpers.ts +47 -67
  167. package/src/screen.ts +21 -114
  168. package/src/screenshot.ts +104 -55
  169. package/src/suggestions.ts +87 -0
  170. package/src/traversal.ts +32 -18
  171. package/src/types.ts +115 -176
  172. package/src/user-event/adjustment.ts +49 -0
  173. package/src/user-event/click.ts +70 -0
  174. package/src/user-event/controller.ts +44 -0
  175. package/src/user-event/dispatch.ts +23 -0
  176. package/src/user-event/event-wrapper.ts +54 -0
  177. package/src/user-event/gesture.ts +154 -0
  178. package/src/user-event/index.ts +74 -0
  179. package/src/user-event/keyboard.ts +204 -0
  180. package/src/user-event/pointer.ts +34 -0
  181. package/src/user-event/selection.ts +122 -0
  182. package/src/user-event/state.ts +6 -0
  183. package/src/user-event/text.ts +137 -0
  184. package/src/wait-for.ts +79 -80
  185. package/src/widget-accessible-properties.ts +244 -0
  186. package/src/within.ts +26 -27
  187. package/dist/bind-queries.d.ts +0 -14
  188. package/dist/bind-queries.d.ts.map +0 -1
  189. package/dist/bind-queries.js +0 -29
  190. package/dist/bind-queries.js.map +0 -1
  191. package/dist/error-builder.d.ts +0 -28
  192. package/dist/error-builder.d.ts.map +0 -1
  193. package/dist/error-builder.js +0 -81
  194. package/dist/error-builder.js.map +0 -1
  195. package/dist/timing.d.ts +0 -18
  196. package/dist/timing.d.ts.map +0 -1
  197. package/dist/timing.js +0 -18
  198. package/dist/timing.js.map +0 -1
  199. package/dist/user-event.d.ts +0 -138
  200. package/dist/user-event.d.ts.map +0 -1
  201. package/dist/user-event.js +0 -411
  202. package/dist/user-event.js.map +0 -1
  203. package/dist/widget-text.d.ts +0 -69
  204. package/dist/widget-text.d.ts.map +0 -1
  205. package/dist/widget-text.js +0 -177
  206. package/dist/widget-text.js.map +0 -1
  207. package/dist/widget.d.ts +0 -3
  208. package/dist/widget.d.ts.map +0 -1
  209. package/dist/widget.js +0 -13
  210. package/dist/widget.js.map +0 -1
  211. package/src/bind-queries.ts +0 -52
  212. package/src/error-builder.ts +0 -102
  213. package/src/timing.ts +0 -17
  214. package/src/user-event.ts +0 -492
  215. package/src/widget-text.ts +0 -202
  216. package/src/widget.ts +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAkB,OAAO,EAAE,QAAQ,EA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gtk from \"@gtkx/gi/gtk\";\nimport { type BuiltQueries, buildQueries, type QueryAllBy } from \"./build-queries.js\";\nimport { multipleFoundError, notFoundError } from \"./errors.js\";\nimport { type Container, findAll, traverse } from \"./traversal.js\";\nimport type { ByRoleOptions, ByRoleValue, Matcher, MatcherOptions, NormalizerFn, NormalizerOptions } from \"./types.js\";\nimport {\n getWidgetAccessibleName,\n getWidgetBusyState,\n getWidgetCheckedState,\n getWidgetDescription,\n getWidgetDisplayValue,\n getWidgetExpandedState,\n getWidgetLabelledByText,\n getWidgetLabelText,\n getWidgetLevel,\n getWidgetName,\n getWidgetOwnLabel,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetSelectedState,\n getWidgetValue,\n isInaccessible,\n} from \"./widget-accessible-properties.js\";\n\n/**\n * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses runs of whitespace into single spaces.\n * @param options Toggles for trimming and whitespace collapsing.\n * @returns A function that normalizes a string for comparison against a matcher.\n */\nexport const getDefaultNormalizer = ({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerOptions = {}): NormalizerFn => {\n return (text: string): string => {\n let result = text;\n if (trim) {\n result = result.trim();\n }\n\n if (collapseWhitespace) {\n result = result.replaceAll(/\\s+/g, \" \");\n }\n\n return result;\n };\n};\n\nconst buildNormalizer = (options?: MatcherOptions): NormalizerFn => {\n const { normalizer, trim, collapseWhitespace } = options ?? {};\n\n if (!normalizer) {\n return getDefaultNormalizer({ trim, collapseWhitespace });\n }\n\n if (trim !== undefined || collapseWhitespace !== undefined) {\n throw new Error(\n \"trim and collapseWhitespace are not supported with a normalizer. \" +\n \"If you want to use the default trim and collapseWhitespace logic in your normalizer, \" +\n 'use \"getDefaultNormalizer({ trim, collapseWhitespace })\" and compose that into your normalizer',\n );\n }\n\n return normalizer;\n};\n\nconst normalizeText = (text: string, options?: MatcherOptions): string => {\n const normalizer = buildNormalizer(options);\n return normalizer(text);\n};\n\nconst matchText = (actual: string | null, expected: Matcher, widget: Gtk.Widget, options?: MatcherOptions): boolean => {\n if (actual === null) return false;\n\n const normalizedActual = normalizeText(actual, options);\n\n if (typeof expected === \"function\") {\n return expected(normalizedActual, widget);\n }\n\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n return expected.test(normalizedActual);\n }\n\n const normalizedExpected = normalizeText(String(expected), options);\n const exact = options?.exact ?? true;\n return exact\n ? normalizedActual === normalizedExpected\n : normalizedActual.toLowerCase().includes(normalizedExpected.toLowerCase());\n};\n\nconst matchAccessibleName = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n if (options.name === undefined) return true;\n const text = getWidgetAccessibleName(widget);\n return matchText(text, options.name, widget, options);\n};\n\nconst matchAccessibleValue = (widget: Gtk.Widget, value: ByRoleValue, options: ByRoleOptions): boolean => {\n const actual = getWidgetValue(widget);\n if (value.now !== undefined && actual.now !== value.now) return false;\n if (value.min !== undefined && actual.min !== value.min) return false;\n if (value.max !== undefined && actual.max !== value.max) return false;\n if (value.text !== undefined && !matchText(actual.text, value.text, widget, options)) return false;\n return true;\n};\n\nconst matchBooleanStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n if (options.checked !== undefined && getWidgetCheckedState(widget) !== options.checked) return false;\n if (options.pressed !== undefined && getWidgetPressedState(widget) !== options.pressed) return false;\n if (options.expanded !== undefined && getWidgetExpandedState(widget) !== options.expanded) return false;\n if (options.selected !== undefined && getWidgetSelectedState(widget) !== options.selected) return false;\n if (options.busy !== undefined && (getWidgetBusyState(widget) ?? false) !== options.busy) return false;\n return true;\n};\n\nconst matchAccessibleStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {\n if (!matchBooleanStates(widget, options)) return false;\n if (options.level !== undefined && getWidgetLevel(widget) !== options.level) return false;\n if (\n options.description !== undefined &&\n !matchText(getWidgetDescription(widget), options.description, widget, options)\n )\n return false;\n if (options.value !== undefined && !matchAccessibleValue(widget, options.value, options)) return false;\n return true;\n};\n\nconst matchByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {\n if (!options) return true;\n return matchAccessibleName(widget, options) && matchAccessibleStates(widget, options);\n};\n\ntype NamedFamily<Suffix extends string, Args extends unknown[]> = {\n [P in `queryBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget | null;\n} & {\n [P in `queryAllBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget[];\n} & {\n [P in `getBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget;\n} & {\n [P in `getAllBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget[];\n} & {\n [P in `findBy${Suffix}`]: (container: Container, ...args: Args) => Promise<Gtk.Widget>;\n} & {\n [P in `findAllBy${Suffix}`]: (container: Container, ...args: Args) => Promise<Gtk.Widget[]>;\n};\n\nconst nameQueryFamily = <Suffix extends string, Args extends unknown[]>(\n suffix: Suffix,\n queryAllBy: QueryAllBy<Args>,\n built: BuiltQueries<Args>,\n): NamedFamily<Suffix, Args> => {\n const family = {\n [`queryBy${suffix}`]: built.queryBy,\n [`queryAllBy${suffix}`]: queryAllBy,\n [`getBy${suffix}`]: built.getBy,\n [`getAllBy${suffix}`]: built.getAllBy,\n [`findBy${suffix}`]: built.findBy,\n [`findAllBy${suffix}`]: built.findAllBy,\n };\n return family as NamedFamily<Suffix, Args>;\n};\n\n/**\n * Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.\n * Widgets excluded from the accessibility tree are skipped unless `options.hidden` is set.\n * @param container Widget subtree to search.\n * @param role Accessible role to match.\n * @param options Additional accessible name, state, and value constraints.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByRole = (container: Container, role: Gtk.AccessibleRole, options?: ByRoleOptions): Gtk.Widget[] =>\n findAll(container, (widget) => {\n if (widget.getAccessibleRole() !== role) return false;\n if (!options?.hidden && isInaccessible(widget)) return false;\n return matchByRoleOptions(widget, options);\n });\n\nconst roleQueries = nameQueryFamily(\n \"Role\",\n queryAllByRole,\n buildQueries<[role: Gtk.AccessibleRole, options?: ByRoleOptions]>(\n \"Role\",\n queryAllByRole,\n (container, matches, role, options) =>\n multipleFoundError(container, { queryType: \"role\", role, options }, matches),\n (container, role, options) => notFoundError(container, { queryType: \"role\", role, options }),\n ),\n);\n\nconst collectMnemonicMatch = (\n widget: Gtk.Widget,\n text: Matcher,\n options: MatcherOptions | undefined,\n): Gtk.Widget | null => {\n if (!(widget instanceof Gtk.Label)) return null;\n const labelText = widget.getLabel();\n if (!labelText || !matchText(labelText, text, widget, options)) return null;\n return widget.getMnemonicWidget();\n};\n\n/**\n * Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the widget's own accessible label, or its labelled-by relation.\n * @param container Widget subtree to search.\n * @param text Matcher for the label text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByLabelText = (container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] => {\n const results = new Set<Gtk.Widget>();\n\n for (const widget of traverse(container)) {\n const mnemonicTarget = collectMnemonicMatch(widget, text, options);\n if (mnemonicTarget) results.add(mnemonicTarget);\n\n const ownLabel = getWidgetOwnLabel(widget);\n if (ownLabel !== null && matchText(ownLabel, text, widget, options)) results.add(widget);\n\n const labelledByText = getWidgetLabelledByText(widget);\n if (labelledByText !== null && matchText(labelledByText, text, widget, options)) results.add(widget);\n }\n\n return [...results];\n};\n\nconst labelTextQueries = nameQueryFamily(\n \"LabelText\",\n queryAllByLabelText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n \"LabelText\",\n queryAllByLabelText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"labelText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"labelText\", text }),\n ),\n);\n\n/**\n * Finds every widget whose rendered text content matches.\n * @param container Widget subtree to search.\n * @param text Matcher for the widget text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByText = (container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] =>\n findAll(container, (widget) => matchText(getWidgetLabelText(widget), text, widget, options));\n\nconst textQueries = nameQueryFamily(\n \"Text\",\n queryAllByText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n \"Text\",\n queryAllByText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"text\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"text\", text }),\n ),\n);\n\n/**\n * Finds every widget whose widget name matches.\n * @param container Widget subtree to search.\n * @param name Matcher for the widget name.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByName = (container: Container, name: Matcher, options?: MatcherOptions): Gtk.Widget[] =>\n findAll(container, (widget) => matchText(getWidgetName(widget), name, widget, options));\n\nconst nameQueries = nameQueryFamily(\n \"Name\",\n queryAllByName,\n buildQueries<[name: Matcher, options?: MatcherOptions]>(\n \"Name\",\n queryAllByName,\n (container, matches, name) => multipleFoundError(container, { queryType: \"name\", name }, matches),\n (container, name) => notFoundError(container, { queryType: \"name\", name }),\n ),\n);\n\n/**\n * Finds every widget whose placeholder text matches.\n * @param container Widget subtree to search.\n * @param text Matcher for the placeholder text.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByPlaceholderText = (\n container: Container,\n text: Matcher,\n options?: MatcherOptions,\n): Gtk.Widget[] => findAll(container, (widget) => matchText(getWidgetPlaceholderText(widget), text, widget, options));\n\nconst placeholderTextQueries = nameQueryFamily(\n \"PlaceholderText\",\n queryAllByPlaceholderText,\n buildQueries<[text: Matcher, options?: MatcherOptions]>(\n \"PlaceholderText\",\n queryAllByPlaceholderText,\n (container, matches, text) => multipleFoundError(container, { queryType: \"placeholderText\", text }, matches),\n (container, text) => notFoundError(container, { queryType: \"placeholderText\", text }),\n ),\n);\n\n/**\n * Finds every widget whose current display value matches.\n * @param container Widget subtree to search.\n * @param value Matcher for the display value.\n * @param options Text matching options.\n * @returns Every matching widget, or an empty array when none match.\n */\nexport const queryAllByDisplayValue = (container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[] =>\n findAll(container, (widget) => matchText(getWidgetDisplayValue(widget), value, widget, options));\n\nconst displayValueQueries = nameQueryFamily(\n \"DisplayValue\",\n queryAllByDisplayValue,\n buildQueries<[value: Matcher, options?: MatcherOptions]>(\n \"DisplayValue\",\n queryAllByDisplayValue,\n (container, matches, value) => multipleFoundError(container, { queryType: \"displayValue\", value }, matches),\n (container, value) => notFoundError(container, { queryType: \"displayValue\", value }),\n ),\n);\n\nexport type BuiltinQueries = NamedFamily<\"Role\", [role: Gtk.AccessibleRole, options?: ByRoleOptions]> &\n NamedFamily<\"LabelText\", [text: Matcher, options?: MatcherOptions]> &\n NamedFamily<\"Text\", [text: Matcher, options?: MatcherOptions]> &\n NamedFamily<\"Name\", [name: Matcher, options?: MatcherOptions]> &\n NamedFamily<\"PlaceholderText\", [text: Matcher, options?: MatcherOptions]> &\n NamedFamily<\"DisplayValue\", [value: Matcher, options?: MatcherOptions]>;\n\nexport const builtinQueries: BuiltinQueries = {\n ...roleQueries,\n ...labelTextQueries,\n ...textQueries,\n ...nameQueries,\n ...placeholderTextQueries,\n ...displayValueQueries,\n};\n\n/** Returns the single widget with a matching accessible role and options, or null when none match. Throws when more than one matches. */\nexport const queryByRole: BuiltinQueries[\"queryByRole\"] = roleQueries.queryByRole;\n/** Returns every widget with a matching accessible role and options. Throws when none match. */\nexport const getAllByRole: BuiltinQueries[\"getAllByRole\"] = roleQueries.getAllByRole;\n/** Returns the single widget with a matching accessible role and options. Throws when none or more than one matches. */\nexport const getByRole: BuiltinQueries[\"getByRole\"] = roleQueries.getByRole;\n/** Waits for and returns every widget with a matching accessible role and options, retrying until at least one appears or the timeout elapses. */\nexport const findAllByRole: BuiltinQueries[\"findAllByRole\"] = roleQueries.findAllByRole;\n/** Waits for and returns the single widget with a matching accessible role and options, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByRole: BuiltinQueries[\"findByRole\"] = roleQueries.findByRole;\n\n/** Returns the single widget with matching associated label text, or null when none match. Throws when more than one matches. */\nexport const queryByLabelText: BuiltinQueries[\"queryByLabelText\"] = labelTextQueries.queryByLabelText;\n/** Returns every widget with matching associated label text. Throws when none match. */\nexport const getAllByLabelText: BuiltinQueries[\"getAllByLabelText\"] = labelTextQueries.getAllByLabelText;\n/** Returns the single widget with matching associated label text. Throws when none or more than one matches. */\nexport const getByLabelText: BuiltinQueries[\"getByLabelText\"] = labelTextQueries.getByLabelText;\n/** Waits for and returns every widget with matching associated label text, retrying until at least one appears or the timeout elapses. */\nexport const findAllByLabelText: BuiltinQueries[\"findAllByLabelText\"] = labelTextQueries.findAllByLabelText;\n/** Waits for and returns the single widget with matching associated label text, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByLabelText: BuiltinQueries[\"findByLabelText\"] = labelTextQueries.findByLabelText;\n\n/** Returns the single widget with matching rendered text content, or null when none match. Throws when more than one matches. */\nexport const queryByText: BuiltinQueries[\"queryByText\"] = textQueries.queryByText;\n/** Returns every widget with matching rendered text content. Throws when none match. */\nexport const getAllByText: BuiltinQueries[\"getAllByText\"] = textQueries.getAllByText;\n/** Returns the single widget with matching rendered text content. Throws when none or more than one matches. */\nexport const getByText: BuiltinQueries[\"getByText\"] = textQueries.getByText;\n/** Waits for and returns every widget with matching rendered text content, retrying until at least one appears or the timeout elapses. */\nexport const findAllByText: BuiltinQueries[\"findAllByText\"] = textQueries.findAllByText;\n/** Waits for and returns the single widget with matching rendered text content, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByText: BuiltinQueries[\"findByText\"] = textQueries.findByText;\n\n/** Returns the single widget with a matching widget name, or null when none match. Throws when more than one matches. */\nexport const queryByName: BuiltinQueries[\"queryByName\"] = nameQueries.queryByName;\n/** Returns every widget with a matching widget name. Throws when none match. */\nexport const getAllByName: BuiltinQueries[\"getAllByName\"] = nameQueries.getAllByName;\n/** Returns the single widget with a matching widget name. Throws when none or more than one matches. */\nexport const getByName: BuiltinQueries[\"getByName\"] = nameQueries.getByName;\n/** Waits for and returns every widget with a matching widget name, retrying until at least one appears or the timeout elapses. */\nexport const findAllByName: BuiltinQueries[\"findAllByName\"] = nameQueries.findAllByName;\n/** Waits for and returns the single widget with a matching widget name, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByName: BuiltinQueries[\"findByName\"] = nameQueries.findByName;\n\n/** Returns the single widget with matching placeholder text, or null when none match. Throws when more than one matches. */\nexport const queryByPlaceholderText: BuiltinQueries[\"queryByPlaceholderText\"] =\n placeholderTextQueries.queryByPlaceholderText;\n/** Returns every widget with matching placeholder text. Throws when none match. */\nexport const getAllByPlaceholderText: BuiltinQueries[\"getAllByPlaceholderText\"] =\n placeholderTextQueries.getAllByPlaceholderText;\n/** Returns the single widget with matching placeholder text. Throws when none or more than one matches. */\nexport const getByPlaceholderText: BuiltinQueries[\"getByPlaceholderText\"] = placeholderTextQueries.getByPlaceholderText;\n/** Waits for and returns every widget with matching placeholder text, retrying until at least one appears or the timeout elapses. */\nexport const findAllByPlaceholderText: BuiltinQueries[\"findAllByPlaceholderText\"] =\n placeholderTextQueries.findAllByPlaceholderText;\n/** Waits for and returns the single widget with matching placeholder text, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByPlaceholderText: BuiltinQueries[\"findByPlaceholderText\"] =\n placeholderTextQueries.findByPlaceholderText;\n\n/** Returns the single widget with a matching display value, or null when none match. Throws when more than one matches. */\nexport const queryByDisplayValue: BuiltinQueries[\"queryByDisplayValue\"] = displayValueQueries.queryByDisplayValue;\n/** Returns every widget with a matching display value. Throws when none match. */\nexport const getAllByDisplayValue: BuiltinQueries[\"getAllByDisplayValue\"] = displayValueQueries.getAllByDisplayValue;\n/** Returns the single widget with a matching display value. Throws when none or more than one matches. */\nexport const getByDisplayValue: BuiltinQueries[\"getByDisplayValue\"] = displayValueQueries.getByDisplayValue;\n/** Waits for and returns every widget with a matching display value, retrying until at least one appears or the timeout elapses. */\nexport const findAllByDisplayValue: BuiltinQueries[\"findAllByDisplayValue\"] = displayValueQueries.findAllByDisplayValue;\n/** Waits for and returns the single widget with a matching display value, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */\nexport const findByDisplayValue: BuiltinQueries[\"findByDisplayValue\"] = displayValueQueries.findByDisplayValue;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=register-test-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-test-hooks.d.ts","sourceRoot":"","sources":["../src/register-test-hooks.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { quit } from "@gtkx/runtime";
2
+ import { registerMatchers } from "./matchers.js";
3
+ import { cleanup } from "./render.js";
4
+ const callRunnerHook = (name, callback) => {
5
+ const hook = Reflect.get(globalThis, name);
6
+ if (typeof hook === "function")
7
+ hook(callback);
8
+ };
9
+ const registerTestRuntimeHooks = () => {
10
+ callRunnerHook("afterEach", cleanup);
11
+ callRunnerHook("afterAll", quit);
12
+ registerMatchers();
13
+ };
14
+ registerTestRuntimeHooks();
15
+ //# sourceMappingURL=register-test-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-test-hooks.js","sourceRoot":"","sources":["../src/register-test-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,cAAc,GAAG,CAAC,IAA8B,EAAE,QAAuB,EAAQ,EAAE;IACrF,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACpD,IAAI,OAAO,IAAI,KAAK,UAAU;QAAG,IAA0C,CAAC,QAAQ,CAAC,CAAC;AAC1F,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAS,EAAE;IACxC,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjC,gBAAgB,EAAE,CAAC;AACvB,CAAC,CAAC;AAEF,wBAAwB,EAAE,CAAC","sourcesContent":["import { quit } from \"@gtkx/runtime\";\nimport { registerMatchers } from \"./matchers.js\";\nimport { cleanup } from \"./render.js\";\n\nconst callRunnerHook = (name: \"afterEach\" | \"afterAll\", callback: () => unknown): void => {\n const hook: unknown = Reflect.get(globalThis, name);\n if (typeof hook === \"function\") (hook as (callback: () => unknown) => void)(callback);\n};\n\nconst registerTestRuntimeHooks = (): void => {\n callRunnerHook(\"afterEach\", cleanup);\n callRunnerHook(\"afterAll\", quit);\n registerMatchers();\n};\n\nregisterTestRuntimeHooks();\n"]}
@@ -1,41 +1,20 @@
1
1
  import type { RenderHookOptions, RenderHookResult } from "./types.js";
2
2
  /**
3
- * Renders a React hook for testing.
3
+ * Renders a test component that calls the given hook, exposing its latest
4
+ * return value along with rerender and unmount controls.
4
5
  *
5
- * Creates a test component that executes the hook and provides utilities
6
- * for accessing the result, re-rendering with new props, and cleanup.
7
- *
8
- * @param callback - Function that calls the hook and returns its result
9
- * @param options - Render options including initialProps and wrapper
10
- * @returns A promise resolving to the hook result and utilities
11
- *
12
- * @example
13
- * ```tsx
14
- * import { renderHook } from "@gtkx/testing";
15
- * import { useState } from "react";
16
- *
17
- * test("useState hook", async () => {
18
- * const { result } = await renderHook(() => useState(0));
19
- * expect(result.current[0]).toBe(0);
20
- * });
21
- * ```
22
- *
23
- * @example
24
- * ```tsx
25
- * import { renderHook } from "@gtkx/testing";
26
- *
27
- * test("hook with props", async () => {
28
- * const { result, rerender } = await renderHook(
29
- * ({ multiplier }) => useMultiplier(multiplier),
30
- * { initialProps: { multiplier: 2 } }
31
- * );
32
- *
33
- * expect(result.current).toBe(2);
6
+ * @param callback The hook to run, invoked with the current props.
7
+ * @param options Optional initial props and wrapper component.
8
+ * @returns A result whose `result.current` holds the hook's latest value.
9
+ */
10
+ export declare function renderHook<Result>(callback: () => Result, options?: RenderHookOptions<undefined>): Promise<RenderHookResult<Result, undefined>>;
11
+ /**
12
+ * Renders a test component that calls the given hook with props, exposing its
13
+ * latest return value along with rerender and unmount controls.
34
14
  *
35
- * await rerender({ multiplier: 3 });
36
- * expect(result.current).toBe(3);
37
- * });
38
- * ```
15
+ * @param callback The hook to run, invoked with the current props.
16
+ * @param options Initial props and optional wrapper component.
17
+ * @returns A result whose `result.current` holds the hook's latest value.
39
18
  */
40
- export declare const renderHook: <Result, Props>(callback: (props: Props) => Result, options?: RenderHookOptions<Props>) => Promise<RenderHookResult<Result, Props>>;
19
+ export declare function renderHook<Result, Props>(callback: (props: Props) => Result, options: RenderHookOptions<Props>): Promise<RenderHookResult<Result, Props>>;
41
20
  //# sourceMappingURL=render-hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-hook.d.ts","sourceRoot":"","sources":["../src/render-hook.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,UAAU,GAAU,MAAM,EAAE,KAAK,EAC1C,UAAU,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,EAClC,UAAU,iBAAiB,CAAC,KAAK,CAAC,KACnC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAyBzC,CAAC"}
1
+ {"version":3,"file":"render-hook.d.ts","sourceRoot":"","sources":["../src/render-hook.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAC7B,QAAQ,EAAE,MAAM,MAAM,EACtB,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,GACvC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAChD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,EAClC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAClC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC"}
@@ -1,55 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRef } from "react";
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
3
  import { render } from "./render.js";
4
- /**
5
- * Renders a React hook for testing.
6
- *
7
- * Creates a test component that executes the hook and provides utilities
8
- * for accessing the result, re-rendering with new props, and cleanup.
9
- *
10
- * @param callback - Function that calls the hook and returns its result
11
- * @param options - Render options including initialProps and wrapper
12
- * @returns A promise resolving to the hook result and utilities
13
- *
14
- * @example
15
- * ```tsx
16
- * import { renderHook } from "@gtkx/testing";
17
- * import { useState } from "react";
18
- *
19
- * test("useState hook", async () => {
20
- * const { result } = await renderHook(() => useState(0));
21
- * expect(result.current[0]).toBe(0);
22
- * });
23
- * ```
24
- *
25
- * @example
26
- * ```tsx
27
- * import { renderHook } from "@gtkx/testing";
28
- *
29
- * test("hook with props", async () => {
30
- * const { result, rerender } = await renderHook(
31
- * ({ multiplier }) => useMultiplier(multiplier),
32
- * { initialProps: { multiplier: 2 } }
33
- * );
34
- *
35
- * expect(result.current).toBe(2);
36
- *
37
- * await rerender({ multiplier: 3 });
38
- * expect(result.current).toBe(3);
39
- * });
40
- * ```
41
- */
42
- export const renderHook = async (callback, options) => {
4
+ export async function renderHook(callback, options) {
5
+ const initialProps = options?.initialProps;
43
6
  const resultRef = { current: undefined };
44
- let currentProps = options?.initialProps;
7
+ let currentProps = initialProps;
45
8
  const TestComponent = ({ props }) => {
46
9
  const result = callback(props);
47
- const ref = useRef(resultRef);
48
- ref.current.current = result;
10
+ resultRef.current = result;
49
11
  return null;
50
12
  };
51
13
  const renderResult = await render(_jsx(TestComponent, { props: currentProps }), {
52
- wrapper: options?.wrapper ?? true,
14
+ container: new Gtk.Box(),
15
+ wrapper: options?.wrapper,
53
16
  });
54
17
  return {
55
18
  result: resultRef,
@@ -61,5 +24,5 @@ export const renderHook = async (callback, options) => {
61
24
  },
62
25
  unmount: renderResult.unmount,
63
26
  };
64
- };
27
+ }
65
28
  //# sourceMappingURL=render-hook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-hook.js","sourceRoot":"","sources":["../src/render-hook.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC3B,QAAkC,EAClC,OAAkC,EACM,EAAE;IAC1C,MAAM,SAAS,GAAG,EAAE,OAAO,EAAE,SAAmB,EAAE,CAAC;IACnD,IAAI,YAAY,GAAG,OAAO,EAAE,YAAqB,CAAC;IAElD,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAoB,EAAQ,EAAE;QACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9B,GAAG,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,KAAC,aAAa,IAAC,KAAK,EAAE,YAAY,GAAI,EAAE;QACtE,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI;KACpC,CAAC,CAAC;IAEH,OAAO;QACH,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE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,QAAQ,CAAC,KAAC,aAAa,IAAC,KAAK,EAAE,YAAY,GAAI,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,EAAE,YAAY,CAAC,OAAO;KAChC,CAAC;AACN,CAAC","sourcesContent":["import * as Gtk from \"@gtkx/gi/gtk\";\nimport { render } from \"./render.js\";\nimport type { RenderHookOptions, RenderHookResult } from \"./types.js\";\n\n/**\n * Renders a test component that calls the given hook, exposing its latest\n * return value along with rerender and unmount controls.\n *\n * @param callback The hook to run, invoked with the current props.\n * @param options Optional initial props and wrapper component.\n * @returns A result whose `result.current` holds the hook's latest value.\n */\nexport function renderHook<Result>(\n callback: () => Result,\n options?: RenderHookOptions<undefined>,\n): Promise<RenderHookResult<Result, undefined>>;\n/**\n * Renders a test component that calls the given hook with props, exposing its\n * latest return value along with rerender and unmount controls.\n *\n * @param callback The hook to run, invoked with the current props.\n * @param options Initial props and optional wrapper component.\n * @returns A result whose `result.current` holds the hook's latest value.\n */\nexport function renderHook<Result, Props>(\n callback: (props: Props) => Result,\n options: RenderHookOptions<Props>,\n): Promise<RenderHookResult<Result, Props>>;\nexport async function renderHook<Result, Props>(\n callback: (props: Props) => Result,\n options?: RenderHookOptions<Props>,\n): Promise<RenderHookResult<Result, Props>> {\n const initialProps = (options as { initialProps?: Props } | undefined)?.initialProps as Props;\n const resultRef: { current: Result | undefined } = { current: undefined };\n let currentProps: Props = initialProps;\n\n const TestComponent = ({ props }: { props: Props }): null => {\n const result = callback(props);\n resultRef.current = result;\n return null;\n };\n\n const renderResult = await render(<TestComponent props={currentProps} />, {\n container: new Gtk.Box(),\n wrapper: options?.wrapper,\n });\n\n return {\n result: resultRef as { current: Result },\n rerender: async (newProps?: Props) => {\n if (newProps !== undefined) {\n currentProps = newProps;\n }\n await renderResult.rerender(<TestComponent props={currentProps} />);\n },\n unmount: renderResult.unmount,\n };\n}\n"]}
package/dist/render.d.ts CHANGED
@@ -1,49 +1,19 @@
1
1
  import { type ReactNode } from "react";
2
- import type { RenderOptions, RenderResult } from "./types.js";
2
+ import type { RenderResult } from "./bound-queries.js";
3
+ import type { QueryMap, RenderOptions } from "./types.js";
3
4
  /**
4
- * Renders a React element for testing.
5
+ * Renders a React element into a GTK4 widget tree and returns queries
6
+ * scoped to it along with controls for rerendering and unmounting. When no
7
+ * container is supplied, a harness window is created and presented.
5
8
  *
6
- * Creates a GTK application context and renders the element, returning
7
- * query methods and utilities for interacting with the rendered widgets.
8
- *
9
- * @param element - The React element to render
10
- * @param options - Render options including wrapper configuration
11
- * @returns A promise resolving to query methods and utilities
12
- *
13
- * @example
14
- * ```tsx
15
- * import { render, screen } from "@gtkx/testing";
16
- *
17
- * test("button click", async () => {
18
- * await render(<MyButton />);
19
- * const button = await screen.findByRole(Gtk.AccessibleRole.BUTTON);
20
- * await userEvent.click(button);
21
- * });
22
- * ```
23
- *
24
- * @see {@link cleanup} for cleaning up after tests
25
- * @see {@link screen} for global query access
9
+ * @param element The React element to render.
10
+ * @param options Optional container, wrapper, custom queries, and other render settings.
11
+ * @returns A render result with bound queries, debug helpers, and lifecycle controls.
26
12
  */
27
- export declare const render: (element: ReactNode, options?: RenderOptions) => Promise<RenderResult>;
13
+ export declare const render: <Q extends QueryMap = Record<never, never>>(element: ReactNode, options?: RenderOptions<Q>) => Promise<RenderResult<Q>>;
28
14
  /**
29
- * Cleans up the rendered component tree.
30
- *
31
- * Unmounts all rendered components and resets the testing environment.
32
- * Call this in `afterEach` to ensure tests don't affect each other.
33
- *
34
- * @example
35
- * ```tsx
36
- * import { render, cleanup } from "@gtkx/testing";
37
- *
38
- * afterEach(async () => {
39
- * await cleanup();
40
- * });
41
- *
42
- * test("my test", async () => {
43
- * await render(<MyComponent />);
44
- * // ...
45
- * });
46
- * ```
15
+ * Unmounts every active render and runs all registered cleanup callbacks,
16
+ * resetting the screen and clipboard. Called automatically after each test.
47
17
  */
48
18
  export declare const cleanup: () => Promise<void>;
49
19
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAO5D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAoB,MAAM,YAAY,CAAC;AAyFhF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,MAAM,GAAU,SAAS,SAAS,EAAE,UAAU,aAAa,KAAG,OAAO,CAAC,YAAY,CA4B9F,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO,QAAa,OAAO,CAAC,IAAI,CAO5C,CAAC"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAkB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAqC,MAAM,YAAY,CAAC;AA8G7F;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,GAAU,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,WACzD,SAAS,YACR,aAAa,CAAC,CAAC,CAAC,KAC3B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAuDzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAa,OAAO,CAAC,IAAI,CAE5C,CAAC"}
package/dist/render.js CHANGED
@@ -1,147 +1,158 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { start, stop } from "@gtkx/ffi";
3
- import * as Gio from "@gtkx/ffi/gio";
4
- import { ApplicationContext, GtkApplicationWindow, reconciler } from "@gtkx/react";
5
- import { createRef } from "react";
6
- import { bindQueries } from "./bind-queries.js";
7
- import { prettyWidget } from "./pretty-widget.js";
8
- import { setScreenRoot } from "./screen.js";
9
- import { tick } from "./timing.js";
10
- import { isApplication, traverse } from "./traversal.js";
11
- let application = null;
12
- let container = null;
2
+ import * as Gtk from "@gtkx/gi/gtk";
3
+ import { createReconcilerRoot, isRootElement, setReconcilerErrorHandler, } from "@gtkx/react/internal";
4
+ import { StrictMode } from "react";
5
+ import { runInAct } from "./act.js";
6
+ import { addToCleanupQueue, runCleanup } from "./cleanup-registry.js";
7
+ import { scheduleAfterLayout } from "./frame-sync.js";
8
+ import { logWidget } from "./pretty-widget.js";
9
+ import { logRoles } from "./role-helpers.js";
10
+ import { clearScreen, setScreen } from "./screen.js";
11
+ import { captureAndSaveScreenshot } from "./screenshot.js";
12
+ import { TOPLEVELS, traverse } from "./traversal.js";
13
+ import { resetClipboard } from "./user-event/index.js";
14
+ import { within } from "./within.js";
13
15
  let lastRenderError = null;
14
- const update = async (instance, element, fiberRoot) => {
15
- lastRenderError = null;
16
- instance.updateContainer(element, fiberRoot, null, () => { });
17
- await tick();
16
+ let errorHandlerInstalled = false;
17
+ const activeRenders = new Set();
18
+ const HARNESS_WINDOW_WIDTH = 800;
19
+ const HARNESS_WINDOW_HEIGHT = 600;
20
+ const flushLayout = (window) => new Promise((resolve) => {
21
+ scheduleAfterLayout(window, resolve);
22
+ });
23
+ const update = async (element, root) => {
24
+ await runInAct(() => {
25
+ root.update(element);
26
+ });
18
27
  if (lastRenderError) {
19
- const error = lastRenderError;
28
+ const captured = lastRenderError;
20
29
  lastRenderError = null;
21
- throw error;
30
+ throw captured;
22
31
  }
23
32
  };
24
- const handleError = (error) => {
25
- lastRenderError = error;
33
+ const disposeActiveRender = async (active) => {
34
+ if (!activeRenders.delete(active))
35
+ return;
36
+ await active.root.unmount(async (root) => {
37
+ await update(null, root);
38
+ active.window?.destroy();
39
+ });
26
40
  };
27
- const ensureInitialized = () => {
28
- application = start("org.gtkx.testing", Gio.ApplicationFlags.NON_UNIQUE);
29
- if (!container) {
30
- const instance = reconciler.getInstance();
31
- container = instance.createContainer(application, 1, null, false, null, "", handleError, handleError, () => { }, () => { });
41
+ const disposeAllActiveRenders = async () => {
42
+ for (const active of [...activeRenders]) {
43
+ await disposeActiveRender(active);
32
44
  }
33
- return { app: application, container };
34
45
  };
35
- const DefaultWrapper = ({ children, ref }) => (_jsx(GtkApplicationWindow, { ref: ref, defaultWidth: 800, defaultHeight: 600, children: children }));
36
- const findFirstWidget = (root) => {
37
- for (const widget of traverse(root)) {
38
- if (isApplication(root))
39
- return widget;
40
- return root;
41
- }
42
- return null;
46
+ const handleError = (error) => {
47
+ lastRenderError = error instanceof Error ? error : new Error(String(error));
43
48
  };
44
- const wrapElement = (element, wrapperRef, wrapper) => {
45
- if (wrapper === false || wrapper === undefined)
46
- return element;
47
- const Wrapper = wrapper === true ? DefaultWrapper : wrapper;
48
- return _jsx(Wrapper, { ref: wrapperRef, children: element });
49
+ const installErrorHandler = () => {
50
+ if (errorHandlerInstalled)
51
+ return;
52
+ setReconcilerErrorHandler(handleError);
53
+ errorHandlerInstalled = true;
49
54
  };
50
- const resolveContainer = (wrapper, wrapperRef, baseElement) => {
51
- if (wrapper !== false && wrapper !== undefined && wrapperRef.current) {
52
- return wrapperRef.current;
55
+ const resolveContainer = (container) => {
56
+ if (isRootElement(container)) {
57
+ return { containerInfo: container, window: null };
53
58
  }
54
- const firstWidget = findFirstWidget(baseElement);
55
- if (!firstWidget) {
56
- throw new Error("render() produced no widgets. Ensure the element renders visible content.");
59
+ if (container instanceof Gtk.Widget) {
60
+ return { containerInfo: container, window: null };
61
+ }
62
+ const window = new Gtk.Window({ defaultWidth: HARNESS_WINDOW_WIDTH, defaultHeight: HARNESS_WINDOW_HEIGHT });
63
+ window.setTitlebar(new Gtk.HeaderBar({ showTitleButtons: false }));
64
+ return { containerInfo: window, window };
65
+ };
66
+ const firstToplevelWidget = (baseElement) => {
67
+ if (baseElement instanceof Gtk.Widget)
68
+ return baseElement;
69
+ const [first] = traverse(baseElement);
70
+ if (first)
71
+ return first;
72
+ throw new Error("render() produced no widgets: ensure the element renders visible content");
73
+ };
74
+ const resolveResultContainer = (resolved, container, baseElement) => {
75
+ if (resolved.window)
76
+ return resolved.window;
77
+ if (container instanceof Gtk.Widget)
78
+ return container;
79
+ return firstToplevelWidget(baseElement);
80
+ };
81
+ const renderErrorHandlers = (options) => ({
82
+ onUncaughtError: handleError,
83
+ onCaughtError: (error, errorInfo) => {
84
+ handleError(error);
85
+ options?.onCaughtError?.(error, errorInfo);
86
+ },
87
+ onRecoverableError: (error, errorInfo) => {
88
+ options?.onRecoverableError?.(error, errorInfo);
89
+ },
90
+ });
91
+ const applyEnableAnimations = (enabled) => {
92
+ const settings = Gtk.Settings.getDefault();
93
+ if (settings) {
94
+ settings.gtkEnableAnimations = enabled;
57
95
  }
58
- return firstWidget;
59
96
  };
60
97
  /**
61
- * Renders a React element for testing.
62
- *
63
- * Creates a GTK application context and renders the element, returning
64
- * query methods and utilities for interacting with the rendered widgets.
65
- *
66
- * @param element - The React element to render
67
- * @param options - Render options including wrapper configuration
68
- * @returns A promise resolving to query methods and utilities
69
- *
70
- * @example
71
- * ```tsx
72
- * import { render, screen } from "@gtkx/testing";
73
- *
74
- * test("button click", async () => {
75
- * await render(<MyButton />);
76
- * const button = await screen.findByRole(Gtk.AccessibleRole.BUTTON);
77
- * await userEvent.click(button);
78
- * });
79
- * ```
98
+ * Renders a React element into a GTK4 widget tree and returns queries
99
+ * scoped to it along with controls for rerendering and unmounting. When no
100
+ * container is supplied, a harness window is created and presented.
80
101
  *
81
- * @see {@link cleanup} for cleaning up after tests
82
- * @see {@link screen} for global query access
102
+ * @param element The React element to render.
103
+ * @param options Optional container, wrapper, custom queries, and other render settings.
104
+ * @returns A render result with bound queries, debug helpers, and lifecycle controls.
83
105
  */
84
106
  export const render = async (element, options) => {
85
- const { app: application, container: fiberRoot } = ensureInitialized();
86
- const instance = reconciler.getInstance();
87
- const baseElement = options?.baseElement ?? application;
88
- const wrapper = options?.wrapper ?? true;
89
- const wrapperRef = createRef();
90
- const wrappedElement = wrapElement(element, wrapperRef, wrapper);
91
- const withContext = _jsx(ApplicationContext.Provider, { value: application, children: wrappedElement });
92
- await update(instance, withContext, fiberRoot);
93
- setScreenRoot(application);
94
- return {
95
- container: resolveContainer(wrapper, wrapperRef, baseElement),
107
+ installErrorHandler();
108
+ applyEnableAnimations(options?.animations === true);
109
+ const baseElement = options?.baseElement ?? TOPLEVELS;
110
+ const Wrapper = options?.wrapper;
111
+ const resolved = resolveContainer(options?.container);
112
+ const root = createReconcilerRoot({
113
+ containerInfo: resolved.containerInfo,
114
+ ...renderErrorHandlers(options),
115
+ });
116
+ const active = { root, window: resolved.window };
117
+ activeRenders.add(active);
118
+ addToCleanupQueue(disposeAllActiveRenders);
119
+ addToCleanupQueue(clearScreen);
120
+ addToCleanupQueue(resetClipboard);
121
+ const wrap = (node) => {
122
+ const wrapped = Wrapper ? _jsx(Wrapper, { children: node }) : node;
123
+ return options?.reactStrictMode ? _jsx(StrictMode, { children: wrapped }) : wrapped;
124
+ };
125
+ await update(wrap(element), root);
126
+ resolved.window?.present();
127
+ await flushLayout(resolved.window);
128
+ const container = resolveResultContainer(resolved, options?.container, baseElement);
129
+ const result = {
130
+ ...within(baseElement, options?.queries),
131
+ container,
96
132
  baseElement,
97
- ...bindQueries(baseElement),
98
- unmount: () => update(instance, null, fiberRoot),
133
+ unmount: async () => {
134
+ await disposeActiveRender(active);
135
+ },
99
136
  rerender: async (newElement) => {
100
- const newWrapperRef = createRef();
101
- const wrapped = wrapElement(newElement, newWrapperRef, wrapper);
102
- const withCtx = _jsx(ApplicationContext.Provider, { value: application, children: wrapped });
103
- await update(instance, withCtx, fiberRoot);
137
+ await update(wrap(newElement), root);
138
+ await flushLayout(resolved.window);
139
+ },
140
+ debug: (element = baseElement, debugOptions) => {
141
+ logWidget(element, debugOptions);
104
142
  },
105
- debug: () => {
106
- console.log(prettyWidget(application));
143
+ logRoles: () => {
144
+ logRoles(baseElement);
107
145
  },
146
+ screenshot: (selector, screenshotOptions) => captureAndSaveScreenshot(selector, screenshotOptions),
108
147
  };
148
+ setScreen(result);
149
+ return result;
109
150
  };
110
151
  /**
111
- * Cleans up the rendered component tree.
112
- *
113
- * Unmounts all rendered components and resets the testing environment.
114
- * Call this in `afterEach` to ensure tests don't affect each other.
115
- *
116
- * @example
117
- * ```tsx
118
- * import { render, cleanup } from "@gtkx/testing";
119
- *
120
- * afterEach(async () => {
121
- * await cleanup();
122
- * });
123
- *
124
- * test("my test", async () => {
125
- * await render(<MyComponent />);
126
- * // ...
127
- * });
128
- * ```
152
+ * Unmounts every active render and runs all registered cleanup callbacks,
153
+ * resetting the screen and clipboard. Called automatically after each test.
129
154
  */
130
155
  export const cleanup = async () => {
131
- if (container && application) {
132
- const instance = reconciler.getInstance();
133
- await update(instance, null, container);
134
- }
135
- container = null;
136
- setScreenRoot(null);
137
- };
138
- const handleSignal = () => {
139
- try {
140
- stop();
141
- }
142
- catch { }
143
- process.exit(0);
156
+ await runCleanup();
144
157
  };
145
- process.on("SIGTERM", handleSignal);
146
- process.on("SIGINT", handleSignal);
147
158
  //# sourceMappingURL=render.js.map