@ctrl/dom 0.0.0-stage → 0.1.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 (380) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +338 -0
  3. package/README.md +362 -2
  4. package/dist/aria/_chunks/roles-list-CYZF-l9K.js +1503 -0
  5. package/dist/aria/_chunks/roles-list-D4WCyRO_.cjs +1754 -0
  6. package/dist/aria/index.cjs +232 -0
  7. package/dist/aria/index.js +198 -0
  8. package/dist/aria/internal.cjs +69 -0
  9. package/dist/aria/internal.js +30 -0
  10. package/dist/aria/types/accname.d.ts +40 -0
  11. package/dist/aria/types/data/aria-query.d.ts +61 -0
  12. package/dist/aria/types/data/aria-query.generated.d.ts +2 -0
  13. package/dist/aria/types/forms.d.ts +25 -0
  14. package/dist/aria/types/hidden.d.ts +38 -0
  15. package/dist/aria/types/index.d.ts +46 -0
  16. package/dist/aria/types/internal.d.ts +15 -0
  17. package/dist/aria/types/role.d.ts +27 -0
  18. package/dist/aria/types/roles-list.d.ts +18 -0
  19. package/dist/aria/types/states.d.ts +29 -0
  20. package/dist/aria/types/style.d.ts +18 -0
  21. package/dist/aria/types/tree.d.ts +20 -0
  22. package/dist/bridge/index.cjs +3 -0
  23. package/dist/bridge/index.js +4 -0
  24. package/dist/bridge/internal.cjs +3 -0
  25. package/dist/bridge/internal.js +4 -0
  26. package/dist/cli/_chunks/report-DdncYfuJ.js +93 -0
  27. package/dist/cli/ctrl-dom.js +199 -0
  28. package/dist/cli/jest-reporter.js +55 -0
  29. package/dist/cli/vitest-reporter.js +81 -0
  30. package/dist/dom/_chunks/src-Hv_BAHIV.js +47537 -0
  31. package/dist/dom/index.js +3 -0
  32. package/dist/dom/internal.js +434 -0
  33. package/dist/dom/types/collections/DOMStringMap.d.ts +8 -0
  34. package/dist/dom/types/collections/DOMTokenList.d.ts +33 -0
  35. package/dist/dom/types/collections/HTMLCollection.d.ts +62 -0
  36. package/dist/dom/types/collections/NamedNodeMap.d.ts +22 -0
  37. package/dist/dom/types/collections/NodeList.d.ts +43 -0
  38. package/dist/dom/types/collections/indexed.d.ts +8 -0
  39. package/dist/dom/types/collections/iterator.d.ts +8 -0
  40. package/dist/dom/types/css/CSS.d.ts +21 -0
  41. package/dist/dom/types/css/CSSStyleDeclaration.d.ts +57 -0
  42. package/dist/dom/types/css/cascade.d.ts +159 -0
  43. package/dist/dom/types/css/colors.d.ts +28 -0
  44. package/dist/dom/types/css/computed.d.ts +22 -0
  45. package/dist/dom/types/css/cssom.d.ts +363 -0
  46. package/dist/dom/types/css/data/properties.d.ts +1 -0
  47. package/dist/dom/types/css/declarations.d.ts +40 -0
  48. package/dist/dom/types/css/index.d.ts +5 -0
  49. package/dist/dom/types/css/inline-count.d.ts +2 -0
  50. package/dist/dom/types/css/internal.d.ts +11 -0
  51. package/dist/dom/types/css/layout-mode.d.ts +4 -0
  52. package/dist/dom/types/css/layout.d.ts +63 -0
  53. package/dist/dom/types/css/media.d.ts +55 -0
  54. package/dist/dom/types/css/parser.d.ts +93 -0
  55. package/dist/dom/types/css/properties.d.ts +28 -0
  56. package/dist/dom/types/css/resize-observer.d.ts +19 -0
  57. package/dist/dom/types/css/selector-info.d.ts +13 -0
  58. package/dist/dom/types/css/shorthands.d.ts +33 -0
  59. package/dist/dom/types/css/stylesheets.d.ts +93 -0
  60. package/dist/dom/types/css/supports.d.ts +4 -0
  61. package/dist/dom/types/css/tokenizer.d.ts +91 -0
  62. package/dist/dom/types/css/values.d.ts +91 -0
  63. package/dist/dom/types/css/view.d.ts +44 -0
  64. package/dist/dom/types/events/DataTransfer.d.ts +62 -0
  65. package/dist/dom/types/events/Event.d.ts +115 -0
  66. package/dist/dom/types/events/EventTarget.d.ts +22 -0
  67. package/dist/dom/types/events/UIEvents.d.ts +308 -0
  68. package/dist/dom/types/events/activation.d.ts +7 -0
  69. package/dist/dom/types/events/convert.d.ts +16 -0
  70. package/dist/dom/types/events/createEvent.d.ts +3 -0
  71. package/dist/dom/types/events/dispatch.d.ts +39 -0
  72. package/dist/dom/types/events/events.d.ts +200 -0
  73. package/dist/dom/types/events/fire.d.ts +21 -0
  74. package/dist/dom/types/events/handlers.d.ts +14 -0
  75. package/dist/dom/types/events/listeners.d.ts +32 -0
  76. package/dist/dom/types/events/report.d.ts +10 -0
  77. package/dist/dom/types/html/HTMLElement.d.ts +126 -0
  78. package/dist/dom/types/html/MathMLElement.d.ts +6 -0
  79. package/dist/dom/types/html/SVGElement.d.ts +145 -0
  80. package/dist/dom/types/html/anchor.d.ts +16 -0
  81. package/dist/dom/types/html/aria-reflection.d.ts +14 -0
  82. package/dist/dom/types/html/collection.d.ts +5 -0
  83. package/dist/dom/types/html/custom-elements.d.ts +129 -0
  84. package/dist/dom/types/html/elements.d.ts +202 -0
  85. package/dist/dom/types/html/events.d.ts +22 -0
  86. package/dist/dom/types/html/focus.d.ts +63 -0
  87. package/dist/dom/types/html/forms/FileList.d.ts +1 -0
  88. package/dist/dom/types/html/forms/FormData.d.ts +7 -0
  89. package/dist/dom/types/html/forms/HTMLButtonElement.d.ts +36 -0
  90. package/dist/dom/types/html/forms/HTMLFieldSetElement.d.ts +29 -0
  91. package/dist/dom/types/html/forms/HTMLFormElement.d.ts +61 -0
  92. package/dist/dom/types/html/forms/HTMLInputElement.d.ts +204 -0
  93. package/dist/dom/types/html/forms/HTMLLabelElement.d.ts +15 -0
  94. package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +61 -0
  95. package/dist/dom/types/html/forms/HTMLOutputElement.d.ts +74 -0
  96. package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +96 -0
  97. package/dist/dom/types/html/forms/HTMLTextAreaElement.d.ts +82 -0
  98. package/dist/dom/types/html/forms/autofill.d.ts +10 -0
  99. package/dist/dom/types/html/forms/collections.d.ts +112 -0
  100. package/dist/dom/types/html/forms/common.d.ts +36 -0
  101. package/dist/dom/types/html/forms/face.d.ts +59 -0
  102. package/dist/dom/types/html/forms/form-associated.d.ts +46 -0
  103. package/dist/dom/types/html/forms/form-submission.d.ts +55 -0
  104. package/dist/dom/types/html/forms/index.d.ts +17 -0
  105. package/dist/dom/types/html/forms/input-type.d.ts +50 -0
  106. package/dist/dom/types/html/forms/microsyntaxes.d.ts +52 -0
  107. package/dist/dom/types/html/forms/state.d.ts +54 -0
  108. package/dist/dom/types/html/forms/ui.d.ts +35 -0
  109. package/dist/dom/types/html/forms/user-validity.d.ts +19 -0
  110. package/dist/dom/types/html/forms/validation.d.ts +76 -0
  111. package/dist/dom/types/html/index.d.ts +13 -0
  112. package/dist/dom/types/html/innerText.d.ts +9 -0
  113. package/dist/dom/types/html/interactive.d.ts +43 -0
  114. package/dist/dom/types/html/invokers.d.ts +39 -0
  115. package/dist/dom/types/html/media.d.ts +86 -0
  116. package/dist/dom/types/html/reflect.d.ts +67 -0
  117. package/dist/dom/types/html/registry.d.ts +9 -0
  118. package/dist/dom/types/html/resources.d.ts +55 -0
  119. package/dist/dom/types/html/shared.d.ts +22 -0
  120. package/dist/dom/types/html/slot.d.ts +15 -0
  121. package/dist/dom/types/html/template.d.ts +18 -0
  122. package/dist/dom/types/html/top-layer.d.ts +73 -0
  123. package/dist/dom/types/index.d.ts +50 -0
  124. package/dist/dom/types/internal.d.ts +61 -0
  125. package/dist/dom/types/keys.d.ts +209 -0
  126. package/dist/dom/types/nodes/Attr.d.ts +25 -0
  127. package/dist/dom/types/nodes/CharacterData.d.ts +35 -0
  128. package/dist/dom/types/nodes/Document.d.ts +169 -0
  129. package/dist/dom/types/nodes/DocumentFragment.d.ts +12 -0
  130. package/dist/dom/types/nodes/DocumentType.d.ts +17 -0
  131. package/dist/dom/types/nodes/Element.d.ts +142 -0
  132. package/dist/dom/types/nodes/Node.d.ts +112 -0
  133. package/dist/dom/types/nodes/NodeImpl.d.ts +90 -0
  134. package/dist/dom/types/nodes/ShadowRoot.d.ts +43 -0
  135. package/dist/dom/types/nodes/attr-nodes.d.ts +8 -0
  136. package/dist/dom/types/nodes/attributes.d.ts +46 -0
  137. package/dist/dom/types/nodes/cache.d.ts +38 -0
  138. package/dist/dom/types/nodes/character-data.d.ts +5 -0
  139. package/dist/dom/types/nodes/clone.d.ts +5 -0
  140. package/dist/dom/types/nodes/constants.d.ts +52 -0
  141. package/dist/dom/types/nodes/create.d.ts +42 -0
  142. package/dist/dom/types/nodes/derived.d.ts +26 -0
  143. package/dist/dom/types/nodes/inspect.d.ts +2 -0
  144. package/dist/dom/types/nodes/mixins.d.ts +41 -0
  145. package/dist/dom/types/nodes/names.d.ts +15 -0
  146. package/dist/dom/types/nodes/slots.d.ts +38 -0
  147. package/dist/dom/types/nodes/tags.d.ts +8 -0
  148. package/dist/dom/types/nodes/traverse.d.ts +21 -0
  149. package/dist/dom/types/nodes/tree.d.ts +47 -0
  150. package/dist/dom/types/observers/MutationObserver.d.ts +33 -0
  151. package/dist/dom/types/observers/MutationRecord.d.ts +17 -0
  152. package/dist/dom/types/observers/queue.d.ts +45 -0
  153. package/dist/dom/types/parser/entities-data.d.ts +3 -0
  154. package/dist/dom/types/parser/entities.d.ts +11 -0
  155. package/dist/dom/types/parser/index.d.ts +34 -0
  156. package/dist/dom/types/parser/tags.d.ts +182 -0
  157. package/dist/dom/types/parser/tokenizer.d.ts +109 -0
  158. package/dist/dom/types/parser/treebuilder.d.ts +271 -0
  159. package/dist/dom/types/parser/xml.d.ts +14 -0
  160. package/dist/dom/types/selectors/compile.d.ts +154 -0
  161. package/dist/dom/types/selectors/filter.d.ts +21 -0
  162. package/dist/dom/types/selectors/html-predicates.d.ts +1 -0
  163. package/dist/dom/types/selectors/index.d.ts +16 -0
  164. package/dist/dom/types/selectors/internal.d.ts +87 -0
  165. package/dist/dom/types/selectors/parser.d.ts +310 -0
  166. package/dist/dom/types/selectors/serialize.d.ts +20 -0
  167. package/dist/dom/types/selectors/state.d.ts +43 -0
  168. package/dist/dom/types/serializer/index.d.ts +29 -0
  169. package/dist/dom/types/trace.d.ts +51 -0
  170. package/dist/dom/types/traversal/Range.d.ts +113 -0
  171. package/dist/dom/types/traversal/Selection.d.ts +45 -0
  172. package/dist/dom/types/traversal/TreeWalker.d.ts +77 -0
  173. package/dist/dom/types/traversal/live.d.ts +46 -0
  174. package/dist/dom/types/webidl-runtime.d.ts +18 -0
  175. package/dist/dom/types/webidl.d.ts +34 -0
  176. package/dist/dom/types/window/DOMStringList.d.ts +14 -0
  177. package/dist/dom/types/window/FileList.d.ts +11 -0
  178. package/dist/dom/types/window/FileReader.d.ts +27 -0
  179. package/dist/dom/types/window/History.d.ts +43 -0
  180. package/dist/dom/types/window/Location.d.ts +46 -0
  181. package/dist/dom/types/window/Navigator.d.ts +79 -0
  182. package/dist/dom/types/window/Screen.d.ts +27 -0
  183. package/dist/dom/types/window/Storage.d.ts +28 -0
  184. package/dist/dom/types/window/Window.d.ts +329 -0
  185. package/dist/dom/types/window/abort.d.ts +4 -0
  186. package/dist/dom/types/window/browsing-context.d.ts +12 -0
  187. package/dist/dom/types/window/clock.d.ts +163 -0
  188. package/dist/dom/types/window/compat.d.ts +34 -0
  189. package/dist/dom/types/window/cookies.d.ts +21 -0
  190. package/dist/dom/types/window/current.d.ts +7 -0
  191. package/dist/dom/types/window/document.d.ts +19 -0
  192. package/dist/dom/types/window/events.d.ts +11 -0
  193. package/dist/dom/types/window/fallbacks.d.ts +20 -0
  194. package/dist/dom/types/window/geometry.d.ts +133 -0
  195. package/dist/dom/types/window/globals.d.ts +7 -0
  196. package/dist/dom/types/window/hooks.d.ts +22 -0
  197. package/dist/dom/types/window/host-originals.d.ts +9 -0
  198. package/dist/dom/types/window/interfaces.d.ts +13 -0
  199. package/dist/dom/types/window/isolation.d.ts +20 -0
  200. package/dist/dom/types/window/media.d.ts +33 -0
  201. package/dist/dom/types/window/not-implemented.d.ts +23 -0
  202. package/dist/dom/types/window/observers.d.ts +42 -0
  203. package/dist/dom/types/window/origin.d.ts +3 -0
  204. package/dist/dom/types/window/timers.d.ts +28 -0
  205. package/dist/dom/types/window/xhr.d.ts +108 -0
  206. package/dist/jest-dom/_chunks/matchers-CDnnXUfG.js +2211 -0
  207. package/dist/jest-dom/_chunks/matchers-D988Ducb.cjs +2516 -0
  208. package/dist/jest-dom/index.cjs +5 -0
  209. package/dist/jest-dom/index.js +6 -0
  210. package/dist/jest-dom/jest-globals.cjs +6 -0
  211. package/dist/jest-dom/jest-globals.js +7 -0
  212. package/dist/jest-dom/matchers.cjs +53 -0
  213. package/dist/jest-dom/matchers.js +3 -0
  214. package/dist/jest-dom/types/bun.d.ts +13 -0
  215. package/dist/jest-dom/types/index.d.ts +3 -0
  216. package/dist/jest-dom/types/jest-globals.d.ts +13 -0
  217. package/dist/jest-dom/types/jest.d.ts +15 -0
  218. package/dist/jest-dom/types/matchers-standalone.d.ts +32 -0
  219. package/dist/jest-dom/types/matchers.d.ts +1079 -0
  220. package/dist/jest-dom/types/package.json +1 -0
  221. package/dist/jest-dom/types/vitest.d.ts +16 -0
  222. package/dist/jest-dom/vitest.cjs +6 -0
  223. package/dist/jest-dom/vitest.js +7 -0
  224. package/dist/react/_chunks/pure-DZ97z2oT.cjs +498 -0
  225. package/dist/react/_chunks/pure-PtE2hivW.js +420 -0
  226. package/dist/react/dont-cleanup-after-each.cjs +3 -0
  227. package/dist/react/dont-cleanup-after-each.js +4 -0
  228. package/dist/react/index.cjs +47 -0
  229. package/dist/react/index.js +35 -0
  230. package/dist/react/pure.cjs +17 -0
  231. package/dist/react/pure.js +5 -0
  232. package/dist/react/types/act-compat.d.ts +6 -0
  233. package/dist/react/types/config.d.ts +9 -0
  234. package/dist/react/types/dont-cleanup-after-each.d.ts +1 -0
  235. package/dist/react/types/dtl.d.ts +1 -0
  236. package/dist/react/types/fire-event.d.ts +3 -0
  237. package/dist/react/types/index.d.ts +1 -0
  238. package/dist/react/types/pure.d.ts +136 -0
  239. package/dist/register/index.js +11 -0
  240. package/dist/register/pure.js +147 -0
  241. package/dist/register/types/index.d.ts +1 -0
  242. package/dist/register/types/pure.d.ts +36 -0
  243. package/dist/testing-library/_chunks/aria-snapshot-diff-D7PzpXew.cjs +1170 -0
  244. package/dist/testing-library/_chunks/aria-snapshot-diff-Q8Wj33K0.js +985 -0
  245. package/dist/testing-library/agent.cjs +721 -0
  246. package/dist/testing-library/agent.js +713 -0
  247. package/dist/testing-library/index.cjs +2469 -0
  248. package/dist/testing-library/index.js +2390 -0
  249. package/dist/testing-library/types/agent.d.ts +56 -0
  250. package/dist/testing-library/types/aria-role.d.ts +99 -0
  251. package/dist/testing-library/types/aria-snapshot.d.ts +43 -0
  252. package/dist/testing-library/types/config.d.ts +27 -0
  253. package/dist/testing-library/types/events.d.ts +118 -0
  254. package/dist/testing-library/types/get-node-text.d.ts +1 -0
  255. package/dist/testing-library/types/get-queries-for-element.d.ts +182 -0
  256. package/dist/testing-library/types/index.d.ts +24 -0
  257. package/dist/testing-library/types/matches.d.ts +46 -0
  258. package/dist/testing-library/types/pretty-dom.d.ts +37 -0
  259. package/dist/testing-library/types/queries.d.ts +315 -0
  260. package/dist/testing-library/types/query-helpers.d.ts +112 -0
  261. package/dist/testing-library/types/role-helpers.d.ts +19 -0
  262. package/dist/testing-library/types/screen.d.ts +30 -0
  263. package/dist/testing-library/types/suggestions.d.ts +46 -0
  264. package/dist/testing-library/types/wait-for-element-to-be-removed.d.ts +6 -0
  265. package/dist/testing-library/types/wait-for.d.ts +12 -0
  266. package/dist/user-event/index.cjs +3923 -0
  267. package/dist/user-event/index.js +3898 -0
  268. package/dist/user-event/types/clipboard/copy.d.ts +2 -0
  269. package/dist/user-event/types/clipboard/cut.d.ts +2 -0
  270. package/dist/user-event/types/clipboard/index.d.ts +3 -0
  271. package/dist/user-event/types/clipboard/paste.d.ts +3 -0
  272. package/dist/user-event/types/convenience/click.d.ts +5 -0
  273. package/dist/user-event/types/convenience/hover.d.ts +4 -0
  274. package/dist/user-event/types/convenience/index.d.ts +3 -0
  275. package/dist/user-event/types/convenience/tab.d.ts +4 -0
  276. package/dist/user-event/types/ctrl-dom.d.ts +55 -0
  277. package/dist/user-event/types/document/UI.d.ts +35 -0
  278. package/dist/user-event/types/document/copySelection.d.ts +2 -0
  279. package/dist/user-event/types/document/getValueOrTextContent.d.ts +2 -0
  280. package/dist/user-event/types/document/index.d.ts +5 -0
  281. package/dist/user-event/types/document/interceptor.d.ts +20 -0
  282. package/dist/user-event/types/document/patchFocus.d.ts +7 -0
  283. package/dist/user-event/types/document/prepareDocument.d.ts +2 -0
  284. package/dist/user-event/types/document/trackValue.d.ts +13 -0
  285. package/dist/user-event/types/dom-types.d.ts +56 -0
  286. package/dist/user-event/types/event/behavior/click.d.ts +1 -0
  287. package/dist/user-event/types/event/behavior/cut.d.ts +1 -0
  288. package/dist/user-event/types/event/behavior/index.d.ts +8 -0
  289. package/dist/user-event/types/event/behavior/keydown.d.ts +1 -0
  290. package/dist/user-event/types/event/behavior/keypress.d.ts +1 -0
  291. package/dist/user-event/types/event/behavior/keyup.d.ts +1 -0
  292. package/dist/user-event/types/event/behavior/paste.d.ts +1 -0
  293. package/dist/user-event/types/event/behavior/registry.d.ts +9 -0
  294. package/dist/user-event/types/event/createEvent.d.ts +8 -0
  295. package/dist/user-event/types/event/dispatchEvent.d.ts +6 -0
  296. package/dist/user-event/types/event/eventMap.d.ts +265 -0
  297. package/dist/user-event/types/event/focus.d.ts +6 -0
  298. package/dist/user-event/types/event/index.d.ts +7 -0
  299. package/dist/user-event/types/event/input.d.ts +3 -0
  300. package/dist/user-event/types/event/radio.d.ts +5 -0
  301. package/dist/user-event/types/event/selection/getInputRange.d.ts +6 -0
  302. package/dist/user-event/types/event/selection/getTargetTypeAndSelection.d.ts +11 -0
  303. package/dist/user-event/types/event/selection/index.d.ts +15 -0
  304. package/dist/user-event/types/event/selection/modifySelection.d.ts +9 -0
  305. package/dist/user-event/types/event/selection/modifySelectionPerMouse.d.ts +8 -0
  306. package/dist/user-event/types/event/selection/moveSelection.d.ts +5 -0
  307. package/dist/user-event/types/event/selection/resolveCaretPosition.d.ts +9 -0
  308. package/dist/user-event/types/event/selection/selectAll.d.ts +6 -0
  309. package/dist/user-event/types/event/selection/setSelection.d.ts +11 -0
  310. package/dist/user-event/types/event/selection/setSelectionPerMouse.d.ts +9 -0
  311. package/dist/user-event/types/event/selection/setSelectionRange.d.ts +7 -0
  312. package/dist/user-event/types/event/selection/updateSelectionOnFocus.d.ts +6 -0
  313. package/dist/user-event/types/event/types.d.ts +21 -0
  314. package/dist/user-event/types/event/wrapEvent.d.ts +2 -0
  315. package/dist/user-event/types/index.d.ts +6 -0
  316. package/dist/user-event/types/keyboard/index.d.ts +3 -0
  317. package/dist/user-event/types/keyboard/keyMap.d.ts +5 -0
  318. package/dist/user-event/types/keyboard/parseKeyDef.d.ts +17 -0
  319. package/dist/user-event/types/options.d.ts +121 -0
  320. package/dist/user-event/types/pointer/index.d.ts +29 -0
  321. package/dist/user-event/types/pointer/keyMap.d.ts +2 -0
  322. package/dist/user-event/types/pointer/parseKeyDef.d.ts +6 -0
  323. package/dist/user-event/types/setup/api.d.ts +23 -0
  324. package/dist/user-event/types/setup/directApi.d.ts +25 -0
  325. package/dist/user-event/types/setup/dtl.d.ts +20 -0
  326. package/dist/user-event/types/setup/index.d.ts +22 -0
  327. package/dist/user-event/types/setup/setup.d.ts +45 -0
  328. package/dist/user-event/types/setup/wrapAsync.d.ts +4 -0
  329. package/dist/user-event/types/system/index.d.ts +13 -0
  330. package/dist/user-event/types/system/keyLocation.d.ts +11 -0
  331. package/dist/user-event/types/system/keyboard.d.ts +46 -0
  332. package/dist/user-event/types/system/pointer/buttons.d.ts +25 -0
  333. package/dist/user-event/types/system/pointer/device.d.ts +8 -0
  334. package/dist/user-event/types/system/pointer/index.d.ts +21 -0
  335. package/dist/user-event/types/system/pointer/mouse.d.ts +31 -0
  336. package/dist/user-event/types/system/pointer/pointer.d.ts +32 -0
  337. package/dist/user-event/types/system/pointer/shared.d.ts +21 -0
  338. package/dist/user-event/types/utility/clear.d.ts +3 -0
  339. package/dist/user-event/types/utility/index.d.ts +4 -0
  340. package/dist/user-event/types/utility/selectOptions.d.ts +4 -0
  341. package/dist/user-event/types/utility/type.d.ts +10 -0
  342. package/dist/user-event/types/utility/upload.d.ts +6 -0
  343. package/dist/user-event/types/utils/click/isClickableInput.d.ts +17 -0
  344. package/dist/user-event/types/utils/dataTransfer/Blob.d.ts +4 -0
  345. package/dist/user-event/types/utils/dataTransfer/Clipboard.d.ts +12 -0
  346. package/dist/user-event/types/utils/dataTransfer/DataTransfer.d.ts +3 -0
  347. package/dist/user-event/types/utils/dataTransfer/FileList.d.ts +2 -0
  348. package/dist/user-event/types/utils/edit/isContentEditable.d.ts +8 -0
  349. package/dist/user-event/types/utils/edit/isEditable.d.ts +26 -0
  350. package/dist/user-event/types/utils/edit/maxLength.d.ts +16 -0
  351. package/dist/user-event/types/utils/edit/setFiles.d.ts +11 -0
  352. package/dist/user-event/types/utils/edit/timeValue.d.ts +5 -0
  353. package/dist/user-event/types/utils/focus/cursor.d.ts +5 -0
  354. package/dist/user-event/types/utils/focus/getActiveElement.d.ts +3 -0
  355. package/dist/user-event/types/utils/focus/getTabDestination.d.ts +2 -0
  356. package/dist/user-event/types/utils/focus/isFocusable.d.ts +2 -0
  357. package/dist/user-event/types/utils/focus/selection.d.ts +9 -0
  358. package/dist/user-event/types/utils/focus/selector.d.ts +1 -0
  359. package/dist/user-event/types/utils/index.d.ts +29 -0
  360. package/dist/user-event/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
  361. package/dist/user-event/types/utils/misc/cloneEvent.d.ts +2 -0
  362. package/dist/user-event/types/utils/misc/findClosest.d.ts +2 -0
  363. package/dist/user-event/types/utils/misc/getDocumentFromNode.d.ts +2 -0
  364. package/dist/user-event/types/utils/misc/getTreeDiff.d.ts +2 -0
  365. package/dist/user-event/types/utils/misc/getWindow.d.ts +2 -0
  366. package/dist/user-event/types/utils/misc/isDescendantOrSelf.d.ts +2 -0
  367. package/dist/user-event/types/utils/misc/isDisabled.d.ts +2 -0
  368. package/dist/user-event/types/utils/misc/isElementType.d.ts +6 -0
  369. package/dist/user-event/types/utils/misc/isVisible.d.ts +2 -0
  370. package/dist/user-event/types/utils/misc/level.d.ts +9 -0
  371. package/dist/user-event/types/utils/misc/wait.d.ts +6 -0
  372. package/dist/user-event/types/utils/pointer/cssPointerEvents.d.ts +4 -0
  373. package/dist/vitest-environment/failure-snapshot.js +42 -0
  374. package/dist/vitest-environment/index.js +185 -0
  375. package/dist/vitest-environment/plugin.js +90 -0
  376. package/dist/vitest-environment/types/failure-snapshot.d.ts +1 -0
  377. package/dist/vitest-environment/types/index.d.ts +29 -0
  378. package/dist/vitest-environment/types/plugin.d.ts +33 -0
  379. package/jest-preset.cjs +17 -0
  380. package/package.json +178 -4
@@ -0,0 +1,56 @@
1
+ // @ctrl/dom additions (not in @testing-library/dom): `@ctrl/dom/testing-library/agent`, the
2
+ // support behind jest-dom's `toMatchAriaSnapshot` and the failure snapshots of the agent debug
3
+ // mode. See docs/agent-debugging.md in the repository.
4
+
5
+ /** One line of a template-vs-tree diff: `=` equal, `-` only in the template, `+` only in the tree. */
6
+ export interface AriaSnapshotDiffLine {
7
+ kind: '=' | '-' | '+'
8
+ text: string
9
+ }
10
+
11
+ export interface AriaSnapshotMatch {
12
+ /** Whether the accessibility tree contains the template (Playwright's partial matching). */
13
+ pass: boolean
14
+ /** The template in canonical form, one line per node. */
15
+ expected(): string
16
+ /** The template against the closest part of the tree, in the template's shape. */
17
+ diff(): AriaSnapshotDiffLine[]
18
+ /** The whole aria snapshot (budgeted, sibling runs not collapsed), usable as a template. */
19
+ received(): string
20
+ }
21
+
22
+ /** A template that is not valid aria snapshot YAML. */
23
+ export class AriaTemplateError extends Error {}
24
+
25
+ /**
26
+ * Matches the accessibility tree of `container` against an aria snapshot template with
27
+ * Playwright's semantics (https://playwright.dev/docs/aria-snapshots): partial, ordered child
28
+ * matching, names as strings or `/regex/`, `[checked]` / `[level=2]` states, `- text:` runs.
29
+ */
30
+ export function matchAriaSnapshot(
31
+ container: Element | Document | DocumentFragment,
32
+ template: string,
33
+ ): AriaSnapshotMatch
34
+
35
+ /** `CTRL_DOM_DEBUG` when it names an agent format, else null. */
36
+ export function envDebugFormat(): 'aria' | 'compact' | null
37
+
38
+ /** `document.body` when a test failed, for a failure report. */
39
+ export interface FailureSnapshot {
40
+ format: 'aria' | 'compact'
41
+ text: string
42
+ full: string
43
+ previous: string | undefined
44
+ }
45
+
46
+ /** Forget the previous snapshot (call when a test starts). */
47
+ export function resetFailureSnapshot(document: Document): void
48
+
49
+ /** Snapshot `document.body`; null when `CTRL_DOM_DEBUG` is unset. */
50
+ export function captureFailureSnapshot(document: Document): FailureSnapshot | null
51
+
52
+ /** The report appended to a failing test's error message. */
53
+ export function formatFailureSnapshot(snapshot: FailureSnapshot, errorMessage: string): string
54
+
55
+ /** Append text to an error's message and stack. */
56
+ export function appendToErrorMessage(error: unknown, text: string): boolean
@@ -0,0 +1,99 @@
1
+ // ARIA role names, copied from @types/aria-query@5.0.4 (MIT) so the published typings do not
2
+ // need aria-query. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aria-query/index.d.ts
3
+
4
+ export type ARIAWidgetRole =
5
+ | "button"
6
+ | "checkbox"
7
+ | "gridcell"
8
+ | "link"
9
+ | "menuitem"
10
+ | "menuitemcheckbox"
11
+ | "menuitemradio"
12
+ | "option"
13
+ | "progressbar"
14
+ | "radio"
15
+ | "scrollbar"
16
+ | "searchbox"
17
+ | "slider"
18
+ | "spinbutton"
19
+ | "switch"
20
+ | "tab"
21
+ | "tabpanel"
22
+ | "textbox"
23
+ | "treeitem";
24
+
25
+ export type ARIACompositeWidgetRole =
26
+ | "combobox"
27
+ | "grid"
28
+ | "listbox"
29
+ | "menu"
30
+ | "menubar"
31
+ | "radiogroup"
32
+ | "tablist"
33
+ | "tree"
34
+ | "treegrid";
35
+
36
+ export type ARIADocumentStructureRole =
37
+ | "application"
38
+ | "article"
39
+ | "blockquote"
40
+ | "caption"
41
+ | "cell"
42
+ | "columnheader"
43
+ | "definition"
44
+ | "deletion"
45
+ | "directory"
46
+ | "document"
47
+ | "emphasis"
48
+ | "feed"
49
+ | "figure"
50
+ | "generic"
51
+ | "group"
52
+ | "heading"
53
+ | "img"
54
+ | "insertion"
55
+ | "list"
56
+ | "listitem"
57
+ | "math"
58
+ | "meter"
59
+ | "none"
60
+ | "note"
61
+ | "paragraph"
62
+ | "presentation"
63
+ | "row"
64
+ | "rowgroup"
65
+ | "rowheader"
66
+ | "separator"
67
+ | "strong"
68
+ | "subscript"
69
+ | "superscript"
70
+ | "table"
71
+ | "term"
72
+ | "time"
73
+ | "toolbar"
74
+ | "tooltip";
75
+
76
+ export type ARIALandmarkRole =
77
+ | "banner"
78
+ | "complementary"
79
+ | "contentinfo"
80
+ | "form"
81
+ | "main"
82
+ | "navigation"
83
+ | "region"
84
+ | "search";
85
+
86
+ export type ARIALiveRegionRole = "alert" | "log" | "marquee" | "status" | "timer";
87
+
88
+ export type ARIAWindowRole = "alertdialog" | "dialog";
89
+
90
+ export type ARIAUncategorizedRole = "code";
91
+
92
+ export type ARIARole =
93
+ | ARIAWidgetRole
94
+ | ARIACompositeWidgetRole
95
+ | ARIADocumentStructureRole
96
+ | ARIALandmarkRole
97
+ | ARIALiveRegionRole
98
+ | ARIAWindowRole
99
+ | ARIAUncategorizedRole;
@@ -0,0 +1,43 @@
1
+ // @ctrl/dom additions (not in @testing-library/dom): agent-oriented debugging output.
2
+ // See docs/agent-debugging.md in the repository.
3
+
4
+ export interface AriaSnapshotOptions {
5
+ /** Include elements excluded from the accessibility tree, marked `[hidden]` (default false, like `*ByRole`). */
6
+ hidden?: boolean
7
+ /** Line budget; the rest becomes `# … N more lines` (default 200, or the `CTRL_DOM_DEBUG_LINES` env var). */
8
+ maxLines?: number
9
+ /** Truncate names, values and text to this many characters (default 100). */
10
+ maxTextLength?: number
11
+ /** Runs of more than this many same-role siblings print the first ones and `- role … (+N more)` (default 5; `Infinity` disables). */
12
+ collapseAfter?: number
13
+ /** Print link targets as `- /url: …` children (default false). */
14
+ urls?: boolean
15
+ }
16
+
17
+ /**
18
+ * The accessibility tree of `container` (default `document.body`) in Playwright's aria snapshot
19
+ * YAML (https://playwright.dev/docs/aria-snapshots): roles, accessible names, the states
20
+ * `*ByRole` filters on (`[checked]`, `[disabled]`, `[expanded]`, `[pressed]`, `[selected]`,
21
+ * `[level=N]`, `[current=…]`), textbox/slider values after the colon, text, and `[active]` on
22
+ * the focused element. Elements without a role are skipped (their children hoisted). Computed
23
+ * with the same role/name/hidden rules as `*ByRole`, so it shows exactly what queries match.
24
+ *
25
+ * A token-cheap alternative to `prettyDOM` for reading a failing test:
26
+ *
27
+ * ```
28
+ * - heading "Checkout" [level=1]
29
+ * - textbox "Email" [active]: ada@example.com
30
+ * - checkbox "Remember me" [checked]
31
+ * - button "Pay" [disabled]
32
+ * ```
33
+ */
34
+ export function ariaSnapshot(
35
+ container?: Element | Document | DocumentFragment,
36
+ options?: AriaSnapshotOptions,
37
+ ): string
38
+
39
+ /**
40
+ * A compact diff of two `ariaSnapshot()` results: removed lines (`- `), added lines (`+ `) and
41
+ * their unchanged parent lines as context; `"(no changes)"` when equal.
42
+ */
43
+ export function diffAriaSnapshots(before: string, after: string): string
@@ -0,0 +1,27 @@
1
+ export interface Config {
2
+ testIdAttribute: string
3
+ /**
4
+ * WARNING: `unstable` prefix means this API may change in patch and minor releases.
5
+ * @param cb
6
+ */
7
+ unstable_advanceTimersWrapper(cb: (...args: unknown[]) => unknown): unknown
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ asyncWrapper(cb: (...args: any[]) => any): Promise<any>
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ eventWrapper(cb: (...args: any[]) => any): void
12
+ asyncUtilTimeout: number
13
+ computedStyleSupportsPseudoElements: boolean
14
+ defaultHidden: boolean
15
+ /** default value for the `ignore` option in `ByText` queries */
16
+ defaultIgnore: string
17
+ showOriginalStackTrace: boolean
18
+ throwSuggestions: boolean
19
+ getElementError: (message: string | null, container: Element) => Error
20
+ }
21
+
22
+ export interface ConfigFn {
23
+ (existingConfig: Config): Partial<Config>
24
+ }
25
+
26
+ export function configure(configDelta: ConfigFn | Partial<Config>): void
27
+ export function getConfig(): Config
@@ -0,0 +1,118 @@
1
+ export type EventType =
2
+ | 'copy'
3
+ | 'cut'
4
+ | 'paste'
5
+ | 'compositionEnd'
6
+ | 'compositionStart'
7
+ | 'compositionUpdate'
8
+ | 'keyDown'
9
+ | 'keyPress'
10
+ | 'keyUp'
11
+ | 'focus'
12
+ | 'blur'
13
+ | 'focusIn'
14
+ | 'focusOut'
15
+ | 'change'
16
+ | 'input'
17
+ | 'invalid'
18
+ | 'submit'
19
+ | 'reset'
20
+ | 'click'
21
+ | 'contextMenu'
22
+ | 'dblClick'
23
+ | 'drag'
24
+ | 'dragEnd'
25
+ | 'dragEnter'
26
+ | 'dragExit'
27
+ | 'dragLeave'
28
+ | 'dragOver'
29
+ | 'dragStart'
30
+ | 'drop'
31
+ | 'mouseDown'
32
+ | 'mouseEnter'
33
+ | 'mouseLeave'
34
+ | 'mouseMove'
35
+ | 'mouseOut'
36
+ | 'mouseOver'
37
+ | 'mouseUp'
38
+ | 'popState'
39
+ | 'select'
40
+ | 'touchCancel'
41
+ | 'touchEnd'
42
+ | 'touchMove'
43
+ | 'touchStart'
44
+ | 'resize'
45
+ | 'scroll'
46
+ | 'wheel'
47
+ | 'abort'
48
+ | 'canPlay'
49
+ | 'canPlayThrough'
50
+ | 'durationChange'
51
+ | 'emptied'
52
+ | 'encrypted'
53
+ | 'ended'
54
+ | 'loadedData'
55
+ | 'loadedMetadata'
56
+ | 'loadStart'
57
+ | 'pause'
58
+ | 'play'
59
+ | 'playing'
60
+ | 'progress'
61
+ | 'rateChange'
62
+ | 'seeked'
63
+ | 'seeking'
64
+ | 'stalled'
65
+ | 'suspend'
66
+ | 'timeUpdate'
67
+ | 'volumeChange'
68
+ | 'waiting'
69
+ | 'load'
70
+ | 'error'
71
+ | 'animationStart'
72
+ | 'animationEnd'
73
+ | 'animationIteration'
74
+ | 'transitionCancel'
75
+ | 'transitionEnd'
76
+ | 'transitionRun'
77
+ | 'transitionStart'
78
+ | 'doubleClick'
79
+ | 'pointerOver'
80
+ | 'pointerEnter'
81
+ | 'pointerDown'
82
+ | 'pointerMove'
83
+ | 'pointerUp'
84
+ | 'pointerCancel'
85
+ | 'pointerOut'
86
+ | 'pointerLeave'
87
+ | 'gotPointerCapture'
88
+ | 'lostPointerCapture'
89
+ | 'offline'
90
+ | 'online'
91
+ | 'pageHide'
92
+ | 'pageShow'
93
+
94
+ export type FireFunction = (
95
+ element: Document | Element | Window | Node,
96
+ event: Event,
97
+ ) => boolean
98
+ export type FireObject = {
99
+ [K in EventType]: (
100
+ element: Document | Element | Window | Node,
101
+ options?: {},
102
+ ) => boolean
103
+ }
104
+ export type CreateFunction = (
105
+ eventName: string,
106
+ node: Document | Element | Window | Node,
107
+ init?: {},
108
+ options?: {EventType?: string; defaultInit?: {}},
109
+ ) => Event
110
+ export type CreateObject = {
111
+ [K in EventType]: (
112
+ element: Document | Element | Window | Node,
113
+ options?: {},
114
+ ) => Event
115
+ }
116
+
117
+ export const createEvent: CreateObject & CreateFunction
118
+ export const fireEvent: FireFunction & FireObject
@@ -0,0 +1 @@
1
+ export function getNodeText(node: HTMLElement): string
@@ -0,0 +1,182 @@
1
+ import * as queries from './queries.js'
2
+
3
+ export type BoundFunction<T> = T extends (
4
+ container: HTMLElement,
5
+ ...args: infer P
6
+ ) => infer R
7
+ ? (...args: P) => R
8
+ : never
9
+
10
+ export type BoundFunctions<Q> = Q extends typeof queries
11
+ ? {
12
+ getByLabelText<T extends HTMLElement = HTMLElement>(
13
+ ...args: Parameters<BoundFunction<queries.GetByText<T>>>
14
+ ): ReturnType<queries.GetByText<T>>
15
+ getAllByLabelText<T extends HTMLElement = HTMLElement>(
16
+ ...args: Parameters<BoundFunction<queries.AllByText<T>>>
17
+ ): ReturnType<queries.AllByText<T>>
18
+ queryByLabelText<T extends HTMLElement = HTMLElement>(
19
+ ...args: Parameters<BoundFunction<queries.QueryByText<T>>>
20
+ ): ReturnType<queries.QueryByText<T>>
21
+ queryAllByLabelText<T extends HTMLElement = HTMLElement>(
22
+ ...args: Parameters<BoundFunction<queries.AllByText<T>>>
23
+ ): ReturnType<queries.AllByText<T>>
24
+ findByLabelText<T extends HTMLElement = HTMLElement>(
25
+ ...args: Parameters<BoundFunction<queries.FindByText<T>>>
26
+ ): ReturnType<queries.FindByText<T>>
27
+ findAllByLabelText<T extends HTMLElement = HTMLElement>(
28
+ ...args: Parameters<BoundFunction<queries.FindAllByText<T>>>
29
+ ): ReturnType<queries.FindAllByText<T>>
30
+ getByPlaceholderText<T extends HTMLElement = HTMLElement>(
31
+ ...args: Parameters<BoundFunction<queries.GetByBoundAttribute<T>>>
32
+ ): ReturnType<queries.GetByBoundAttribute<T>>
33
+ getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
34
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
35
+ ): ReturnType<queries.AllByBoundAttribute<T>>
36
+ queryByPlaceholderText<T extends HTMLElement = HTMLElement>(
37
+ ...args: Parameters<BoundFunction<queries.QueryByBoundAttribute<T>>>
38
+ ): ReturnType<queries.QueryByBoundAttribute<T>>
39
+ queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
40
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
41
+ ): ReturnType<queries.AllByBoundAttribute<T>>
42
+ findByPlaceholderText<T extends HTMLElement = HTMLElement>(
43
+ ...args: Parameters<BoundFunction<queries.FindByBoundAttribute<T>>>
44
+ ): ReturnType<queries.FindByBoundAttribute<T>>
45
+ findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(
46
+ ...args: Parameters<BoundFunction<queries.FindAllByBoundAttribute<T>>>
47
+ ): ReturnType<queries.FindAllByBoundAttribute<T>>
48
+ getByText<T extends HTMLElement = HTMLElement>(
49
+ ...args: Parameters<BoundFunction<queries.GetByText<T>>>
50
+ ): ReturnType<queries.GetByText<T>>
51
+ getAllByText<T extends HTMLElement = HTMLElement>(
52
+ ...args: Parameters<BoundFunction<queries.AllByText<T>>>
53
+ ): ReturnType<queries.AllByText<T>>
54
+ queryByText<T extends HTMLElement = HTMLElement>(
55
+ ...args: Parameters<BoundFunction<queries.QueryByText<T>>>
56
+ ): ReturnType<queries.QueryByText<T>>
57
+ queryAllByText<T extends HTMLElement = HTMLElement>(
58
+ ...args: Parameters<BoundFunction<queries.AllByText<T>>>
59
+ ): ReturnType<queries.AllByText<T>>
60
+ findByText<T extends HTMLElement = HTMLElement>(
61
+ ...args: Parameters<BoundFunction<queries.FindByText<T>>>
62
+ ): ReturnType<queries.FindByText<T>>
63
+ findAllByText<T extends HTMLElement = HTMLElement>(
64
+ ...args: Parameters<BoundFunction<queries.FindAllByText<T>>>
65
+ ): ReturnType<queries.FindAllByText<T>>
66
+ getByAltText<T extends HTMLElement = HTMLElement>(
67
+ ...args: Parameters<BoundFunction<queries.GetByBoundAttribute<T>>>
68
+ ): ReturnType<queries.GetByBoundAttribute<T>>
69
+ getAllByAltText<T extends HTMLElement = HTMLElement>(
70
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
71
+ ): ReturnType<queries.AllByBoundAttribute<T>>
72
+ queryByAltText<T extends HTMLElement = HTMLElement>(
73
+ ...args: Parameters<BoundFunction<queries.QueryByBoundAttribute<T>>>
74
+ ): ReturnType<queries.QueryByBoundAttribute<T>>
75
+ queryAllByAltText<T extends HTMLElement = HTMLElement>(
76
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
77
+ ): ReturnType<queries.AllByBoundAttribute<T>>
78
+ findByAltText<T extends HTMLElement = HTMLElement>(
79
+ ...args: Parameters<BoundFunction<queries.FindByBoundAttribute<T>>>
80
+ ): ReturnType<queries.FindByBoundAttribute<T>>
81
+ findAllByAltText<T extends HTMLElement = HTMLElement>(
82
+ ...args: Parameters<BoundFunction<queries.FindAllByBoundAttribute<T>>>
83
+ ): ReturnType<queries.FindAllByBoundAttribute<T>>
84
+ getByTitle<T extends HTMLElement = HTMLElement>(
85
+ ...args: Parameters<BoundFunction<queries.GetByBoundAttribute<T>>>
86
+ ): ReturnType<queries.GetByBoundAttribute<T>>
87
+ getAllByTitle<T extends HTMLElement = HTMLElement>(
88
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
89
+ ): ReturnType<queries.AllByBoundAttribute<T>>
90
+ queryByTitle<T extends HTMLElement = HTMLElement>(
91
+ ...args: Parameters<BoundFunction<queries.QueryByBoundAttribute<T>>>
92
+ ): ReturnType<queries.QueryByBoundAttribute<T>>
93
+ queryAllByTitle<T extends HTMLElement = HTMLElement>(
94
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
95
+ ): ReturnType<queries.AllByBoundAttribute<T>>
96
+ findByTitle<T extends HTMLElement = HTMLElement>(
97
+ ...args: Parameters<BoundFunction<queries.FindByBoundAttribute<T>>>
98
+ ): ReturnType<queries.FindByBoundAttribute<T>>
99
+ findAllByTitle<T extends HTMLElement = HTMLElement>(
100
+ ...args: Parameters<BoundFunction<queries.FindAllByBoundAttribute<T>>>
101
+ ): ReturnType<queries.FindAllByBoundAttribute<T>>
102
+ getByDisplayValue<T extends HTMLElement = HTMLElement>(
103
+ ...args: Parameters<BoundFunction<queries.GetByBoundAttribute<T>>>
104
+ ): ReturnType<queries.GetByBoundAttribute<T>>
105
+ getAllByDisplayValue<T extends HTMLElement = HTMLElement>(
106
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
107
+ ): ReturnType<queries.AllByBoundAttribute<T>>
108
+ queryByDisplayValue<T extends HTMLElement = HTMLElement>(
109
+ ...args: Parameters<BoundFunction<queries.QueryByBoundAttribute<T>>>
110
+ ): ReturnType<queries.QueryByBoundAttribute<T>>
111
+ queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(
112
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
113
+ ): ReturnType<queries.AllByBoundAttribute<T>>
114
+ findByDisplayValue<T extends HTMLElement = HTMLElement>(
115
+ ...args: Parameters<BoundFunction<queries.FindByBoundAttribute<T>>>
116
+ ): ReturnType<queries.FindByBoundAttribute<T>>
117
+ findAllByDisplayValue<T extends HTMLElement = HTMLElement>(
118
+ ...args: Parameters<BoundFunction<queries.FindAllByBoundAttribute<T>>>
119
+ ): ReturnType<queries.FindAllByBoundAttribute<T>>
120
+ getByRole<T extends HTMLElement = HTMLElement>(
121
+ ...args: Parameters<BoundFunction<queries.GetByRole<T>>>
122
+ ): ReturnType<queries.GetByRole<T>>
123
+ getAllByRole<T extends HTMLElement = HTMLElement>(
124
+ ...args: Parameters<BoundFunction<queries.AllByRole<T>>>
125
+ ): ReturnType<queries.AllByRole<T>>
126
+ queryByRole<T extends HTMLElement = HTMLElement>(
127
+ ...args: Parameters<BoundFunction<queries.QueryByRole<T>>>
128
+ ): ReturnType<queries.QueryByRole<T>>
129
+ queryAllByRole<T extends HTMLElement = HTMLElement>(
130
+ ...args: Parameters<BoundFunction<queries.AllByRole<T>>>
131
+ ): ReturnType<queries.AllByRole<T>>
132
+ findByRole<T extends HTMLElement = HTMLElement>(
133
+ ...args: Parameters<BoundFunction<queries.FindByRole<T>>>
134
+ ): ReturnType<queries.FindByRole<T>>
135
+ findAllByRole<T extends HTMLElement = HTMLElement>(
136
+ ...args: Parameters<BoundFunction<queries.FindAllByRole<T>>>
137
+ ): ReturnType<queries.FindAllByRole<T>>
138
+ getByTestId<T extends HTMLElement = HTMLElement>(
139
+ ...args: Parameters<BoundFunction<queries.GetByBoundAttribute<T>>>
140
+ ): ReturnType<queries.GetByBoundAttribute<T>>
141
+ getAllByTestId<T extends HTMLElement = HTMLElement>(
142
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
143
+ ): ReturnType<queries.AllByBoundAttribute<T>>
144
+ queryByTestId<T extends HTMLElement = HTMLElement>(
145
+ ...args: Parameters<BoundFunction<queries.QueryByBoundAttribute<T>>>
146
+ ): ReturnType<queries.QueryByBoundAttribute<T>>
147
+ queryAllByTestId<T extends HTMLElement = HTMLElement>(
148
+ ...args: Parameters<BoundFunction<queries.AllByBoundAttribute<T>>>
149
+ ): ReturnType<queries.AllByBoundAttribute<T>>
150
+ findByTestId<T extends HTMLElement = HTMLElement>(
151
+ ...args: Parameters<BoundFunction<queries.FindByBoundAttribute<T>>>
152
+ ): ReturnType<queries.FindByBoundAttribute<T>>
153
+ findAllByTestId<T extends HTMLElement = HTMLElement>(
154
+ ...args: Parameters<BoundFunction<queries.FindAllByBoundAttribute<T>>>
155
+ ): ReturnType<queries.FindAllByBoundAttribute<T>>
156
+ } & {
157
+ [P in keyof Q]: BoundFunction<Q[P]>
158
+ }
159
+ : {
160
+ [P in keyof Q]: BoundFunction<Q[P]>
161
+ }
162
+
163
+ export type Query = (
164
+ container: HTMLElement,
165
+ ...args: any[]
166
+ ) =>
167
+ | Error
168
+ | HTMLElement
169
+ | HTMLElement[]
170
+ | Promise<HTMLElement[]>
171
+ | Promise<HTMLElement>
172
+ | null
173
+
174
+ export interface Queries {
175
+ [T: string]: Query
176
+ }
177
+
178
+ export function getQueriesForElement<
179
+ QueriesToBind extends Queries = typeof queries,
180
+ // Extra type parameter required for reassignment.
181
+ T extends QueriesToBind = QueriesToBind,
182
+ >(element: HTMLElement, queriesToBind?: T): BoundFunctions<T>
@@ -0,0 +1,24 @@
1
+ // Ported from @testing-library/dom@10.4.2 types/ (MIT) — https://github.com/testing-library/dom-testing-library/tree/main/types
2
+ // TypeScript Version: 3.8
3
+
4
+ import {getQueriesForElement} from './get-queries-for-element.js'
5
+ import * as queries from './queries.js'
6
+ import * as queryHelpers from './query-helpers.js'
7
+
8
+ declare const within: typeof getQueriesForElement
9
+ export {queries, queryHelpers, within}
10
+
11
+ export * from './queries.js'
12
+ export * from './query-helpers.js'
13
+ export * from './screen.js'
14
+ export * from './wait-for.js'
15
+ export * from './wait-for-element-to-be-removed.js'
16
+ export * from './matches.js'
17
+ export * from './get-node-text.js'
18
+ export * from './events.js'
19
+ export * from './get-queries-for-element.js'
20
+ export * from './pretty-dom.js'
21
+ export * from './role-helpers.js'
22
+ export * from './config.js'
23
+ export * from './suggestions.js'
24
+ export * from './aria-snapshot.js'
@@ -0,0 +1,46 @@
1
+ import {ARIARole} from './aria-role.js'
2
+
3
+ export type MatcherFunction = (
4
+ content: string,
5
+ element: Element | null,
6
+ ) => boolean
7
+ export type Matcher = MatcherFunction | RegExp | number | string
8
+
9
+ // Get autocomplete for ARIARole union types, while still supporting another string
10
+ // Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
11
+ export type ByRoleMatcher = ARIARole | (string & {})
12
+
13
+ export type NormalizerFn = (text: string) => string
14
+
15
+ export interface NormalizerOptions extends DefaultNormalizerOptions {
16
+ normalizer?: NormalizerFn
17
+ }
18
+
19
+ export interface MatcherOptions {
20
+ exact?: boolean
21
+ /** Use normalizer with getDefaultNormalizer instead */
22
+ trim?: boolean
23
+ /** Use normalizer with getDefaultNormalizer instead */
24
+ collapseWhitespace?: boolean
25
+ normalizer?: NormalizerFn
26
+ /** suppress suggestions for a specific query */
27
+ suggest?: boolean
28
+ }
29
+
30
+ export type Match = (
31
+ textToMatch: string,
32
+ node: HTMLElement | null,
33
+ matcher: Matcher,
34
+ options?: MatcherOptions,
35
+ ) => boolean
36
+
37
+ export interface DefaultNormalizerOptions {
38
+ trim?: boolean
39
+ collapseWhitespace?: boolean
40
+ }
41
+
42
+ export function getDefaultNormalizer(
43
+ options?: DefaultNormalizerOptions,
44
+ ): NormalizerFn
45
+
46
+ // N.B. Don't expose fuzzyMatches + matches here: they're not public API
@@ -0,0 +1,37 @@
1
+ import * as prettyFormat from 'pretty-format'
2
+ import {AriaSnapshotOptions} from './aria-snapshot.js'
3
+
4
+ export interface PrettyDOMOptions extends prettyFormat.OptionsReceived {
5
+ /**
6
+ * Given a `Node` return `false` if you wish to ignore that node in the output.
7
+ * By default, ignores `<style />`, `<script />` and comment nodes.
8
+ */
9
+ filterNode?: (node: Node) => boolean
10
+ /**
11
+ * @ctrl/dom addition. `"pretty"`: upstream's HTML. `"aria"`: the accessibility snapshot
12
+ * (see `ariaSnapshot`; its options apply). `"compact"`: HTML without `class`/`style`
13
+ * attributes and SVG internals. Defaults to the `CTRL_DOM_DEBUG` environment variable
14
+ * (`aria` or `compact`), else `"pretty"`.
15
+ */
16
+ format?: DebugFormat
17
+ hidden?: AriaSnapshotOptions['hidden']
18
+ maxLines?: AriaSnapshotOptions['maxLines']
19
+ maxTextLength?: AriaSnapshotOptions['maxTextLength']
20
+ collapseAfter?: AriaSnapshotOptions['collapseAfter']
21
+ urls?: AriaSnapshotOptions['urls']
22
+ }
23
+
24
+ /** @ctrl/dom addition: output formats of `prettyDOM` / `screen.debug`. */
25
+ export type DebugFormat = 'pretty' | 'aria' | 'compact'
26
+
27
+ export function prettyDOM(
28
+ dom?: Element | HTMLDocument,
29
+ maxLength?: number,
30
+ options?: PrettyDOMOptions,
31
+ ): string | false
32
+ export function logDOM(
33
+ dom?: Element | HTMLDocument,
34
+ maxLength?: number,
35
+ options?: PrettyDOMOptions,
36
+ ): void
37
+ export {prettyFormat}