@ariakit/test 0.2.5 → 0.3.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 (187) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/cjs/__chunks/2KXSRUIV.cjs +205 -0
  3. package/cjs/__chunks/747HORQZ.cjs +30 -0
  4. package/cjs/__chunks/A5IFXY4J.cjs +33 -0
  5. package/cjs/__chunks/DAHHEUOU.cjs +95 -0
  6. package/cjs/__chunks/{2V5PIRJZ.cjs → ESE7QHAQ.cjs} +71 -70
  7. package/cjs/__chunks/FU2U6RZL.cjs +57 -0
  8. package/cjs/__chunks/I2BROIQW.cjs +1 -0
  9. package/cjs/__chunks/KVNENCXT.cjs +36 -0
  10. package/cjs/__chunks/LYOKT276.cjs +69 -0
  11. package/cjs/__chunks/NIEATM7R.cjs +20 -0
  12. package/cjs/__chunks/{PKWBCPZU.cjs → OVN5OYWK.cjs} +2 -1
  13. package/cjs/__chunks/{LUIPCXQX.cjs → PJWPDIUX.cjs} +48 -44
  14. package/cjs/__chunks/SDUGTL2N.cjs +13 -0
  15. package/cjs/__chunks/SEWCIANI.cjs +14 -0
  16. package/cjs/__chunks/T5KVOIJT.cjs +58 -0
  17. package/cjs/__chunks/VZINRVVH.cjs +126 -0
  18. package/cjs/__chunks/ZMMVJ3OT.cjs +72 -0
  19. package/cjs/__tests__/use-all-events.d.cts +1 -0
  20. package/cjs/__utils.d.cts +11 -0
  21. package/cjs/__utils.d.ts +6 -3
  22. package/cjs/blur.cjs +7 -8
  23. package/cjs/blur.d.cts +2 -0
  24. package/cjs/blur.d.ts +1 -2
  25. package/cjs/click.cjs +13 -14
  26. package/cjs/click.d.cts +1 -0
  27. package/cjs/click.d.ts +1 -2
  28. package/cjs/dispatch.cjs +9 -0
  29. package/cjs/dispatch.d.cts +9 -0
  30. package/cjs/dispatch.d.ts +9 -0
  31. package/cjs/focus.cjs +7 -8
  32. package/cjs/focus.d.cts +1 -0
  33. package/cjs/focus.d.ts +1 -2
  34. package/cjs/hover.cjs +8 -9
  35. package/cjs/hover.d.cts +1 -0
  36. package/cjs/hover.d.ts +1 -2
  37. package/cjs/index.cjs +19 -76
  38. package/cjs/index.d.cts +14 -0
  39. package/cjs/index.d.ts +2 -5
  40. package/cjs/mouse-down.cjs +9 -10
  41. package/cjs/mouse-down.d.cts +1 -0
  42. package/cjs/mouse-down.d.ts +1 -2
  43. package/cjs/mouse-up.cjs +7 -7
  44. package/cjs/mouse-up.d.cts +1 -0
  45. package/cjs/mouse-up.d.ts +1 -2
  46. package/cjs/press.cjs +11 -12
  47. package/cjs/press.d.cts +18 -0
  48. package/cjs/press.d.ts +0 -1
  49. package/cjs/query.cjs +10 -0
  50. package/cjs/query.d.cts +3989 -0
  51. package/cjs/query.d.ts +3989 -0
  52. package/cjs/react.cjs +90 -0
  53. package/cjs/react.d.cts +7 -0
  54. package/cjs/react.d.ts +7 -0
  55. package/cjs/select.cjs +13 -14
  56. package/cjs/select.d.cts +1 -0
  57. package/cjs/select.d.ts +1 -2
  58. package/cjs/sleep.cjs +6 -6
  59. package/cjs/sleep.d.cts +1 -0
  60. package/cjs/tap.cjs +14 -15
  61. package/cjs/tap.d.cts +1 -0
  62. package/cjs/tap.d.ts +1 -2
  63. package/cjs/type.cjs +9 -10
  64. package/cjs/type.d.cts +2 -0
  65. package/cjs/type.d.ts +0 -1
  66. package/cjs/wait-for.cjs +6 -4
  67. package/cjs/wait-for.d.cts +2 -0
  68. package/cjs/wait-for.d.ts +2 -1
  69. package/dispatch/package.json +8 -0
  70. package/esm/__chunks/{SWUQE4WB.js → 5DPK2YAQ.js} +48 -44
  71. package/esm/__chunks/7JP5HWUW.js +57 -0
  72. package/esm/__chunks/ANPGABTJ.js +69 -0
  73. package/esm/__chunks/H3BXHZTZ.js +95 -0
  74. package/esm/__chunks/HUBUFZ3U.js +205 -0
  75. package/esm/__chunks/HVRX3U4O.js +126 -0
  76. package/esm/__chunks/LHKK7Y5F.js +72 -0
  77. package/esm/__chunks/LSH2PT34.js +30 -0
  78. package/esm/__chunks/MKNCAN2F.js +13 -0
  79. package/esm/__chunks/{6XO5G2QR.js → Q65FZOE2.js} +1 -0
  80. package/esm/__chunks/RG2JKALK.js +58 -0
  81. package/esm/__chunks/RHBNMDK4.js +1 -0
  82. package/esm/__chunks/{6PY4HXVO.js → UJCT5GXS.js} +71 -70
  83. package/esm/__chunks/WAYMNUAF.js +33 -0
  84. package/esm/__chunks/WLDGXXGP.js +14 -0
  85. package/esm/__chunks/YNAZUNNE.js +20 -0
  86. package/esm/__chunks/ZIWQZF7I.js +36 -0
  87. package/esm/__utils.d.ts +6 -3
  88. package/esm/blur.d.ts +1 -2
  89. package/esm/blur.js +5 -6
  90. package/esm/click.d.ts +1 -2
  91. package/esm/click.js +11 -12
  92. package/esm/dispatch.d.ts +9 -0
  93. package/esm/dispatch.js +9 -0
  94. package/esm/focus.d.ts +1 -2
  95. package/esm/focus.js +5 -6
  96. package/esm/hover.d.ts +1 -2
  97. package/esm/hover.js +6 -7
  98. package/esm/index.d.ts +2 -5
  99. package/esm/index.js +31 -88
  100. package/esm/mouse-down.d.ts +1 -2
  101. package/esm/mouse-down.js +7 -8
  102. package/esm/mouse-up.d.ts +1 -2
  103. package/esm/mouse-up.js +5 -5
  104. package/esm/press.d.ts +0 -1
  105. package/esm/press.js +9 -10
  106. package/esm/query.d.ts +3989 -0
  107. package/esm/query.js +10 -0
  108. package/esm/react.d.ts +7 -0
  109. package/esm/react.js +90 -0
  110. package/esm/select.d.ts +1 -2
  111. package/esm/select.js +11 -12
  112. package/esm/sleep.js +4 -4
  113. package/esm/tap.d.ts +1 -2
  114. package/esm/tap.js +12 -13
  115. package/esm/type.d.ts +0 -1
  116. package/esm/type.js +7 -8
  117. package/esm/wait-for.d.ts +2 -1
  118. package/esm/wait-for.js +4 -2
  119. package/package.json +85 -40
  120. package/query/package.json +8 -0
  121. package/react/package.json +8 -0
  122. package/act/package.json +0 -8
  123. package/cjs/__chunks/3NIZQX5J.cjs +0 -6
  124. package/cjs/__chunks/3WW644T7.cjs +0 -20
  125. package/cjs/__chunks/5F5PNQCC.cjs +0 -22
  126. package/cjs/__chunks/7BZFO6FC.cjs +0 -12
  127. package/cjs/__chunks/7RUXTAPP.cjs +0 -16
  128. package/cjs/__chunks/AYRPODWR.cjs +0 -1
  129. package/cjs/__chunks/B4VP2LEU.cjs +0 -28
  130. package/cjs/__chunks/BHNBCXUN.cjs +0 -33
  131. package/cjs/__chunks/EGF4KWUK.cjs +0 -64
  132. package/cjs/__chunks/HGTTGPFK.cjs +0 -54
  133. package/cjs/__chunks/JY5DGPUE.cjs +0 -14
  134. package/cjs/__chunks/KRQVK4KQ.cjs +0 -38
  135. package/cjs/__chunks/LFNIGEB6.cjs +0 -50
  136. package/cjs/__chunks/MQA5IB4L.cjs +0 -6
  137. package/cjs/__chunks/Q7PN3HIB.cjs +0 -121
  138. package/cjs/__chunks/SYQ5J5KP.cjs +0 -32
  139. package/cjs/__chunks/VIKUJSTX.cjs +0 -83
  140. package/cjs/act.cjs +0 -8
  141. package/cjs/act.d.ts +0 -1
  142. package/cjs/fire-event.cjs +0 -9
  143. package/cjs/fire-event.d.ts +0 -3
  144. package/cjs/polyfills.cjs +0 -3
  145. package/cjs/render.cjs +0 -9
  146. package/cjs/render.d.ts +0 -5
  147. package/cjs/screen.cjs +0 -55
  148. package/cjs/screen.d.ts +0 -26
  149. package/cjs/tsconfig.build.tsbuildinfo +0 -1
  150. package/cjs/within.cjs +0 -7
  151. package/cjs/within.d.ts +0 -1
  152. package/esm/__chunks/2OZA4WAZ.js +0 -50
  153. package/esm/__chunks/2RHTJFSK.js +0 -38
  154. package/esm/__chunks/3C72DPE2.js +0 -54
  155. package/esm/__chunks/4A3YKZRA.js +0 -121
  156. package/esm/__chunks/5JPM5LQX.js +0 -6
  157. package/esm/__chunks/5PINJ4MD.js +0 -16
  158. package/esm/__chunks/AEOE57TZ.js +0 -33
  159. package/esm/__chunks/EVYPE6ZJ.js +0 -32
  160. package/esm/__chunks/EX5WPJOU.js +0 -64
  161. package/esm/__chunks/JTFRQL3H.js +0 -83
  162. package/esm/__chunks/LJWZLI6L.js +0 -14
  163. package/esm/__chunks/OQYWQML5.js +0 -12
  164. package/esm/__chunks/OSCTTZUZ.js +0 -28
  165. package/esm/__chunks/PNBZ5NXH.js +0 -0
  166. package/esm/__chunks/QA3ZS6S2.js +0 -6
  167. package/esm/__chunks/R7IYW63J.js +0 -22
  168. package/esm/__chunks/ZEO5Q6UD.js +0 -20
  169. package/esm/act.d.ts +0 -1
  170. package/esm/act.js +0 -8
  171. package/esm/fire-event.d.ts +0 -3
  172. package/esm/fire-event.js +0 -9
  173. package/esm/polyfills.d.ts +0 -1
  174. package/esm/polyfills.js +0 -3
  175. package/esm/render.d.ts +0 -5
  176. package/esm/render.js +0 -9
  177. package/esm/screen.d.ts +0 -26
  178. package/esm/screen.js +0 -55
  179. package/esm/tsconfig.build.tsbuildinfo +0 -1
  180. package/esm/within.d.ts +0 -1
  181. package/esm/within.js +0 -7
  182. package/fire-event/package.json +0 -8
  183. package/polyfills/package.json +0 -8
  184. package/render/package.json +0 -8
  185. package/screen/package.json +0 -8
  186. package/within/package.json +0 -8
  187. /package/cjs/{polyfills.d.ts → __tests__/blur-test.d.cts} +0 -0
package/cjs/react.cjs ADDED
@@ -0,0 +1,90 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
2
+ require('./__chunks/I2BROIQW.cjs');
3
+
4
+
5
+ var _SEWCIANIcjs = require('./__chunks/SEWCIANI.cjs');
6
+
7
+
8
+ var _SDUGTL2Ncjs = require('./__chunks/SDUGTL2N.cjs');
9
+
10
+
11
+ var _PJWPDIUXcjs = require('./__chunks/PJWPDIUX.cjs');
12
+
13
+
14
+ var _DAHHEUOUcjs = require('./__chunks/DAHHEUOU.cjs');
15
+
16
+
17
+ var _747HORQZcjs = require('./__chunks/747HORQZ.cjs');
18
+
19
+
20
+ var _T5KVOIJTcjs = require('./__chunks/T5KVOIJT.cjs');
21
+
22
+
23
+ var _LYOKT276cjs = require('./__chunks/LYOKT276.cjs');
24
+
25
+
26
+
27
+ var _2KXSRUIVcjs = require('./__chunks/2KXSRUIV.cjs');
28
+
29
+
30
+ var _ESE7QHAQcjs = require('./__chunks/ESE7QHAQ.cjs');
31
+
32
+
33
+ var _VZINRVVHcjs = require('./__chunks/VZINRVVH.cjs');
34
+
35
+
36
+ var _KVNENCXTcjs = require('./__chunks/KVNENCXT.cjs');
37
+
38
+
39
+ var _A5IFXY4Jcjs = require('./__chunks/A5IFXY4J.cjs');
40
+
41
+
42
+ var _FU2U6RZLcjs = require('./__chunks/FU2U6RZL.cjs');
43
+
44
+
45
+ var _NIEATM7Rcjs = require('./__chunks/NIEATM7R.cjs');
46
+
47
+
48
+
49
+ var _ZMMVJ3OTcjs = require('./__chunks/ZMMVJ3OT.cjs');
50
+
51
+
52
+
53
+ var _OVN5OYWKcjs = require('./__chunks/OVN5OYWK.cjs');
54
+
55
+ // src/react.tsx
56
+ var _react = require('react');
57
+ var _react3 = require('@testing-library/react'); var ReactTestingLibrary = _interopRequireWildcard(_react3);
58
+ var _jsxruntime = require('react/jsx-runtime');
59
+ async function render2(ui, options) {
60
+ const wrapper = (props) => {
61
+ const Wrapper = options == null ? void 0 : options.wrapper;
62
+ const element = Wrapper ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Wrapper, _OVN5OYWKcjs.__spreadValues.call(void 0, {}, props)) : props.children;
63
+ if (!(options == null ? void 0 : options.strictMode))
64
+ return element;
65
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.StrictMode, { children: element });
66
+ };
67
+ return _ZMMVJ3OTcjs.wrapAsync.call(void 0, async () => {
68
+ const { unmount } = ReactTestingLibrary.render(ui, _OVN5OYWKcjs.__spreadProps.call(void 0, _OVN5OYWKcjs.__spreadValues.call(void 0, {}, options), { wrapper }));
69
+ await _ZMMVJ3OTcjs.nextFrame.call(void 0, );
70
+ return unmount;
71
+ });
72
+ }
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ exports.blur = _KVNENCXTcjs.blur; exports.click = _PJWPDIUXcjs.click; exports.dispatch = _FU2U6RZLcjs.dispatch; exports.focus = _A5IFXY4Jcjs.focus; exports.hover = _LYOKT276cjs.hover; exports.mouseDown = _T5KVOIJTcjs.mouseDown; exports.mouseUp = _747HORQZcjs.mouseUp; exports.press = _ESE7QHAQcjs.press; exports.q = _2KXSRUIVcjs.q; exports.query = _2KXSRUIVcjs.query; exports.render = render2; exports.select = _DAHHEUOUcjs.select; exports.sleep = _NIEATM7Rcjs.sleep; exports.tap = _SDUGTL2Ncjs.tap; exports.type = _VZINRVVHcjs.type; exports.waitFor = _SEWCIANIcjs.waitFor;
@@ -0,0 +1,7 @@
1
+ import type { ReactElement } from "react";
2
+ import * as ReactTestingLibrary from "@testing-library/react";
3
+ export * from "./index.js";
4
+ export interface RenderOptions extends Omit<ReactTestingLibrary.RenderOptions, "queries"> {
5
+ strictMode?: boolean;
6
+ }
7
+ export declare function render(ui: ReactElement, options?: RenderOptions): Promise<() => void>;
package/cjs/react.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { ReactElement } from "react";
2
+ import * as ReactTestingLibrary from "@testing-library/react";
3
+ export * from "./index.js";
4
+ export interface RenderOptions extends Omit<ReactTestingLibrary.RenderOptions, "queries"> {
5
+ strictMode?: boolean;
6
+ }
7
+ export declare function render(ui: ReactElement, options?: RenderOptions): Promise<() => void>;
package/cjs/select.cjs CHANGED
@@ -1,17 +1,16 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
- var _VIKUJSTXcjs = require('./__chunks/VIKUJSTX.cjs');
4
- require('./__chunks/5F5PNQCC.cjs');
5
- require('./__chunks/LFNIGEB6.cjs');
6
- require('./__chunks/BHNBCXUN.cjs');
7
- require('./__chunks/EGF4KWUK.cjs');
8
- require('./__chunks/B4VP2LEU.cjs');
9
- require('./__chunks/KRQVK4KQ.cjs');
10
- require('./__chunks/7RUXTAPP.cjs');
11
- require('./__chunks/AYRPODWR.cjs');
12
- require('./__chunks/SYQ5J5KP.cjs');
13
- require('./__chunks/3WW644T7.cjs');
14
- require('./__chunks/PKWBCPZU.cjs');
15
3
 
4
+ var _DAHHEUOUcjs = require('./__chunks/DAHHEUOU.cjs');
5
+ require('./__chunks/747HORQZ.cjs');
6
+ require('./__chunks/T5KVOIJT.cjs');
7
+ require('./__chunks/LYOKT276.cjs');
8
+ require('./__chunks/KVNENCXT.cjs');
9
+ require('./__chunks/A5IFXY4J.cjs');
10
+ require('./__chunks/FU2U6RZL.cjs');
11
+ require('./__chunks/NIEATM7R.cjs');
12
+ require('./__chunks/ZMMVJ3OT.cjs');
13
+ require('./__chunks/OVN5OYWK.cjs');
16
14
 
17
- exports.select = _VIKUJSTXcjs.select;
15
+
16
+ exports.select = _DAHHEUOUcjs.select;
@@ -0,0 +1 @@
1
+ export declare function select(text: string, element?: Element | null, options?: MouseEventInit): Promise<void>;
package/cjs/select.d.ts CHANGED
@@ -1,2 +1 @@
1
- import "./polyfills.js";
2
- export declare function select(text: string, element?: Element, options?: MouseEventInit): Promise<void>;
1
+ export declare function select(text: string, element?: Element | null, options?: MouseEventInit): Promise<void>;
package/cjs/sleep.cjs CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
- var _7RUXTAPPcjs = require('./__chunks/7RUXTAPP.cjs');
4
- require('./__chunks/AYRPODWR.cjs');
5
- require('./__chunks/3WW644T7.cjs');
6
- require('./__chunks/PKWBCPZU.cjs');
7
3
 
4
+ var _NIEATM7Rcjs = require('./__chunks/NIEATM7R.cjs');
5
+ require('./__chunks/ZMMVJ3OT.cjs');
6
+ require('./__chunks/OVN5OYWK.cjs');
8
7
 
9
- exports.sleep = _7RUXTAPPcjs.sleep;
8
+
9
+ exports.sleep = _NIEATM7Rcjs.sleep;
@@ -0,0 +1 @@
1
+ export declare function sleep(ms?: number): Promise<void>;
package/cjs/tap.cjs CHANGED
@@ -1,18 +1,17 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
- var _7BZFO6FCcjs = require('./__chunks/7BZFO6FC.cjs');
4
- require('./__chunks/LUIPCXQX.cjs');
5
- require('./__chunks/5F5PNQCC.cjs');
6
- require('./__chunks/LFNIGEB6.cjs');
7
- require('./__chunks/BHNBCXUN.cjs');
8
- require('./__chunks/EGF4KWUK.cjs');
9
- require('./__chunks/B4VP2LEU.cjs');
10
- require('./__chunks/KRQVK4KQ.cjs');
11
- require('./__chunks/7RUXTAPP.cjs');
12
- require('./__chunks/AYRPODWR.cjs');
13
- require('./__chunks/SYQ5J5KP.cjs');
14
- require('./__chunks/3WW644T7.cjs');
15
- require('./__chunks/PKWBCPZU.cjs');
16
3
 
4
+ var _SDUGTL2Ncjs = require('./__chunks/SDUGTL2N.cjs');
5
+ require('./__chunks/PJWPDIUX.cjs');
6
+ require('./__chunks/747HORQZ.cjs');
7
+ require('./__chunks/T5KVOIJT.cjs');
8
+ require('./__chunks/LYOKT276.cjs');
9
+ require('./__chunks/KVNENCXT.cjs');
10
+ require('./__chunks/A5IFXY4J.cjs');
11
+ require('./__chunks/FU2U6RZL.cjs');
12
+ require('./__chunks/NIEATM7R.cjs');
13
+ require('./__chunks/ZMMVJ3OT.cjs');
14
+ require('./__chunks/OVN5OYWK.cjs');
17
15
 
18
- exports.tap = _7BZFO6FCcjs.tap;
16
+
17
+ exports.tap = _SDUGTL2Ncjs.tap;
package/cjs/tap.d.cts ADDED
@@ -0,0 +1 @@
1
+ export declare function tap(element: Element | null, options?: MouseEventInit): Promise<void>;
package/cjs/tap.d.ts CHANGED
@@ -1,2 +1 @@
1
- import "./polyfills.js";
2
- export declare function tap(element: Element, options?: MouseEventInit): Promise<void>;
1
+ export declare function tap(element: Element | null, options?: MouseEventInit): Promise<void>;
package/cjs/type.cjs CHANGED
@@ -1,13 +1,12 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
- var _Q7PN3HIBcjs = require('./__chunks/Q7PN3HIB.cjs');
4
- require('./__chunks/B4VP2LEU.cjs');
5
- require('./__chunks/KRQVK4KQ.cjs');
6
- require('./__chunks/7RUXTAPP.cjs');
7
- require('./__chunks/AYRPODWR.cjs');
8
- require('./__chunks/SYQ5J5KP.cjs');
9
- require('./__chunks/3WW644T7.cjs');
10
- require('./__chunks/PKWBCPZU.cjs');
11
3
 
4
+ var _VZINRVVHcjs = require('./__chunks/VZINRVVH.cjs');
5
+ require('./__chunks/A5IFXY4J.cjs');
6
+ require('./__chunks/FU2U6RZL.cjs');
7
+ require('./__chunks/NIEATM7R.cjs');
8
+ require('./__chunks/ZMMVJ3OT.cjs');
9
+ require('./__chunks/OVN5OYWK.cjs');
12
10
 
13
- exports.type = _Q7PN3HIBcjs.type;
11
+
12
+ exports.type = _VZINRVVHcjs.type;
package/cjs/type.d.cts ADDED
@@ -0,0 +1,2 @@
1
+ import type { DirtiableElement } from "./__utils.js";
2
+ export declare function type(text: string, element?: (DirtiableElement & HTMLElement) | null, options?: InputEventInit | KeyboardEventInit): Promise<void>;
package/cjs/type.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import "./polyfills.js";
2
1
  import type { DirtiableElement } from "./__utils.js";
3
2
  export declare function type(text: string, element?: (DirtiableElement & HTMLElement) | null, options?: InputEventInit | KeyboardEventInit): Promise<void>;
package/cjs/wait-for.cjs CHANGED
@@ -1,7 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
- var _3NIZQX5Jcjs = require('./__chunks/3NIZQX5J.cjs');
4
- require('./__chunks/PKWBCPZU.cjs');
5
3
 
4
+ var _SEWCIANIcjs = require('./__chunks/SEWCIANI.cjs');
5
+ require('./__chunks/ZMMVJ3OT.cjs');
6
+ require('./__chunks/OVN5OYWK.cjs');
6
7
 
7
- exports.waitFor = _3NIZQX5Jcjs.waitFor;
8
+
9
+ exports.waitFor = _SEWCIANIcjs.waitFor;
@@ -0,0 +1,2 @@
1
+ import * as DOMTestingLibrary from "@testing-library/dom";
2
+ export declare function waitFor<T>(callback: () => T, options?: DOMTestingLibrary.waitForOptions): Promise<T>;
package/cjs/wait-for.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { waitFor } from "@testing-library/react";
1
+ import * as DOMTestingLibrary from "@testing-library/dom";
2
+ export declare function waitFor<T>(callback: () => T, options?: DOMTestingLibrary.waitForOptions): Promise<T>;
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@ariakit/test/dispatch",
3
+ "private": true,
4
+ "sideEffects": false,
5
+ "main": "../cjs/dispatch.cjs",
6
+ "module": "../esm/dispatch.js",
7
+ "types": "../cjs/dispatch.d.ts"
8
+ }
@@ -1,31 +1,33 @@
1
+ "use client";
1
2
  import {
2
3
  mouseUp
3
- } from "./R7IYW63J.js";
4
+ } from "./LSH2PT34.js";
4
5
  import {
5
6
  mouseDown
6
- } from "./2OZA4WAZ.js";
7
+ } from "./RG2JKALK.js";
7
8
  import {
8
9
  hover
9
- } from "./EX5WPJOU.js";
10
+ } from "./ANPGABTJ.js";
10
11
  import {
11
12
  focus
12
- } from "./OSCTTZUZ.js";
13
+ } from "./WAYMNUAF.js";
13
14
  import {
14
- fireEvent
15
- } from "./2RHTJFSK.js";
15
+ dispatch
16
+ } from "./7JP5HWUW.js";
16
17
  import {
17
18
  sleep
18
- } from "./5PINJ4MD.js";
19
+ } from "./YNAZUNNE.js";
19
20
  import {
20
- queuedMicrotasks
21
- } from "./ZEO5Q6UD.js";
21
+ wrapAsync
22
+ } from "./LHKK7Y5F.js";
22
23
  import {
23
24
  __spreadValues
24
- } from "./6XO5G2QR.js";
25
+ } from "./Q65FZOE2.js";
25
26
 
26
27
  // src/click.ts
27
28
  import { closest, isVisible } from "@ariakit/core/utils/dom";
28
29
  import { isFocusable } from "@ariakit/core/utils/focus";
30
+ import { invariant } from "@ariakit/core/utils/misc";
29
31
  function getClosestLabel(element) {
30
32
  if (!isFocusable(element)) {
31
33
  return closest(element, "label");
@@ -37,18 +39,18 @@ function getInputFromLabel(element) {
37
39
  const input = element.htmlFor ? (_a = element.ownerDocument) == null ? void 0 : _a.getElementById(element.htmlFor) : element.querySelector("input,textarea,select");
38
40
  return input;
39
41
  }
40
- function clickLabel(element, options) {
42
+ async function clickLabel(element, options) {
41
43
  const input = getInputFromLabel(element);
42
44
  const isInputDisabled = Boolean(input == null ? void 0 : input.disabled);
43
45
  if (input) {
44
46
  input.disabled = true;
45
47
  }
46
- const defaultAllowed = fireEvent.click(element, options);
48
+ const defaultAllowed = await dispatch.click(element, options);
47
49
  if (input) {
48
50
  input.disabled = isInputDisabled;
49
51
  if (defaultAllowed && isFocusable(input)) {
50
- focus(input);
51
- fireEvent.click(input);
52
+ await focus(input);
53
+ await dispatch.click(input);
52
54
  }
53
55
  }
54
56
  }
@@ -56,10 +58,10 @@ function setSelected(element, selected) {
56
58
  element.setAttribute("selected", selected ? "selected" : "");
57
59
  element.selected = selected;
58
60
  }
59
- function clickOption(element, eventOptions) {
61
+ async function clickOption(element, eventOptions) {
60
62
  const select = closest(element, "select");
61
63
  if (!select) {
62
- fireEvent.click(element, eventOptions);
64
+ await dispatch.click(element, eventOptions);
63
65
  return;
64
66
  }
65
67
  if (select.multiple) {
@@ -94,37 +96,39 @@ function clickOption(element, eventOptions) {
94
96
  } else {
95
97
  setSelected(element, true);
96
98
  }
97
- fireEvent.input(select);
98
- fireEvent.change(select);
99
- fireEvent.click(element, eventOptions);
99
+ await dispatch.input(select);
100
+ await dispatch.change(select);
101
+ await dispatch.click(element, eventOptions);
100
102
  }
101
- async function click(element, options, tap = false) {
102
- if (!isVisible(element))
103
- return;
104
- await hover(element, options);
105
- mouseDown(element, options);
106
- await queuedMicrotasks();
107
- while (!isVisible(element)) {
108
- if (!element.parentElement)
103
+ function click(element, options, tap = false) {
104
+ return wrapAsync(async () => {
105
+ invariant(element, "Unable to click on null element");
106
+ if (!isVisible(element))
109
107
  return;
110
- element = element.parentElement;
111
- }
112
- if (!tap) {
108
+ await hover(element, options);
109
+ await mouseDown(element, options);
110
+ while (!isVisible(element)) {
111
+ if (!element.parentElement)
112
+ return;
113
+ element = element.parentElement;
114
+ }
115
+ if (!tap) {
116
+ await sleep();
117
+ }
118
+ await mouseUp(element, options);
119
+ const { disabled } = element;
120
+ if (disabled)
121
+ return;
122
+ const label = getClosestLabel(element);
123
+ if (label) {
124
+ await clickLabel(label, __spreadValues({ detail: 1 }, options));
125
+ } else if (element instanceof HTMLOptionElement) {
126
+ await clickOption(element, __spreadValues({ detail: 1 }, options));
127
+ } else {
128
+ await dispatch.click(element, __spreadValues({ detail: 1 }, options));
129
+ }
113
130
  await sleep();
114
- }
115
- mouseUp(element, options);
116
- const { disabled } = element;
117
- if (disabled)
118
- return;
119
- const label = getClosestLabel(element);
120
- if (label) {
121
- clickLabel(label, __spreadValues({ detail: 1 }, options));
122
- } else if (element instanceof HTMLOptionElement) {
123
- clickOption(element, __spreadValues({ detail: 1 }, options));
124
- } else {
125
- fireEvent.click(element, __spreadValues({ detail: 1 }, options));
126
- }
127
- await sleep();
131
+ });
128
132
  }
129
133
 
130
134
  export {
@@ -0,0 +1,57 @@
1
+ "use client";
2
+ import {
3
+ flushMicrotasks,
4
+ wrapAsync
5
+ } from "./LHKK7Y5F.js";
6
+
7
+ // src/dispatch.ts
8
+ import { getKeys, invariant } from "@ariakit/core/utils/misc";
9
+ import { createEvent, fireEvent } from "@testing-library/dom";
10
+ var pointerEvents = [
11
+ "mousemove",
12
+ "mouseover",
13
+ "mouseenter",
14
+ "mouseout",
15
+ "mouseleave",
16
+ "mousedown",
17
+ "mouseup",
18
+ "pointermove",
19
+ "pointerover",
20
+ "pointerenter",
21
+ "pointerout",
22
+ "pointerleave",
23
+ "pointerdown",
24
+ "pointerup",
25
+ "click"
26
+ ];
27
+ function baseDispatch(element, event) {
28
+ return wrapAsync(async () => {
29
+ invariant(element, `Unable to dispatch ${event.type} on null element`);
30
+ const eventName = event.type.toLowerCase();
31
+ if (pointerEvents.includes(eventName) && "classList" in element) {
32
+ const { pointerEvents: pointerEvents2 } = getComputedStyle(element);
33
+ if (pointerEvents2 === "none") {
34
+ if (element.parentElement) {
35
+ return baseDispatch(element.parentElement, event);
36
+ }
37
+ return true;
38
+ }
39
+ }
40
+ const defaultAllowed = fireEvent(element, event);
41
+ await flushMicrotasks();
42
+ return defaultAllowed;
43
+ });
44
+ }
45
+ var events = getKeys(fireEvent).reduce((events2, eventName) => {
46
+ events2[eventName] = (element, options) => {
47
+ invariant(element, `Unable to dispatch ${eventName} on null element`);
48
+ const event = createEvent[eventName](element, options);
49
+ return baseDispatch(element, event);
50
+ };
51
+ return events2;
52
+ }, {});
53
+ var dispatch = Object.assign(baseDispatch, events);
54
+
55
+ export {
56
+ dispatch
57
+ };
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import {
3
+ dispatch
4
+ } from "./7JP5HWUW.js";
5
+ import {
6
+ sleep
7
+ } from "./YNAZUNNE.js";
8
+ import {
9
+ wrapAsync
10
+ } from "./LHKK7Y5F.js";
11
+ import {
12
+ __spreadProps,
13
+ __spreadValues
14
+ } from "./Q65FZOE2.js";
15
+
16
+ // src/hover.ts
17
+ import { isVisible } from "@ariakit/core/utils/dom";
18
+ import { invariant } from "@ariakit/core/utils/misc";
19
+ function isPointerEventsEnabled(element) {
20
+ return getComputedStyle(element).pointerEvents !== "none";
21
+ }
22
+ function hover(element, options) {
23
+ return wrapAsync(async () => {
24
+ invariant(element, "Unable to hover on null element");
25
+ if (!isVisible(element))
26
+ return;
27
+ const document = element.ownerDocument;
28
+ const { lastHovered } = document;
29
+ const { disabled } = element;
30
+ const pointerEventsEnabled = isPointerEventsEnabled(element);
31
+ if (lastHovered && lastHovered !== element && isVisible(lastHovered)) {
32
+ await dispatch.pointerMove(lastHovered, options);
33
+ await dispatch.mouseMove(lastHovered, options);
34
+ if (isPointerEventsEnabled(lastHovered)) {
35
+ const isElementWithinLastHovered = lastHovered.contains(element);
36
+ const relatedTarget = pointerEventsEnabled ? element : null;
37
+ const leaveOptions = __spreadProps(__spreadValues({}, options), { relatedTarget });
38
+ await dispatch.pointerOut(lastHovered, leaveOptions);
39
+ if (!isElementWithinLastHovered) {
40
+ await dispatch.pointerLeave(lastHovered, leaveOptions);
41
+ }
42
+ await dispatch.mouseOut(lastHovered, leaveOptions);
43
+ if (!isElementWithinLastHovered) {
44
+ await dispatch.mouseLeave(lastHovered, leaveOptions);
45
+ }
46
+ }
47
+ }
48
+ await sleep();
49
+ if (pointerEventsEnabled) {
50
+ const enterOptions = lastHovered ? __spreadValues({ relatedTarget: lastHovered }, options) : options;
51
+ await dispatch.pointerOver(element, enterOptions);
52
+ await dispatch.pointerEnter(element, enterOptions);
53
+ if (!disabled) {
54
+ await dispatch.mouseOver(element, enterOptions);
55
+ await dispatch.mouseEnter(element, enterOptions);
56
+ }
57
+ }
58
+ await dispatch.pointerMove(element, options);
59
+ if (!disabled) {
60
+ await dispatch.mouseMove(element, options);
61
+ }
62
+ document.lastHovered = element;
63
+ await sleep();
64
+ });
65
+ }
66
+
67
+ export {
68
+ hover
69
+ };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import {
3
+ mouseUp
4
+ } from "./LSH2PT34.js";
5
+ import {
6
+ mouseDown
7
+ } from "./RG2JKALK.js";
8
+ import {
9
+ hover
10
+ } from "./ANPGABTJ.js";
11
+ import {
12
+ dispatch
13
+ } from "./7JP5HWUW.js";
14
+ import {
15
+ sleep
16
+ } from "./YNAZUNNE.js";
17
+ import {
18
+ wrapAsync
19
+ } from "./LHKK7Y5F.js";
20
+ import {
21
+ __spreadValues
22
+ } from "./Q65FZOE2.js";
23
+
24
+ // src/select.ts
25
+ import { isVisible } from "@ariakit/core/utils/dom";
26
+ import { invariant } from "@ariakit/core/utils/misc";
27
+ function select(text, element = document.body, options) {
28
+ return wrapAsync(async () => {
29
+ var _a, _b;
30
+ invariant(element, "Unable to select text on null element");
31
+ if (!isVisible(element))
32
+ return;
33
+ const document2 = element.ownerDocument;
34
+ await hover(element, options);
35
+ await mouseDown(element, options);
36
+ await dispatch(
37
+ element,
38
+ new Event("selectstart", {
39
+ bubbles: true,
40
+ cancelable: true,
41
+ composed: false
42
+ })
43
+ );
44
+ const startIndex = (_b = (_a = element.textContent) == null ? void 0 : _a.indexOf(text)) != null ? _b : -1;
45
+ const selection = document2.getSelection();
46
+ const range = document2.createRange();
47
+ for (let i = 1; i <= text.length; i++) {
48
+ const iterator = document2.createNodeIterator(
49
+ element,
50
+ NodeFilter.SHOW_TEXT
51
+ );
52
+ const textSlice = text.slice(0, i);
53
+ const endIndex = startIndex + textSlice.length;
54
+ let index = startIndex;
55
+ let node = null;
56
+ let charCount = 0;
57
+ let startContainer = null;
58
+ let startOffset = -1;
59
+ let endContainer = null;
60
+ let endOffset = -1;
61
+ while (index >= 0 && index < endIndex && charCount < endIndex && (node = iterator.nextNode())) {
62
+ const textContent = node.textContent;
63
+ if (!textContent)
64
+ continue;
65
+ charCount += textContent.length;
66
+ if (index > charCount)
67
+ continue;
68
+ if (!startContainer) {
69
+ startContainer = node;
70
+ startOffset = index - charCount + textContent.length;
71
+ }
72
+ endContainer = node;
73
+ endOffset = endIndex - charCount + textContent.length;
74
+ index++;
75
+ }
76
+ if (!startContainer || !endContainer)
77
+ continue;
78
+ await hover(element, options);
79
+ range.setStart(startContainer, startOffset);
80
+ range.setEnd(endContainer, endOffset);
81
+ selection == null ? void 0 : selection.removeAllRanges();
82
+ selection == null ? void 0 : selection.addRange(range);
83
+ }
84
+ await sleep();
85
+ await mouseUp(element, options);
86
+ await dispatch.click(element, __spreadValues({ detail: 1 }, options));
87
+ selection == null ? void 0 : selection.removeAllRanges();
88
+ selection == null ? void 0 : selection.addRange(range);
89
+ await sleep();
90
+ });
91
+ }
92
+
93
+ export {
94
+ select
95
+ };