@ctrl/dom 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-DWP2w3IQ.js +47516 -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 +153 -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 +3910 -0
  267. package/dist/user-event/index.js +3885 -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 +50 -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 +177 -3
@@ -0,0 +1,1079 @@
1
+ // Copied from @testing-library/jest-dom@7.0.1 types/matchers.d.ts (MIT) — the public types of this drop-in.
2
+ // https://github.com/testing-library/jest-dom/blob/v7.0.1/types/matchers.d.ts
3
+ import {type ARIARole} from 'aria-query'
4
+ import {
5
+ type AllByBoundAttribute,
6
+ type AllByRole,
7
+ type AllByText,
8
+ } from '@ctrl/dom/testing-library'
9
+
10
+ declare namespace matchers {
11
+ interface DomQueryFunction {
12
+ (container: HTMLElement, ...args: any[]): HTMLElement[]
13
+ }
14
+
15
+ type DomQueryArgs<F extends DomQueryFunction = DomQueryFunction> = F extends (
16
+ container: HTMLElement,
17
+ ...args: infer A
18
+ ) => HTMLElement[]
19
+ ? A
20
+ : never
21
+
22
+ type DomQueryByBoundAttributeArgs = DomQueryArgs<AllByBoundAttribute>
23
+ type DomQueryByRoleArgs = DomQueryArgs<AllByRole>
24
+ type DomQueryByTextArgs = DomQueryArgs<AllByText>
25
+
26
+ interface TestingLibraryMatchers<E, R> {
27
+ /**
28
+ * @deprecated
29
+ * since v1.9.0
30
+ * @description
31
+ * Assert whether a value is a DOM element, or not. Contrary to what its name implies, this matcher only checks
32
+ * that you passed to it a valid DOM element.
33
+ *
34
+ * It does not have a clear definition of what "the DOM" is. Therefore, it does not check whether that element
35
+ * is contained anywhere.
36
+ * @see
37
+ * [testing-library/jest-dom#toBeInTheDom](https://github.com/testing-library/jest-dom#toBeInTheDom)
38
+ */
39
+ toBeInTheDOM(container?: HTMLElement | SVGElement): R
40
+ /**
41
+ * @description
42
+ * Assert whether an element is present in the document or not.
43
+ * @example
44
+ * <svg data-testid="svg-element"></svg>
45
+ *
46
+ * expect(queryByTestId('svg-element')).toBeInTheDocument()
47
+ * expect(queryByTestId('does-not-exist')).not.toBeInTheDocument()
48
+ * @see
49
+ * [testing-library/jest-dom#tobeinthedocument](https://github.com/testing-library/jest-dom#tobeinthedocument)
50
+ */
51
+ toBeInTheDocument(): R
52
+ /**
53
+ * @description
54
+ * This allows you to check if an element is currently visible to the user.
55
+ *
56
+ * An element is visible if **all** the following conditions are met:
57
+ * * it does not have its css property display set to none
58
+ * * it does not have its css property visibility set to either hidden or collapse
59
+ * * it does not have its css property opacity set to 0
60
+ * * its parent element is also visible (and so on up to the top of the DOM tree)
61
+ * * it does not have the hidden attribute
62
+ * * if `<details />` it has the open attribute
63
+ * @example
64
+ * <div
65
+ * data-testid="zero-opacity"
66
+ * style="opacity: 0"
67
+ * >
68
+ * Zero Opacity
69
+ * </div>
70
+ *
71
+ * <div data-testid="visible">Visible Example</div>
72
+ *
73
+ * expect(getByTestId('zero-opacity')).not.toBeVisible()
74
+ * expect(getByTestId('visible')).toBeVisible()
75
+ * @see
76
+ * [testing-library/jest-dom#tobevisible](https://github.com/testing-library/jest-dom#tobevisible)
77
+ */
78
+ toBeVisible(): R
79
+ /**
80
+ * @deprecated
81
+ * since v5.9.0
82
+ * @description
83
+ * Assert whether an element has content or not.
84
+ * @example
85
+ * <span data-testid="not-empty">
86
+ * <span data-testid="empty"></span>
87
+ * </span>
88
+ *
89
+ * expect(getByTestId('empty')).toBeEmpty()
90
+ * expect(getByTestId('not-empty')).not.toBeEmpty()
91
+ * @see
92
+ * [testing-library/jest-dom#tobeempty](https://github.com/testing-library/jest-dom#tobeempty)
93
+ */
94
+ toBeEmpty(): R
95
+ /**
96
+ * @description
97
+ * Assert whether an element has content or not.
98
+ * @example
99
+ * <span data-testid="not-empty">
100
+ * <span data-testid="empty"></span>
101
+ * </span>
102
+ *
103
+ * expect(getByTestId('empty')).toBeEmptyDOMElement()
104
+ * expect(getByTestId('not-empty')).not.toBeEmptyDOMElement()
105
+ * @see
106
+ * [testing-library/jest-dom#tobeemptydomelement](https://github.com/testing-library/jest-dom#tobeemptydomelement)
107
+ */
108
+ toBeEmptyDOMElement(): R
109
+ /**
110
+ * @description
111
+ * Allows you to check whether an element is disabled from the user's perspective.
112
+ *
113
+ * Matches if the element is a form control and the `disabled` attribute is specified on this element or the
114
+ * element is a descendant of a form element with a `disabled` attribute.
115
+ * @example
116
+ * <button
117
+ * data-testid="button"
118
+ * type="submit"
119
+ * disabled
120
+ * >
121
+ * submit
122
+ * </button>
123
+ *
124
+ * expect(getByTestId('button')).toBeDisabled()
125
+ * @see
126
+ * [testing-library/jest-dom#tobedisabled](https://github.com/testing-library/jest-dom#tobedisabled)
127
+ */
128
+ toBeDisabled(): R
129
+ /**
130
+ * @description
131
+ * Allows you to check whether an element is not disabled from the user's perspective.
132
+ *
133
+ * Works like `not.toBeDisabled()`.
134
+ *
135
+ * Use this matcher to avoid double negation in your tests.
136
+ * @example
137
+ * <button
138
+ * data-testid="button"
139
+ * type="submit"
140
+ * >
141
+ * submit
142
+ * </button>
143
+ *
144
+ * expect(getByTestId('button')).toBeEnabled()
145
+ * @see
146
+ * [testing-library/jest-dom#tobeenabled](https://github.com/testing-library/jest-dom#tobeenabled)
147
+ */
148
+ toBeEnabled(): R
149
+ /**
150
+ * @description
151
+ * Check if a form element, or the entire `form`, is currently invalid.
152
+ *
153
+ * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no
154
+ * value or a value of "true", or if the result of `checkValidity()` is false.
155
+ * @example
156
+ * <input data-testid="no-aria-invalid" />
157
+ *
158
+ * <form data-testid="invalid-form">
159
+ * <input required />
160
+ * </form>
161
+ *
162
+ * expect(getByTestId('no-aria-invalid')).not.toBeInvalid()
163
+ * expect(getByTestId('invalid-form')).toBeInvalid()
164
+ * @see
165
+ * [testing-library/jest-dom#tobeinvalid](https://github.com/testing-library/jest-dom#tobeinvalid)
166
+ */
167
+ toBeInvalid(): R
168
+ /**
169
+ * @description
170
+ * This allows you to check if a form element is currently required.
171
+ *
172
+ * An element is required if it is having a `required` or `aria-required="true"` attribute.
173
+ * @example
174
+ * <input data-testid="required-input" required />
175
+ * <div
176
+ * data-testid="supported-role"
177
+ * role="tree"
178
+ * required />
179
+ *
180
+ * expect(getByTestId('required-input')).toBeRequired()
181
+ * expect(getByTestId('supported-role')).not.toBeRequired()
182
+ * @see
183
+ * [testing-library/jest-dom#toberequired](https://github.com/testing-library/jest-dom#toberequired)
184
+ */
185
+ toBeRequired(): R
186
+ /**
187
+ * @description
188
+ * Allows you to check if a form element is currently required.
189
+ *
190
+ * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no
191
+ * value or a value of "false", or if the result of `checkValidity()` is true.
192
+ * @example
193
+ * <input data-testid="aria-invalid" aria-invalid />
194
+ *
195
+ * <form data-testid="valid-form">
196
+ * <input />
197
+ * </form>
198
+ *
199
+ * expect(getByTestId('no-aria-invalid')).not.toBeValid()
200
+ * expect(getByTestId('invalid-form')).toBeInvalid()
201
+ * @see
202
+ * [testing-library/jest-dom#tobevalid](https://github.com/testing-library/jest-dom#tobevalid)
203
+ */
204
+ toBeValid(): R
205
+ /**
206
+ * @description
207
+ * Allows you to assert whether an element contains another element as a descendant or not.
208
+ * @example
209
+ * <span data-testid="ancestor">
210
+ * <span data-testid="descendant"></span>
211
+ * </span>
212
+ *
213
+ * const ancestor = getByTestId('ancestor')
214
+ * const descendant = getByTestId('descendant')
215
+ * const nonExistantElement = getByTestId('does-not-exist')
216
+ * expect(ancestor).toContainElement(descendant)
217
+ * expect(descendant).not.toContainElement(ancestor)
218
+ * expect(ancestor).not.toContainElement(nonExistantElement)
219
+ * @see
220
+ * [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement)
221
+ */
222
+ toContainElement(element: HTMLElement | SVGElement | null): R
223
+ /**
224
+ * @description
225
+ * Assert whether a string representing a HTML element is contained in another element.
226
+ * @example
227
+ * <span data-testid="parent"><span data-testid="child"></span></span>
228
+ *
229
+ * expect(getByTestId('parent')).toContainHTML('<span data-testid="child"></span>')
230
+ * @see
231
+ * [testing-library/jest-dom#tocontainhtml](https://github.com/testing-library/jest-dom#tocontainhtml)
232
+ */
233
+ toContainHTML(htmlText: string): R
234
+ /**
235
+ * @description
236
+ * Allows you to check if a given element has an attribute or not.
237
+ *
238
+ * You can also optionally check that the attribute has a specific expected value or partial match using
239
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or
240
+ * [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
241
+ * @example
242
+ * <button
243
+ * data-testid="ok-button"
244
+ * type="submit"
245
+ * disabled
246
+ * >
247
+ * ok
248
+ * </button>
249
+ *
250
+ * expect(button).toHaveAttribute('disabled')
251
+ * expect(button).toHaveAttribute('type', 'submit')
252
+ * expect(button).not.toHaveAttribute('type', 'button')
253
+ * @see
254
+ * [testing-library/jest-dom#tohaveattribute](https://github.com/testing-library/jest-dom#tohaveattribute)
255
+ */
256
+ toHaveAttribute(attr: string, value?: unknown): R
257
+ /**
258
+ * @description
259
+ * Check whether the given element has certain classes within its `class` attribute.
260
+ *
261
+ * You must provide at least one class, unless you are asserting that an element does not have any classes.
262
+ * @example
263
+ * <button
264
+ * data-testid="delete-button"
265
+ * class="btn xs btn-danger"
266
+ * >
267
+ * delete item
268
+ * </button>
269
+ *
270
+ * <div data-testid="no-classes">no classes</div>
271
+ *
272
+ * const deleteButton = getByTestId('delete-button')
273
+ * const noClasses = getByTestId('no-classes')
274
+ * expect(deleteButton).toHaveClass('btn')
275
+ * expect(deleteButton).toHaveClass('btn-danger xs')
276
+ * expect(deleteButton).toHaveClass(/danger/, 'xs')
277
+ * expect(deleteButton).toHaveClass('btn xs btn-danger', {exact: true})
278
+ * expect(deleteButton).not.toHaveClass('btn xs btn-danger', {exact: true})
279
+ * expect(noClasses).not.toHaveClass()
280
+ * @see
281
+ * [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass)
282
+ */
283
+ toHaveClass(...classNames: Array<string | RegExp>): R
284
+ toHaveClass(classNames: string, options?: {exact: boolean}): R
285
+ /**
286
+ * @description
287
+ * This allows you to check whether the given form element has the specified displayed value (the one the
288
+ * end user will see). It accepts <input>, <select> and <textarea> elements with the exception of <input type="checkbox">
289
+ * and <input type="radio">, which can be meaningfully matched only using toBeChecked or toHaveFormValues.
290
+ * @example
291
+ * <label for="input-example">First name</label>
292
+ * <input type="text" id="input-example" value="Luca" />
293
+ *
294
+ * <label for="textarea-example">Description</label>
295
+ * <textarea id="textarea-example">An example description here.</textarea>
296
+ *
297
+ * <label for="single-select-example">Fruit</label>
298
+ * <select id="single-select-example">
299
+ * <option value="">Select a fruit...</option>
300
+ * <option value="banana">Banana</option>
301
+ * <option value="ananas">Ananas</option>
302
+ * <option value="avocado">Avocado</option>
303
+ * </select>
304
+ *
305
+ * <label for="mutiple-select-example">Fruits</label>
306
+ * <select id="multiple-select-example" multiple>
307
+ * <option value="">Select a fruit...</option>
308
+ * <option value="banana" selected>Banana</option>
309
+ * <option value="ananas">Ananas</option>
310
+ * <option value="avocado" selected>Avocado</option>
311
+ * </select>
312
+ *
313
+ * const input = screen.getByLabelText('First name')
314
+ * const textarea = screen.getByLabelText('Description')
315
+ * const selectSingle = screen.getByLabelText('Fruit')
316
+ * const selectMultiple = screen.getByLabelText('Fruits')
317
+ *
318
+ * expect(input).toHaveDisplayValue('Luca')
319
+ * expect(textarea).toHaveDisplayValue('An example description here.')
320
+ * expect(selectSingle).toHaveDisplayValue('Select a fruit...')
321
+ * expect(selectMultiple).toHaveDisplayValue(['Banana', 'Avocado'])
322
+ *
323
+ * @see
324
+ * [testing-library/jest-dom#tohavedisplayvalue](https://github.com/testing-library/jest-dom#tohavedisplayvalue)
325
+ */
326
+ toHaveDisplayValue(value: string | RegExp | Array<string | RegExp>): R
327
+ /**
328
+ * @description
329
+ * Assert whether an element has focus or not.
330
+ * @example
331
+ * <div>
332
+ * <input type="text" data-testid="element-to-focus" />
333
+ * </div>
334
+ *
335
+ * const input = getByTestId('element-to-focus')
336
+ * input.focus()
337
+ * expect(input).toHaveFocus()
338
+ * input.blur()
339
+ * expect(input).not.toHaveFocus()
340
+ * @see
341
+ * [testing-library/jest-dom#tohavefocus](https://github.com/testing-library/jest-dom#tohavefocus)
342
+ */
343
+ toHaveFocus(): R
344
+ /**
345
+ * @description
346
+ * Check if a form or fieldset contains form controls for each given name, and having the specified value.
347
+ *
348
+ * Can only be invoked on a form or fieldset element.
349
+ * @example
350
+ * <form data-testid="login-form">
351
+ * <input type="text" name="username" value="jane.doe" />
352
+ * <input type="password" name="password" value="123" />
353
+ * <input type="checkbox" name="rememberMe" checked />
354
+ * <button type="submit">Sign in</button>
355
+ * </form>
356
+ *
357
+ * expect(getByTestId('login-form')).toHaveFormValues({
358
+ * username: 'jane.doe',
359
+ * rememberMe: true,
360
+ * })
361
+ * @see
362
+ * [testing-library/jest-dom#tohaveformvalues](https://github.com/testing-library/jest-dom#tohaveformvalues)
363
+ */
364
+ toHaveFormValues(expectedValues: Record<string, unknown>): R
365
+ /**
366
+ * @description
367
+ * Check if an element has specific css properties with specific values applied.
368
+ *
369
+ * Only matches if the element has *all* the expected properties applied, not just some of them.
370
+ * @example
371
+ * <button
372
+ * data-testid="submit-button"
373
+ * style="background-color: green; display: none"
374
+ * >
375
+ * submit
376
+ * </button>
377
+ *
378
+ * const button = getByTestId('submit-button')
379
+ * expect(button).toHaveStyle('background-color: green')
380
+ * expect(button).toHaveStyle({
381
+ * 'background-color': 'green',
382
+ * display: 'none'
383
+ * })
384
+ * @see
385
+ * [testing-library/jest-dom#tohavestyle](https://github.com/testing-library/jest-dom#tohavestyle)
386
+ */
387
+ toHaveStyle(css: string | Record<string, unknown>): R
388
+ /**
389
+ * @description
390
+ * Check whether the given element has a text content or not.
391
+ *
392
+ * When a string argument is passed through, it will perform a partial case-sensitive match to the element
393
+ * content.
394
+ *
395
+ * To perform a case-insensitive match, you can use a RegExp with the `/i` modifier.
396
+ *
397
+ * If you want to match the whole content, you can use a RegExp to do it.
398
+ * @example
399
+ * <span data-testid="text-content">Text Content</span>
400
+ *
401
+ * const element = getByTestId('text-content')
402
+ * expect(element).toHaveTextContent('Content')
403
+ * // to match the whole content
404
+ * expect(element).toHaveTextContent(/^Text Content$/)
405
+ * // to use case-insentive match
406
+ * expect(element).toHaveTextContent(/content$/i)
407
+ * expect(element).not.toHaveTextContent('content')
408
+ * @see
409
+ * [testing-library/jest-dom#tohavetextcontent](https://github.com/testing-library/jest-dom#tohavetextcontent)
410
+ */
411
+ toHaveTextContent(
412
+ text: string | RegExp,
413
+ options?: {normalizeWhitespace: boolean},
414
+ ): R
415
+ /**
416
+ * @description
417
+ * Check whether the given form element has the specified value.
418
+ *
419
+ * Accepts `<input>`, `<select>`, and `<textarea>` elements with the exception of `<input type="checkbox">` and
420
+ * `<input type="radiobox">`, which can be matched only using
421
+ * [toBeChecked](https://github.com/testing-library/jest-dom#tobechecked) or
422
+ * [toHaveFormValues](https://github.com/testing-library/jest-dom#tohaveformvalues).
423
+ * @example
424
+ * <input
425
+ * type="number"
426
+ * value="5"
427
+ * data-testid="input-number" />
428
+ *
429
+ * const numberInput = getByTestId('input-number')
430
+ * expect(numberInput).toHaveValue(5)
431
+ * @see
432
+ * [testing-library/jest-dom#tohavevalue](https://github.com/testing-library/jest-dom#tohavevalue)
433
+ */
434
+ toHaveValue(value?: string | string[] | number | null): R
435
+ /**
436
+ * @description
437
+ * Assert whether the given element is checked.
438
+ *
439
+ * It accepts an `input` of type `checkbox` or `radio` and elements with a `role` of `radio` with a valid
440
+ * `aria-checked` attribute of "true" or "false".
441
+ * @example
442
+ * <input
443
+ * type="checkbox"
444
+ * checked
445
+ * data-testid="input-checkbox" />
446
+ * <input
447
+ * type="radio"
448
+ * value="foo"
449
+ * data-testid="input-radio" />
450
+ *
451
+ * const inputCheckbox = getByTestId('input-checkbox')
452
+ * const inputRadio = getByTestId('input-radio')
453
+ * expect(inputCheckbox).toBeChecked()
454
+ * expect(inputRadio).not.toBeChecked()
455
+ * @see
456
+ * [testing-library/jest-dom#tobechecked](https://github.com/testing-library/jest-dom#tobechecked)
457
+ */
458
+ toBeChecked(): R
459
+ /**
460
+ * @deprecated
461
+ * since v5.14.1
462
+ * @description
463
+ * Check the accessible description for an element.
464
+ * This allows you to check whether the given element has a description or not.
465
+ *
466
+ * An element gets its description via the
467
+ * [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
468
+ * Set this to the `id` of one or more other elements. These elements may be nested
469
+ * inside, be outside, or a sibling of the passed in element.
470
+ *
471
+ * Whitespace is normalized. Using multiple ids will
472
+ * [join the referenced elements’ text content separated by a space](https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description).
473
+ *
474
+ * When a `string` argument is passed through, it will perform a whole
475
+ * case-sensitive match to the description text.
476
+ *
477
+ * To perform a case-insensitive match, you can use a `RegExp` with the `/i`
478
+ * modifier.
479
+ *
480
+ * To perform a partial match, you can pass a `RegExp` or use
481
+ * `expect.stringContaining("partial string")`.
482
+ *
483
+ * @example
484
+ * <button aria-label="Close" aria-describedby="description-close">
485
+ * X
486
+ * </button>
487
+ * <div id="description-close">
488
+ * Closing will discard any changes
489
+ * </div>
490
+ *
491
+ * <button>Delete</button>
492
+ *
493
+ * const closeButton = getByRole('button', {name: 'Close'})
494
+ *
495
+ * expect(closeButton).toHaveDescription('Closing will discard any changes')
496
+ * expect(closeButton).toHaveDescription(/will discard/) // to partially match
497
+ * expect(closeButton).toHaveDescription(expect.stringContaining('will discard')) // to partially match
498
+ * expect(closeButton).toHaveDescription(/^closing/i) // to use case-insensitive match
499
+ * expect(closeButton).not.toHaveDescription('Other description')
500
+ *
501
+ * const deleteButton = getByRole('button', {name: 'Delete'})
502
+ * expect(deleteButton).not.toHaveDescription()
503
+ * expect(deleteButton).toHaveDescription('') // Missing or empty description always becomes a blank string
504
+ * @see
505
+ * [testing-library/jest-dom#tohavedescription](https://github.com/testing-library/jest-dom#tohavedescription)
506
+ */
507
+ toHaveDescription(text?: string | RegExp | E): R
508
+ /**
509
+ * @description
510
+ * This allows to assert that an element has the expected [accessible description](https://w3c.github.io/accname/).
511
+ *
512
+ * You can pass the exact string of the expected accessible description, or you can make a
513
+ * partial match passing a regular expression, or by using either
514
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
515
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
516
+ * @example
517
+ * <a data-testid="link" href="/" aria-label="Home page" title="A link to start over">Start</a>
518
+ * <a data-testid="extra-link" href="/about" aria-label="About page">About</a>
519
+ * <img src="avatar.jpg" data-testid="avatar" alt="User profile pic" />
520
+ * <img src="logo.jpg" data-testid="logo" alt="Company logo" aria-describedby="t1" />
521
+ * <span id="t1" role="presentation">The logo of Our Company</span>
522
+ *
523
+ * expect(getByTestId('link')).toHaveAccessibleDescription()
524
+ * expect(getByTestId('link')).toHaveAccessibleDescription('A link to start over')
525
+ * expect(getByTestId('link')).not.toHaveAccessibleDescription('Home page')
526
+ * expect(getByTestId('extra-link')).not.toHaveAccessibleDescription()
527
+ * expect(getByTestId('avatar')).not.toHaveAccessibleDescription()
528
+ * expect(getByTestId('logo')).not.toHaveAccessibleDescription('Company logo')
529
+ * expect(getByTestId('logo')).toHaveAccessibleDescription('The logo of Our Company')
530
+ * @see
531
+ * [testing-library/jest-dom#tohaveaccessibledescription](https://github.com/testing-library/jest-dom#tohaveaccessibledescription)
532
+ */
533
+ toHaveAccessibleDescription(text?: string | RegExp | E): R
534
+
535
+ /**
536
+ * @description
537
+ * This allows you to assert that an element has the expected
538
+ * [accessible error message](https://w3c.github.io/aria/#aria-errormessage).
539
+ *
540
+ * You can pass the exact string of the expected accessible error message.
541
+ * Alternatively, you can perform a partial match by passing a regular expression
542
+ * or by using either
543
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
544
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
545
+ *
546
+ * @example
547
+ * <input aria-label="Has Error" aria-invalid="true" aria-errormessage="error-message" />
548
+ * <div id="error-message" role="alert">This field is invalid</div>
549
+ *
550
+ * <input aria-label="No Error Attributes" />
551
+ * <input aria-label="Not Invalid" aria-invalid="false" aria-errormessage="error-message" />
552
+ *
553
+ * // Inputs with Valid Error Messages
554
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage()
555
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage('This field is invalid')
556
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage(/invalid/i)
557
+ * expect(
558
+ * getByRole('textbox', {name: 'Has Error'}),
559
+ * ).not.toHaveAccessibleErrorMessage('This field is absolutely correct!')
560
+ *
561
+ * // Inputs without Valid Error Messages
562
+ * expect(
563
+ * getByRole('textbox', {name: 'No Error Attributes'}),
564
+ * ).not.toHaveAccessibleErrorMessage()
565
+ *
566
+ * expect(
567
+ * getByRole('textbox', {name: 'Not Invalid'}),
568
+ * ).not.toHaveAccessibleErrorMessage()
569
+ *
570
+ * @see
571
+ * [testing-library/jest-dom#tohaveaccessibleerrormessage](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage)
572
+ */
573
+ toHaveAccessibleErrorMessage(text?: string | RegExp | E): R
574
+
575
+ /**
576
+ * @description
577
+ * This allows to assert that an element has the expected [accessible name](https://w3c.github.io/accname/).
578
+ * It is useful, for instance, to assert that form elements and buttons are properly labelled.
579
+ *
580
+ * You can pass the exact string of the expected accessible name, or you can make a
581
+ * partial match passing a regular expression, or by using either
582
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
583
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
584
+ * @example
585
+ * <img data-testid="img-alt" src="" alt="Test alt" />
586
+ * <img data-testid="img-empty-alt" src="" alt="" />
587
+ * <svg data-testid="svg-title"><title>Test title</title></svg>
588
+ * <button data-testid="button-img-alt"><img src="" alt="Test" /></button>
589
+ * <p><img data-testid="img-paragraph" src="" alt="" /> Test content</p>
590
+ * <button data-testid="svg-button"><svg><title>Test</title></svg></p>
591
+ * <div><svg data-testid="svg-without-title"></svg></div>
592
+ * <input data-testid="input-title" title="test" />
593
+ *
594
+ * expect(getByTestId('img-alt')).toHaveAccessibleName('Test alt')
595
+ * expect(getByTestId('img-empty-alt')).not.toHaveAccessibleName()
596
+ * expect(getByTestId('svg-title')).toHaveAccessibleName('Test title')
597
+ * expect(getByTestId('button-img-alt')).toHaveAccessibleName()
598
+ * expect(getByTestId('img-paragraph')).not.toHaveAccessibleName()
599
+ * expect(getByTestId('svg-button')).toHaveAccessibleName()
600
+ * expect(getByTestId('svg-without-title')).not.toHaveAccessibleName()
601
+ * expect(getByTestId('input-title')).toHaveAccessibleName()
602
+ * @see
603
+ * [testing-library/jest-dom#tohaveaccessiblename](https://github.com/testing-library/jest-dom#tohaveaccessiblename)
604
+ */
605
+ toHaveAccessibleName(text?: string | RegExp | E): R
606
+ /**
607
+ * @description
608
+ * This allows you to assert that an element has the expected
609
+ * [role](https://www.w3.org/TR/html-aria/#docconformance).
610
+ *
611
+ * This is useful in cases where you already have access to an element via
612
+ * some query other than the role itself, and want to make additional
613
+ * assertions regarding its accessibility.
614
+ *
615
+ * The role can match either an explicit role (via the `role` attribute), or
616
+ * an implicit one via the [implicit ARIA
617
+ * semantics](https://www.w3.org/TR/html-aria/).
618
+ *
619
+ * Note: roles are matched literally by string equality, without inheriting
620
+ * from the ARIA role hierarchy. As a result, querying a superclass role
621
+ * like 'checkbox' will not include elements with a subclass role like
622
+ * 'switch'.
623
+ *
624
+ * @example
625
+ * <button data-testid="button">Continue</button>
626
+ * <div role="button" data-testid="button-explicit">Continue</button>
627
+ * <button role="switch button" data-testid="button-explicit-multiple">Continue</button>
628
+ * <a href="/about" data-testid="link">About</a>
629
+ * <a data-testid="link-invalid">Invalid link<a/>
630
+ *
631
+ * expect(getByTestId('button')).toHaveRole('button')
632
+ * expect(getByTestId('button-explicit')).toHaveRole('button')
633
+ * expect(getByTestId('button-explicit-multiple')).toHaveRole('button')
634
+ * expect(getByTestId('button-explicit-multiple')).toHaveRole('switch')
635
+ * expect(getByTestId('link')).toHaveRole('link')
636
+ * expect(getByTestId('link-invalid')).not.toHaveRole('link')
637
+ * expect(getByTestId('link-invalid')).toHaveRole('generic')
638
+ *
639
+ * @see
640
+ * [testing-library/jest-dom#tohaverole](https://github.com/testing-library/jest-dom#tohaverole)
641
+ */
642
+ toHaveRole(
643
+ // Get autocomplete for ARIARole union types, while still supporting another string
644
+ // Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
645
+ role: ARIARole | (string & {}),
646
+ ): R
647
+ /**
648
+ * @description
649
+ * This allows you to check whether the given element is partially checked.
650
+ * It accepts an input of type checkbox and elements with a role of checkbox
651
+ * with a aria-checked="mixed", or input of type checkbox with indeterminate
652
+ * set to true
653
+ *
654
+ * @example
655
+ * <input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" />
656
+ * <input type="checkbox" checked data-testid="input-checkbox-checked" />
657
+ * <input type="checkbox" data-testid="input-checkbox-unchecked" />
658
+ * <div role="checkbox" aria-checked="true" data-testid="aria-checkbox-checked" />
659
+ * <div
660
+ * role="checkbox"
661
+ * aria-checked="false"
662
+ * data-testid="aria-checkbox-unchecked"
663
+ * />
664
+ * <input type="checkbox" data-testid="input-checkbox-indeterminate" />
665
+ *
666
+ * const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed')
667
+ * const inputCheckboxChecked = getByTestId('input-checkbox-checked')
668
+ * const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked')
669
+ * const ariaCheckboxChecked = getByTestId('aria-checkbox-checked')
670
+ * const ariaCheckboxUnchecked = getByTestId('aria-checkbox-unchecked')
671
+ * const inputCheckboxIndeterminate = getByTestId('input-checkbox-indeterminate')
672
+ *
673
+ * expect(ariaCheckboxMixed).toBePartiallyChecked()
674
+ * expect(inputCheckboxChecked).not.toBePartiallyChecked()
675
+ * expect(inputCheckboxUnchecked).not.toBePartiallyChecked()
676
+ * expect(ariaCheckboxChecked).not.toBePartiallyChecked()
677
+ * expect(ariaCheckboxUnchecked).not.toBePartiallyChecked()
678
+ *
679
+ * inputCheckboxIndeterminate.indeterminate = true
680
+ * expect(inputCheckboxIndeterminate).toBePartiallyChecked()
681
+ * @see
682
+ * [testing-library/jest-dom#tobepartiallychecked](https://github.com/testing-library/jest-dom#tobepartiallychecked)
683
+ */
684
+ toBePartiallyChecked(): R
685
+ /**
686
+ * @deprecated
687
+ * since v5.17.0
688
+ *
689
+ * @description
690
+ * Check whether the given element has an [ARIA error message](https://www.w3.org/TR/wai-aria/#aria-errormessage) or not.
691
+ *
692
+ * Use the `aria-errormessage` attribute to reference another element that contains
693
+ * custom error message text. Multiple ids is **NOT** allowed. Authors MUST use
694
+ * `aria-invalid` in conjunction with `aria-errormessage`. Learn more from the
695
+ * [`aria-errormessage` spec](https://www.w3.org/TR/wai-aria/#aria-errormessage).
696
+ *
697
+ * Whitespace is normalized.
698
+ *
699
+ * When a `string` argument is passed through, it will perform a whole
700
+ * case-sensitive match to the error message text.
701
+ *
702
+ * To perform a case-insensitive match, you can use a `RegExp` with the `/i`
703
+ * modifier.
704
+ *
705
+ * To perform a partial match, you can pass a `RegExp` or use
706
+ * expect.stringContaining("partial string")`.
707
+ *
708
+ * @example
709
+ * <label for="startTime"> Please enter a start time for the meeting: </label>
710
+ * <input id="startTime" type="text" aria-errormessage="msgID" aria-invalid="true" value="11:30 PM" />
711
+ * <span id="msgID" aria-live="assertive" style="visibility:visible">
712
+ * Invalid time: the time must be between 9:00 AM and 5:00 PM"
713
+ * </span>
714
+ *
715
+ *
716
+ * const timeInput = getByLabel('startTime')
717
+ *
718
+ * expect(timeInput).toHaveErrorMessage(
719
+ * 'Invalid time: the time must be between 9:00 AM and 5:00 PM',
720
+ * )
721
+ * expect(timeInput).toHaveErrorMessage(/invalid time/i) // to partially match
722
+ * expect(timeInput).toHaveErrorMessage(expect.stringContaining('Invalid time')) // to partially match
723
+ * expect(timeInput).not.toHaveErrorMessage('Pikachu!')
724
+ * @see
725
+ * [testing-library/jest-dom#tohaveerrormessage](https://github.com/testing-library/jest-dom#tohaveerrormessage)
726
+ */
727
+ toHaveErrorMessage(text?: string | RegExp | E): R
728
+ /**
729
+ * @description
730
+ * This allows to assert that an element has a
731
+ * [text selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection).
732
+ *
733
+ * This is useful to check if text or part of the text is selected within an
734
+ * element. The element can be either an input of type text, a textarea, or any
735
+ * other element that contains text, such as a paragraph, span, div etc.
736
+ *
737
+ * NOTE: the expected selection is a string, it does not allow to check for
738
+ * selection range indeces.
739
+ *
740
+ * @example
741
+ * <div>
742
+ * <input type="text" value="text selected text" data-testid="text" />
743
+ * <textarea data-testid="textarea">text selected text</textarea>
744
+ * <p data-testid="prev">prev</p>
745
+ * <p data-testid="parent">text <span data-testid="child">selected</span> text</p>
746
+ * <p data-testid="next">next</p>
747
+ * </div>
748
+ *
749
+ * getByTestId('text').setSelectionRange(5, 13)
750
+ * expect(getByTestId('text')).toHaveSelection('selected')
751
+ *
752
+ * getByTestId('textarea').setSelectionRange(0, 5)
753
+ * expect('textarea').toHaveSelection('text ')
754
+ *
755
+ * const selection = document.getSelection()
756
+ * const range = document.createRange()
757
+ * selection.removeAllRanges()
758
+ * selection.empty()
759
+ * selection.addRange(range)
760
+ *
761
+ * // selection of child applies to the parent as well
762
+ * range.selectNodeContents(getByTestId('child'))
763
+ * expect(getByTestId('child')).toHaveSelection('selected')
764
+ * expect(getByTestId('parent')).toHaveSelection('selected')
765
+ *
766
+ * // selection that applies from prev all, parent text before child, and part child.
767
+ * range.setStart(getByTestId('prev'), 0)
768
+ * range.setEnd(getByTestId('child').childNodes[0], 3)
769
+ * expect(queryByTestId('prev')).toHaveSelection('prev')
770
+ * expect(queryByTestId('child')).toHaveSelection('sel')
771
+ * expect(queryByTestId('parent')).toHaveSelection('text sel')
772
+ * expect(queryByTestId('next')).not.toHaveSelection()
773
+ *
774
+ * // selection that applies from part child, parent text after child and part next.
775
+ * range.setStart(getByTestId('child').childNodes[0], 3)
776
+ * range.setEnd(getByTestId('next').childNodes[0], 2)
777
+ * expect(queryByTestId('child')).toHaveSelection('ected')
778
+ * expect(queryByTestId('parent')).toHaveSelection('ected text')
779
+ * expect(queryByTestId('prev')).not.toHaveSelection()
780
+ * expect(queryByTestId('next')).toHaveSelection('ne')
781
+ *
782
+ * @see
783
+ * [testing-library/jest-dom#tohaveselection](https://github.com/testing-library/jest-dom#tohaveselection)
784
+ */
785
+ toHaveSelection(selection?: string): R
786
+ /**
787
+ * @description
788
+ * This allows to check whether given element has been [pressed](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
789
+ *
790
+ * It accepts elements with explicit or implicit `button` role and valid `aria-pressed`
791
+ * attribute of `"true"` or `"false"`.
792
+ *
793
+ * @example
794
+ * <button aria-pressed="true">Pressed</button>
795
+ * <button aria-pressed="false">Released</button>
796
+ *
797
+ * <input type="button" aria-pressed="true" value="Pressed input button" />
798
+ * <input type="button" aria-pressed="false" value="Released input button" />
799
+ *
800
+ * <span role="button" aria-pressed="true">Pressed span</span>
801
+ * <span role="button" aria-pressed="false">Released span</span>
802
+ *
803
+ * screen.getByRole('button', { name: 'Pressed' }).toBePressed();
804
+ * screen.getByRole('button', { name: 'Released' }).not.toBePressed();
805
+ *
806
+ * screen.getByRole('button', { name: 'Pressed input button' }).toBePressed();
807
+ * screen.getByRole('button', { name: 'Released input button' }).not.toBePressed();
808
+ *
809
+ * screen.getByRole('button', { name: 'Pressed span' }).toBePressed();
810
+ * screen.getByRole('button', { name: 'Released span' }).not.toBePressed();
811
+ *
812
+ * @see
813
+ * [testing-library/jest-dom#tobepressed](https://github.com/testing-library/jest-dom#tobepressed)
814
+ */
815
+ toBePressed(): R
816
+ /**
817
+ * @description
818
+ * This allows to check whether given element has been [partially pressed](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
819
+ *
820
+ * It accepts elements with explicit or implicit `button` role and valid `aria-pressed` of `"mixed"`.
821
+ *
822
+ * @example
823
+ * <button aria-pressed="mixed">Partially Pressed</button>
824
+ * <input type="button" aria-pressed="mixed" value="Partially pressed input button" />
825
+ * <span role="button" aria-pressed="mixed">Partially pressed span</span>
826
+ *
827
+ * screen.getByRole('button', { name: 'Partially Pressed' }).toBePartiallyPressed();
828
+ * screen.getByRole('button', { name: 'Partially pressed input button' }).toBePartiallyPressed();
829
+ * screen.getByRole('button', { name: 'Partially pressed span' }).toBePartiallyPressed();
830
+ *
831
+ * @see
832
+ * [testing-library/jest-dom#tobepartiallypressed](https://github.com/testing-library/jest-dom#tobepartiallypressed)
833
+ */
834
+ toBePartiallyPressed(): R
835
+ /**
836
+ * @description
837
+ * This checks if a given element appears before another element in the DOM tree, as per [`compareDocumentPosition()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition).
838
+ *
839
+ * @example
840
+ * <div>
841
+ * <span data-testid="text-a">Text A</span>
842
+ * <span data-testid="text-b">Text B</span>
843
+ * </div>
844
+ *
845
+ * const textA = queryByTestId('text-a')
846
+ * const textB = queryByTestId('text-b')
847
+ *
848
+ * expect(textA).toAppearBefore(textB)
849
+ * expect(textB).not.toAppearBefore(textA)
850
+ *
851
+ * @see
852
+ * [testing-library/jest-dom#toappearbefore](https://github.com/testing-library/jest-dom#toappearbefore)
853
+ */
854
+ toAppearBefore(element: HTMLElement | SVGElement): R
855
+ /**
856
+ * @description
857
+ * This checks if a given element appears after another element in the DOM tree, as per [`compareDocumentPosition()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition).
858
+ *
859
+ * @example
860
+ * <div>
861
+ * <span data-testid="text-a">Text A</span>
862
+ * <span data-testid="text-b">Text B</span>
863
+ * </div>
864
+ *
865
+ * const textA = queryByTestId('text-a')
866
+ * const textB = queryByTestId('text-b')
867
+ *
868
+ * expect(textB).toAppearAfter(textA)
869
+ * expect(textA).not.toAppearAfter(textB)
870
+ *
871
+ * @see
872
+ * [testing-library/jest-dom#toappearafter](https://github.com/testing-library/jest-dom#toappearafter)
873
+ */
874
+ toAppearAfter(element: HTMLElement | SVGElement): R
875
+
876
+ /**
877
+ * @description
878
+ * Assert whether an element contains one or more descendants with the specified alt text.
879
+ * @example
880
+ * <img alt="Image Description" src="image-with-alt-text.jpg" />
881
+ * expect(document.body).toContainAnyByAltText('Image Description')
882
+ * @see
883
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
884
+ */
885
+ toContainAnyByAltText(...args: DomQueryByBoundAttributeArgs): R
886
+
887
+ /**
888
+ * @description
889
+ * Assert whether an element contains exactly one descendant with the specified alt text.
890
+ * @example
891
+ * <img alt="Image Description" src="image-with-alt-text.jpg" />
892
+ * expect(document.body).toContainOneByAltText('Image Description')
893
+ * @see
894
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
895
+ */
896
+ toContainOneByAltText(...args: DomQueryByBoundAttributeArgs): R
897
+
898
+ /**
899
+ * @description
900
+ * Assert whether an element contains one or more descendants with the specified display value.
901
+ * @example
902
+ * <select><option selected>Option A</option></select>
903
+ * expect(document.body).toContainAnyByDisplayValue('Option A')
904
+ * @see
905
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
906
+ */
907
+ toContainAnyByDisplayValue(...args: DomQueryByBoundAttributeArgs): R
908
+
909
+ /**
910
+ * @description
911
+ * Assert whether an element contains exactly one descendant with the specified display value.
912
+ * @example
913
+ * <select><option selected>Option A</option></select>
914
+ * expect(document.body).toContainOneByDisplayValue('Option A')
915
+ * @see
916
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
917
+ */
918
+ toContainOneByDisplayValue(...args: DomQueryByBoundAttributeArgs): R
919
+
920
+ /**
921
+ * @description
922
+ * Assert whether an element contains one or more descendants with the specified label text.
923
+ * @example
924
+ * <label for="name">Full name</label><input id="name" />
925
+ * expect(document.body).toContainAnyByLabelText('Full name')
926
+ * @see
927
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
928
+ */
929
+ toContainAnyByLabelText(...args: DomQueryByTextArgs): R
930
+
931
+ /**
932
+ * @description
933
+ * Assert whether an element contains exactly one descendant with the specified label text.
934
+ * @example
935
+ * <label for="name">Full name</label><input id="name" />
936
+ * expect(document.body).toContainOneByLabelText('Full name')
937
+ * @see
938
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
939
+ */
940
+ toContainOneByLabelText(...args: DomQueryByTextArgs): R
941
+
942
+ /**
943
+ * @description
944
+ * Assert whether an element contains one or more descendants with the specified placeholder text.
945
+ * @example
946
+ * <input placeholder="Enter name" />
947
+ * expect(document.body).toContainAnyByPlaceholderText('Enter name')
948
+ * @see
949
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
950
+ */
951
+ toContainAnyByPlaceholderText(...args: DomQueryByBoundAttributeArgs): R
952
+
953
+ /**
954
+ * @description
955
+ * Assert whether an element contains exactly one descendant with the specified placeholder text.
956
+ * @example
957
+ * <input placeholder="Enter name" />
958
+ * expect(document.body).toContainOneByPlaceholderText('Enter name')
959
+ * @see
960
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
961
+ */
962
+ toContainOneByPlaceholderText(...args: DomQueryByBoundAttributeArgs): R
963
+
964
+ /**
965
+ * @description
966
+ * Assert whether an element contains one or more descendants with the specified role.
967
+ * @example
968
+ * <div role="alert">Something went wrong.</div>
969
+ * expect(document.body).toContainAnyByRole('alert')
970
+ * @see
971
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
972
+ */
973
+ toContainAnyByRole(...args: DomQueryByRoleArgs): R
974
+
975
+ /**
976
+ * @description
977
+ * Assert whether an element contains exactly one descendant with the specified role.
978
+ * @example
979
+ * <div role="alert">Something went wrong.</div>
980
+ * expect(document.body).toContainOneByRole('alert')
981
+ * @see
982
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
983
+ */
984
+ toContainOneByRole(...args: DomQueryByRoleArgs): R
985
+
986
+ /**
987
+ * @description
988
+ * Assert whether an element contains one or more descendants with the specified test ID.
989
+ * @example
990
+ * <div data-testid="alert">Something went wrong.</div>
991
+ * expect(document.body).toContainAnyByTestId('alert')
992
+ * @see
993
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
994
+ */
995
+ toContainAnyByTestId(...args: DomQueryByBoundAttributeArgs): R
996
+
997
+ /**
998
+ * @description
999
+ * Assert whether an element contains exactly one descendant with the specified test ID.
1000
+ * @example
1001
+ * <div data-testid="alert">Something went wrong.</div>
1002
+ * expect(document.body).toContainOneByTestId('alert')
1003
+ * @see
1004
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
1005
+ */
1006
+ toContainOneByTestId(...args: DomQueryByBoundAttributeArgs): R
1007
+
1008
+ /**
1009
+ * @description
1010
+ * Assert whether an element contains one or more descendants with the specified text.
1011
+ * @example
1012
+ * <span>Hello world</span>
1013
+ * expect(document.body).toContainAnyByText('Hello world')
1014
+ * @see
1015
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
1016
+ */
1017
+ toContainAnyByText(...args: DomQueryByTextArgs): R
1018
+
1019
+ /**
1020
+ * @description
1021
+ * Assert whether an element contains exactly one descendant with the specified text.
1022
+ * @example
1023
+ * <span>Hello world</span>
1024
+ * expect(document.body).toContainOneByText('Hello world')
1025
+ * @see
1026
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
1027
+ */
1028
+ toContainOneByText(...args: DomQueryByTextArgs): R
1029
+
1030
+ /**
1031
+ * @description
1032
+ * Assert whether an element contains one or more descendants with the specified title.
1033
+ * @example
1034
+ * <h1 title="Page title">Welcome</h1>
1035
+ * expect(document.body).toContainAnyByTitle('Page title')
1036
+ * @see
1037
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
1038
+ */
1039
+ toContainAnyByTitle(...args: DomQueryByBoundAttributeArgs): R
1040
+
1041
+ /**
1042
+ * @description
1043
+ * Assert whether an element contains exactly one descendant with the specified title.
1044
+ * @example
1045
+ * <h1 title="Page title">Welcome</h1>
1046
+ * expect(document.body).toContainOneByTitle('Page title')
1047
+ * @see
1048
+ * [testing-library/jest-dom#tocontainanyby--tocontainoneby](https://github.com/testing-library/jest-dom#tocontainanyby--tocontainoneby)
1049
+ */
1050
+ toContainOneByTitle(...args: DomQueryByBoundAttributeArgs): R
1051
+
1052
+ // @ctrl/dom addition (not in upstream jest-dom).
1053
+ /**
1054
+ * @description
1055
+ * Assert that the accessibility tree of an element (or of `document.body`'s children, for the
1056
+ * body, a document or a fragment) matches an aria snapshot template, with Playwright's
1057
+ * semantics: the template lists a subset of the nodes in order (partial matching), names are
1058
+ * strings or `/regex/`, states like `[checked]` or `[level=2]` must match when listed,
1059
+ * `- text: …` matches text, and children nest by indentation.
1060
+ * @example
1061
+ * <form aria-label="Payment"><h2>Pay</h2><input aria-label="Email"><button disabled>Pay 42 €</button></form>
1062
+ *
1063
+ * expect(screen.getByRole('form')).toMatchAriaSnapshot(`
1064
+ * - form "Payment":
1065
+ * - heading "Pay" [level=2]
1066
+ * - button /Pay \d+ €/ [disabled]
1067
+ * `)
1068
+ * @see
1069
+ * [Playwright aria snapshots](https://playwright.dev/docs/aria-snapshots)
1070
+ */
1071
+ toMatchAriaSnapshot(template: string): R
1072
+ }
1073
+ }
1074
+
1075
+ // Needs to extend Record<string, any> to be accepted by expect.extend()
1076
+ // as it requires a string index signature.
1077
+ declare const matchers: matchers.TestingLibraryMatchers<any, void> &
1078
+ Record<string, any>
1079
+ export = matchers