@ariakit/test 0.2.5 → 0.3.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 (165) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/cjs/__chunks/473V5JUA.cjs +19 -0
  3. package/cjs/__chunks/645PZZGM.cjs +13 -0
  4. package/cjs/__chunks/6PJ6QG4X.cjs +204 -0
  5. package/cjs/__chunks/6WHWNYHF.cjs +56 -0
  6. package/cjs/__chunks/CR7E273F.cjs +70 -0
  7. package/cjs/__chunks/{2V5PIRJZ.cjs → CVZQHCPZ.cjs} +67 -67
  8. package/cjs/__chunks/HNXGMK5P.cjs +35 -0
  9. package/cjs/__chunks/J6ZZZ7OL.cjs +12 -0
  10. package/cjs/__chunks/{LUIPCXQX.cjs → MWZXO7MI.cjs} +45 -42
  11. package/cjs/__chunks/NUOZZLPY.cjs +29 -0
  12. package/cjs/__chunks/OUXW5FPV.cjs +125 -0
  13. package/cjs/__chunks/R25SVNFL.cjs +94 -0
  14. package/cjs/__chunks/R7VOUI26.cjs +32 -0
  15. package/cjs/__chunks/SSTGZXPB.cjs +57 -0
  16. package/cjs/__chunks/YJVLDF2F.cjs +68 -0
  17. package/cjs/__utils.d.ts +6 -3
  18. package/cjs/blur.cjs +4 -6
  19. package/cjs/blur.d.ts +1 -2
  20. package/cjs/click.cjs +10 -12
  21. package/cjs/click.d.ts +1 -2
  22. package/cjs/dispatch.cjs +8 -0
  23. package/cjs/dispatch.d.ts +9 -0
  24. package/cjs/focus.cjs +4 -6
  25. package/cjs/focus.d.ts +1 -2
  26. package/cjs/hover.cjs +5 -7
  27. package/cjs/hover.d.ts +1 -2
  28. package/cjs/index.cjs +17 -75
  29. package/cjs/index.d.ts +2 -5
  30. package/cjs/mouse-down.cjs +6 -8
  31. package/cjs/mouse-down.d.ts +1 -2
  32. package/cjs/mouse-up.cjs +4 -5
  33. package/cjs/mouse-up.d.ts +1 -2
  34. package/cjs/press.cjs +8 -10
  35. package/cjs/press.d.ts +0 -1
  36. package/cjs/query.cjs +9 -0
  37. package/cjs/query.d.ts +3989 -0
  38. package/cjs/react.cjs +89 -0
  39. package/cjs/react.d.ts +7 -0
  40. package/cjs/select.cjs +10 -12
  41. package/cjs/select.d.ts +1 -2
  42. package/cjs/sleep.cjs +3 -4
  43. package/cjs/tap.cjs +11 -13
  44. package/cjs/tap.d.ts +1 -2
  45. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  46. package/cjs/type.cjs +6 -8
  47. package/cjs/type.d.ts +0 -1
  48. package/cjs/wait-for.cjs +3 -2
  49. package/cjs/wait-for.d.ts +2 -1
  50. package/dispatch/package.json +8 -0
  51. package/esm/__chunks/{6PY4HXVO.js → 2YBPSAHP.js} +69 -69
  52. package/esm/__chunks/33MQDYWJ.js +125 -0
  53. package/esm/__chunks/45H4QFE4.js +94 -0
  54. package/esm/__chunks/4NZZR22G.js +35 -0
  55. package/esm/__chunks/7I22ZP6R.js +13 -0
  56. package/esm/__chunks/BKSZ7WES.js +204 -0
  57. package/esm/__chunks/MOHPNQYM.js +70 -0
  58. package/esm/__chunks/PGGOW3IT.js +57 -0
  59. package/esm/__chunks/SKXK6BOG.js +29 -0
  60. package/esm/__chunks/WWAF2MEB.js +12 -0
  61. package/esm/__chunks/{SWUQE4WB.js → X5N4V7NJ.js} +46 -43
  62. package/esm/__chunks/Y4VDXWJ6.js +32 -0
  63. package/esm/__chunks/YXZMMBB6.js +19 -0
  64. package/esm/__chunks/ZJJNX53K.js +68 -0
  65. package/esm/__chunks/ZU6UY6LZ.js +56 -0
  66. package/esm/__utils.d.ts +6 -3
  67. package/esm/blur.d.ts +1 -2
  68. package/esm/blur.js +3 -5
  69. package/esm/click.d.ts +1 -2
  70. package/esm/click.js +9 -11
  71. package/esm/dispatch.d.ts +9 -0
  72. package/esm/dispatch.js +8 -0
  73. package/esm/focus.d.ts +1 -2
  74. package/esm/focus.js +3 -5
  75. package/esm/hover.d.ts +1 -2
  76. package/esm/hover.js +4 -6
  77. package/esm/index.d.ts +2 -5
  78. package/esm/index.js +29 -87
  79. package/esm/mouse-down.d.ts +1 -2
  80. package/esm/mouse-down.js +5 -7
  81. package/esm/mouse-up.d.ts +1 -2
  82. package/esm/mouse-up.js +3 -4
  83. package/esm/press.d.ts +0 -1
  84. package/esm/press.js +7 -9
  85. package/esm/query.d.ts +3989 -0
  86. package/esm/query.js +9 -0
  87. package/esm/react.d.ts +7 -0
  88. package/esm/react.js +89 -0
  89. package/esm/select.d.ts +1 -2
  90. package/esm/select.js +9 -11
  91. package/esm/sleep.js +2 -3
  92. package/esm/tap.d.ts +1 -2
  93. package/esm/tap.js +10 -12
  94. package/esm/tsconfig.build.tsbuildinfo +1 -1
  95. package/esm/type.d.ts +0 -1
  96. package/esm/type.js +5 -7
  97. package/esm/wait-for.d.ts +2 -1
  98. package/esm/wait-for.js +2 -1
  99. package/package.json +21 -24
  100. package/query/package.json +8 -0
  101. package/react/package.json +8 -0
  102. package/act/package.json +0 -8
  103. package/cjs/__chunks/3NIZQX5J.cjs +0 -6
  104. package/cjs/__chunks/3WW644T7.cjs +0 -20
  105. package/cjs/__chunks/5F5PNQCC.cjs +0 -22
  106. package/cjs/__chunks/7BZFO6FC.cjs +0 -12
  107. package/cjs/__chunks/7RUXTAPP.cjs +0 -16
  108. package/cjs/__chunks/B4VP2LEU.cjs +0 -28
  109. package/cjs/__chunks/BHNBCXUN.cjs +0 -33
  110. package/cjs/__chunks/EGF4KWUK.cjs +0 -64
  111. package/cjs/__chunks/HGTTGPFK.cjs +0 -54
  112. package/cjs/__chunks/JY5DGPUE.cjs +0 -14
  113. package/cjs/__chunks/KRQVK4KQ.cjs +0 -38
  114. package/cjs/__chunks/LFNIGEB6.cjs +0 -50
  115. package/cjs/__chunks/MQA5IB4L.cjs +0 -6
  116. package/cjs/__chunks/Q7PN3HIB.cjs +0 -121
  117. package/cjs/__chunks/SYQ5J5KP.cjs +0 -32
  118. package/cjs/__chunks/VIKUJSTX.cjs +0 -83
  119. package/cjs/act.cjs +0 -8
  120. package/cjs/act.d.ts +0 -1
  121. package/cjs/fire-event.cjs +0 -9
  122. package/cjs/fire-event.d.ts +0 -3
  123. package/cjs/polyfills.cjs +0 -3
  124. package/cjs/polyfills.d.ts +0 -1
  125. package/cjs/render.cjs +0 -9
  126. package/cjs/render.d.ts +0 -5
  127. package/cjs/screen.cjs +0 -55
  128. package/cjs/screen.d.ts +0 -26
  129. package/cjs/within.cjs +0 -7
  130. package/cjs/within.d.ts +0 -1
  131. package/esm/__chunks/2OZA4WAZ.js +0 -50
  132. package/esm/__chunks/2RHTJFSK.js +0 -38
  133. package/esm/__chunks/3C72DPE2.js +0 -54
  134. package/esm/__chunks/4A3YKZRA.js +0 -121
  135. package/esm/__chunks/5JPM5LQX.js +0 -6
  136. package/esm/__chunks/5PINJ4MD.js +0 -16
  137. package/esm/__chunks/AEOE57TZ.js +0 -33
  138. package/esm/__chunks/EVYPE6ZJ.js +0 -32
  139. package/esm/__chunks/EX5WPJOU.js +0 -64
  140. package/esm/__chunks/JTFRQL3H.js +0 -83
  141. package/esm/__chunks/LJWZLI6L.js +0 -14
  142. package/esm/__chunks/OQYWQML5.js +0 -12
  143. package/esm/__chunks/OSCTTZUZ.js +0 -28
  144. package/esm/__chunks/QA3ZS6S2.js +0 -6
  145. package/esm/__chunks/R7IYW63J.js +0 -22
  146. package/esm/__chunks/ZEO5Q6UD.js +0 -20
  147. package/esm/act.d.ts +0 -1
  148. package/esm/act.js +0 -8
  149. package/esm/fire-event.d.ts +0 -3
  150. package/esm/fire-event.js +0 -9
  151. package/esm/polyfills.d.ts +0 -1
  152. package/esm/polyfills.js +0 -3
  153. package/esm/render.d.ts +0 -5
  154. package/esm/render.js +0 -9
  155. package/esm/screen.d.ts +0 -26
  156. package/esm/screen.js +0 -55
  157. package/esm/within.d.ts +0 -1
  158. package/esm/within.js +0 -7
  159. package/fire-event/package.json +0 -8
  160. package/polyfills/package.json +0 -8
  161. package/render/package.json +0 -8
  162. package/screen/package.json +0 -8
  163. package/within/package.json +0 -8
  164. /package/cjs/__chunks/{AYRPODWR.cjs → IDMD7IDF.cjs} +0 -0
  165. /package/esm/__chunks/{PNBZ5NXH.js → 36HVAQ4Z.js} +0 -0
package/cjs/render.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import "./polyfills.js";
2
- import type { ReactElement } from "react";
3
- import type { RenderOptions } from "@testing-library/react";
4
- declare function customRender(ui: ReactElement, options?: Omit<RenderOptions, "wrapper">): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries.js"), HTMLElement, HTMLElement>;
5
- export { customRender as render };
package/cjs/screen.cjs DELETED
@@ -1,55 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
- var _HGTTGPFKcjs = require('./__chunks/HGTTGPFK.cjs');
28
- require('./__chunks/PKWBCPZU.cjs');
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
- exports.findAllByLabelText = _HGTTGPFKcjs.findAllByLabelText; exports.findAllByPlaceholderText = _HGTTGPFKcjs.findAllByPlaceholderText; exports.findAllByRole = _HGTTGPFKcjs.findAllByRole; exports.findAllByText = _HGTTGPFKcjs.findAllByText; exports.findByLabelText = _HGTTGPFKcjs.findByLabelText; exports.findByPlaceholderText = _HGTTGPFKcjs.findByPlaceholderText; exports.findByRole = _HGTTGPFKcjs.findByRole; exports.findByText = _HGTTGPFKcjs.findByText; exports.getAllByLabelText = _HGTTGPFKcjs.getAllByLabelText; exports.getAllByPlaceholderText = _HGTTGPFKcjs.getAllByPlaceholderText; exports.getAllByRole = _HGTTGPFKcjs.getAllByRole; exports.getAllByText = _HGTTGPFKcjs.getAllByText; exports.getByLabelText = _HGTTGPFKcjs.getByLabelText; exports.getByPlaceholderText = _HGTTGPFKcjs.getByPlaceholderText; exports.getByRole = _HGTTGPFKcjs.getByRole; exports.getByText = _HGTTGPFKcjs.getByText; exports.queryAllByLabelText = _HGTTGPFKcjs.queryAllByLabelText; exports.queryAllByPlaceholderText = _HGTTGPFKcjs.queryAllByPlaceholderText; exports.queryAllByRole = _HGTTGPFKcjs.queryAllByRole; exports.queryAllByText = _HGTTGPFKcjs.queryAllByText; exports.queryByLabelText = _HGTTGPFKcjs.queryByLabelText; exports.queryByPlaceholderText = _HGTTGPFKcjs.queryByPlaceholderText; exports.queryByRole = _HGTTGPFKcjs.queryByRole; exports.queryByText = _HGTTGPFKcjs.queryByText; exports.screen = _HGTTGPFKcjs.screen;
package/cjs/screen.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { screen } from "@testing-library/react";
2
- export { screen };
3
- export declare const getByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement);
4
- export declare const getByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement);
5
- export declare const getByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => T) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement);
6
- export declare const getByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => T) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement);
7
- export declare const queryByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T | null) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null);
8
- export declare const queryByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T | null) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null);
9
- export declare const queryByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => T | null) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null);
10
- export declare const queryByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => T | null) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null);
11
- export declare const findByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>);
12
- export declare const findByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>);
13
- export declare const findByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T>) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>);
14
- export declare const findByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>);
15
- export declare const getAllByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[]);
16
- export declare const getAllByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[]);
17
- export declare const getAllByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => T[]) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[]);
18
- export declare const getAllByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[]);
19
- export declare const queryAllByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[]);
20
- export declare const queryAllByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[]);
21
- export declare const queryAllByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => T[]) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[]);
22
- export declare const queryAllByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => T[]) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[]);
23
- export declare const findAllByText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T[]>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>);
24
- export declare const findAllByLabelText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T[]>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>);
25
- export declare const findAllByRole: (<T extends HTMLElement = HTMLElement>(role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T[]>) & ((role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>);
26
- export declare const findAllByPlaceholderText: (<T extends HTMLElement = HTMLElement>(id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<T[]>) & ((id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>);
package/cjs/within.cjs DELETED
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _MQA5IB4Lcjs = require('./__chunks/MQA5IB4L.cjs');
4
- require('./__chunks/PKWBCPZU.cjs');
5
-
6
-
7
- exports.within = _MQA5IB4Lcjs.within;
package/cjs/within.d.ts DELETED
@@ -1 +0,0 @@
1
- export { within } from "@testing-library/react";
@@ -1,50 +0,0 @@
1
- import {
2
- blur
3
- } from "./AEOE57TZ.js";
4
- import {
5
- focus
6
- } from "./OSCTTZUZ.js";
7
- import {
8
- fireEvent
9
- } from "./2RHTJFSK.js";
10
- import {
11
- __spreadValues
12
- } from "./6XO5G2QR.js";
13
-
14
- // src/mouse-down.ts
15
- import { getDocument, isVisible } from "@ariakit/core/utils/dom";
16
- import { getClosestFocusable, isFocusable } from "@ariakit/core/utils/focus";
17
- function mouseDown(element, options) {
18
- if (!isVisible(element))
19
- return;
20
- const { disabled } = element;
21
- let defaultAllowed = fireEvent.pointerDown(element, options);
22
- if (!disabled) {
23
- if (!fireEvent.mouseDown(element, __spreadValues({ detail: 1 }, options))) {
24
- defaultAllowed = false;
25
- }
26
- }
27
- if (defaultAllowed) {
28
- const selection = getDocument(element).getSelection();
29
- if (selection && selection.rangeCount) {
30
- const range = selection.getRangeAt(0);
31
- if (!range.collapsed) {
32
- selection.removeAllRanges();
33
- }
34
- }
35
- if (isFocusable(element) && getComputedStyle(element).pointerEvents !== "none") {
36
- focus(element);
37
- } else if (element.parentElement) {
38
- const closestFocusable = getClosestFocusable(element.parentElement);
39
- if (closestFocusable) {
40
- focus(closestFocusable);
41
- } else {
42
- blur();
43
- }
44
- }
45
- }
46
- }
47
-
48
- export {
49
- mouseDown
50
- };
@@ -1,38 +0,0 @@
1
- // src/fire-event.ts
2
- import { fireEvent } from "@testing-library/dom";
3
- var pointerEvents = [
4
- "mouseMove",
5
- "mouseOver",
6
- "mouseEnter",
7
- "mouseOut",
8
- "mouseLeave",
9
- "mouseDown",
10
- "mouseUp",
11
- "pointerMove",
12
- "pointerOver",
13
- "pointerEnter",
14
- "pointerOut",
15
- "pointerLeave",
16
- "pointerDown",
17
- "pointerUp",
18
- "click"
19
- ];
20
- for (const event of pointerEvents) {
21
- const baseFireEvent = fireEvent[event];
22
- fireEvent[event] = (element, options) => {
23
- if (element instanceof Element) {
24
- const style = getComputedStyle(element);
25
- if (style.pointerEvents === "none") {
26
- if (element.parentElement) {
27
- return fireEvent[event](element.parentElement, options);
28
- }
29
- return true;
30
- }
31
- }
32
- return baseFireEvent(element, options);
33
- };
34
- }
35
-
36
- export {
37
- fireEvent
38
- };
@@ -1,54 +0,0 @@
1
- // src/screen.ts
2
- import { screen } from "@testing-library/react";
3
- var getByText = screen.getByText;
4
- var getByLabelText = screen.getByLabelText;
5
- var getByRole = screen.getByRole;
6
- var getByPlaceholderText = screen.getByPlaceholderText;
7
- var queryByText = screen.queryByText;
8
- var queryByLabelText = screen.queryByLabelText;
9
- var queryByRole = screen.queryByRole;
10
- var queryByPlaceholderText = screen.queryByPlaceholderText;
11
- var findByText = screen.findByText;
12
- var findByLabelText = screen.findByLabelText;
13
- var findByRole = screen.findByRole;
14
- var findByPlaceholderText = screen.findByPlaceholderText;
15
- var getAllByText = screen.getAllByText;
16
- var getAllByLabelText = screen.getAllByLabelText;
17
- var getAllByRole = screen.getAllByRole;
18
- var getAllByPlaceholderText = screen.getAllByPlaceholderText;
19
- var queryAllByText = screen.queryAllByText;
20
- var queryAllByLabelText = screen.queryAllByLabelText;
21
- var queryAllByRole = screen.queryAllByRole;
22
- var queryAllByPlaceholderText = screen.queryAllByPlaceholderText;
23
- var findAllByText = screen.findAllByText;
24
- var findAllByLabelText = screen.findAllByLabelText;
25
- var findAllByRole = screen.findAllByRole;
26
- var findAllByPlaceholderText = screen.findAllByPlaceholderText;
27
-
28
- export {
29
- screen,
30
- getByText,
31
- getByLabelText,
32
- getByRole,
33
- getByPlaceholderText,
34
- queryByText,
35
- queryByLabelText,
36
- queryByRole,
37
- queryByPlaceholderText,
38
- findByText,
39
- findByLabelText,
40
- findByRole,
41
- findByPlaceholderText,
42
- getAllByText,
43
- getAllByLabelText,
44
- getAllByRole,
45
- getAllByPlaceholderText,
46
- queryAllByText,
47
- queryAllByLabelText,
48
- queryAllByRole,
49
- queryAllByPlaceholderText,
50
- findAllByText,
51
- findAllByLabelText,
52
- findAllByRole,
53
- findAllByPlaceholderText
54
- };
@@ -1,121 +0,0 @@
1
- import {
2
- focus
3
- } from "./OSCTTZUZ.js";
4
- import {
5
- fireEvent
6
- } from "./2RHTJFSK.js";
7
- import {
8
- sleep
9
- } from "./5PINJ4MD.js";
10
- import {
11
- queuedMicrotasks
12
- } from "./ZEO5Q6UD.js";
13
- import {
14
- __spreadValues
15
- } from "./6XO5G2QR.js";
16
-
17
- // src/type.ts
18
- import { getActiveElement, isTextField } from "@ariakit/core/utils/dom";
19
- import { isFocusable } from "@ariakit/core/utils/focus";
20
- function getKeyFromChar(key) {
21
- if (key === "\x7F")
22
- return "Delete";
23
- if (key === "\b")
24
- return "Backspace";
25
- if (key === "\n")
26
- return "Enter";
27
- if (key === " ")
28
- return "Tab";
29
- return key;
30
- }
31
- function workAroundEmailInput(element) {
32
- const input = element;
33
- if (input.tagName !== "INPUT" || input.type !== "email")
34
- return () => {
35
- };
36
- input.type = "text";
37
- return () => {
38
- input.type = "email";
39
- };
40
- }
41
- async function type(text, element, options = {}) {
42
- var _a, _b;
43
- if (element == null) {
44
- element = document.activeElement;
45
- }
46
- if (!element)
47
- return;
48
- if (!isFocusable(element))
49
- return;
50
- focus(element);
51
- element.dirty = true;
52
- const restoreEmailInput = workAroundEmailInput(element);
53
- for (const char of text) {
54
- const key = getKeyFromChar(char);
55
- let value = "";
56
- let inputType = options.isComposing ? "insertCompositionText" : "insertText";
57
- let defaultAllowed = fireEvent.keyDown(element, __spreadValues({ key }, options));
58
- await queuedMicrotasks();
59
- element = getActiveElement(element) || element;
60
- if (isTextField(element)) {
61
- const input = element;
62
- const [start, end] = [(_a = input.selectionStart) != null ? _a : 0, (_b = input.selectionEnd) != null ? _b : 0];
63
- const collapsed = start === end;
64
- let nextCaretPosition = start;
65
- if (char === "\x7F") {
66
- const firstPart = input.value.slice(0, start);
67
- const secondPart = input.value.slice(collapsed ? end + 1 : end);
68
- value = `${firstPart}${secondPart}`;
69
- inputType = "deleteContentForward";
70
- } else if (char === "\b") {
71
- nextCaretPosition = collapsed ? Math.max(start - 1, 0) : start;
72
- const firstPart = input.value.slice(0, nextCaretPosition);
73
- const lastPart = input.value.slice(end, input.value.length);
74
- value = `${firstPart}${lastPart}`;
75
- inputType = "deleteContentBackward";
76
- } else {
77
- const firstPartEnd = options.isComposing ? start - 1 : start;
78
- const firstPart = input.value.slice(0, firstPartEnd);
79
- const lastPart = input.value.slice(end, input.value.length);
80
- nextCaretPosition = start + 1;
81
- value = `${firstPart}${char}${lastPart}`;
82
- }
83
- if (defaultAllowed && !input.readOnly) {
84
- if (inputType === "insertText") {
85
- defaultAllowed = fireEvent.keyPress(input, __spreadValues({
86
- key,
87
- charCode: key.charCodeAt(0)
88
- }, options));
89
- }
90
- if (inputType === "insertCompositionText") {
91
- defaultAllowed = fireEvent.compositionUpdate(input, __spreadValues({
92
- data: char,
93
- target: { value }
94
- }, options));
95
- }
96
- if (defaultAllowed) {
97
- fireEvent.input(input, __spreadValues({
98
- data: char,
99
- target: {
100
- value,
101
- selectionStart: nextCaretPosition,
102
- selectionEnd: nextCaretPosition
103
- },
104
- inputType
105
- }, options));
106
- if (input.selectionStart !== nextCaretPosition) {
107
- input.setSelectionRange(nextCaretPosition, nextCaretPosition);
108
- }
109
- }
110
- }
111
- }
112
- await sleep();
113
- fireEvent.keyUp(element, __spreadValues({ key }, options));
114
- await sleep();
115
- }
116
- restoreEmailInput();
117
- }
118
-
119
- export {
120
- type
121
- };
@@ -1,6 +0,0 @@
1
- // src/wait-for.ts
2
- import { waitFor } from "@testing-library/react";
3
-
4
- export {
5
- waitFor
6
- };
@@ -1,16 +0,0 @@
1
- import {
2
- act,
3
- isBrowser,
4
- nextFrame
5
- } from "./ZEO5Q6UD.js";
6
-
7
- // src/sleep.ts
8
- var defaultMs = isBrowser ? 150 : 10;
9
- async function sleep(ms = defaultMs) {
10
- await nextFrame();
11
- await act(() => new Promise((resolve) => setTimeout(resolve, ms)));
12
- }
13
-
14
- export {
15
- sleep
16
- };
@@ -1,33 +0,0 @@
1
- import {
2
- fireEvent
3
- } from "./2RHTJFSK.js";
4
- import {
5
- act
6
- } from "./ZEO5Q6UD.js";
7
-
8
- // src/blur.ts
9
- import { getActiveElement } from "@ariakit/core/utils/dom";
10
- function blur(element) {
11
- if (element == null) {
12
- element = document.activeElement;
13
- }
14
- if (!element)
15
- return;
16
- if (element.tagName === "BODY")
17
- return;
18
- if (getActiveElement(element) !== element)
19
- return;
20
- if (element.dirty) {
21
- fireEvent.change(element);
22
- element.dirty = false;
23
- }
24
- act(() => {
25
- if (element instanceof HTMLElement || element instanceof SVGElement) {
26
- element.blur();
27
- }
28
- });
29
- }
30
-
31
- export {
32
- blur
33
- };
@@ -1,32 +0,0 @@
1
- import {
2
- isBrowser
3
- } from "./ZEO5Q6UD.js";
4
-
5
- // src/polyfills.ts
6
- import { isFocusable } from "@ariakit/core/utils/focus";
7
- if (!isBrowser && typeof window !== "undefined") {
8
- const originalFocus = window.HTMLElement.prototype.focus;
9
- window.HTMLElement.prototype.focus = function focus(options) {
10
- if (!isFocusable(this))
11
- return;
12
- return originalFocus.call(this, options);
13
- };
14
- window.Element.prototype.getClientRects = function getClientRects() {
15
- const isHidden = (element) => {
16
- if (!element.isConnected)
17
- return true;
18
- if (element.parentElement && isHidden(element.parentElement))
19
- return true;
20
- if (!(element instanceof HTMLElement))
21
- return false;
22
- if (element.hidden)
23
- return true;
24
- const style = getComputedStyle(element);
25
- return style.display === "none" || style.visibility === "hidden";
26
- };
27
- if (isHidden(this)) {
28
- return [];
29
- }
30
- return [{ width: 1, height: 1 }];
31
- };
32
- }
@@ -1,64 +0,0 @@
1
- import {
2
- fireEvent
3
- } from "./2RHTJFSK.js";
4
- import {
5
- sleep
6
- } from "./5PINJ4MD.js";
7
- import {
8
- queuedMicrotasks
9
- } from "./ZEO5Q6UD.js";
10
- import {
11
- __spreadProps,
12
- __spreadValues
13
- } from "./6XO5G2QR.js";
14
-
15
- // src/hover.ts
16
- import { isVisible } from "@ariakit/core/utils/dom";
17
- function isPointerEventsEnabled(element) {
18
- return getComputedStyle(element).pointerEvents !== "none";
19
- }
20
- async function hover(element, options) {
21
- if (!isVisible(element))
22
- return;
23
- const document = element.ownerDocument;
24
- const { lastHovered } = document;
25
- const { disabled } = element;
26
- const pointerEventsEnabled = isPointerEventsEnabled(element);
27
- if (lastHovered && lastHovered !== element && isVisible(lastHovered)) {
28
- fireEvent.pointerMove(lastHovered, options);
29
- fireEvent.mouseMove(lastHovered, options);
30
- if (isPointerEventsEnabled(lastHovered)) {
31
- const isElementWithinLastHovered = lastHovered.contains(element);
32
- const relatedTarget = pointerEventsEnabled ? element : null;
33
- const leaveOptions = __spreadProps(__spreadValues({}, options), { relatedTarget });
34
- fireEvent.pointerOut(lastHovered, leaveOptions);
35
- if (!isElementWithinLastHovered) {
36
- fireEvent.pointerLeave(lastHovered, leaveOptions);
37
- }
38
- fireEvent.mouseOut(lastHovered, leaveOptions);
39
- if (!isElementWithinLastHovered) {
40
- fireEvent.mouseLeave(lastHovered, leaveOptions);
41
- }
42
- }
43
- }
44
- await sleep();
45
- if (pointerEventsEnabled) {
46
- const enterOptions = lastHovered ? __spreadValues({ relatedTarget: lastHovered }, options) : options;
47
- fireEvent.pointerOver(element, enterOptions);
48
- fireEvent.pointerEnter(element, enterOptions);
49
- if (!disabled) {
50
- fireEvent.mouseOver(element, enterOptions);
51
- fireEvent.mouseEnter(element, enterOptions);
52
- }
53
- }
54
- fireEvent.pointerMove(element, options);
55
- if (!disabled) {
56
- fireEvent.mouseMove(element, options);
57
- }
58
- document.lastHovered = element;
59
- await queuedMicrotasks();
60
- }
61
-
62
- export {
63
- hover
64
- };
@@ -1,83 +0,0 @@
1
- import {
2
- mouseUp
3
- } from "./R7IYW63J.js";
4
- import {
5
- mouseDown
6
- } from "./2OZA4WAZ.js";
7
- import {
8
- hover
9
- } from "./EX5WPJOU.js";
10
- import {
11
- fireEvent
12
- } from "./2RHTJFSK.js";
13
- import {
14
- sleep
15
- } from "./5PINJ4MD.js";
16
- import {
17
- __spreadValues
18
- } from "./6XO5G2QR.js";
19
-
20
- // src/select.ts
21
- import { isVisible } from "@ariakit/core/utils/dom";
22
- async function select(text, element = document.body, options) {
23
- var _a, _b;
24
- if (!isVisible(element))
25
- return;
26
- const document2 = element.ownerDocument;
27
- await hover(element, options);
28
- mouseDown(element, options);
29
- element.dispatchEvent(
30
- new Event("selectstart", {
31
- bubbles: true,
32
- cancelable: true,
33
- composed: false
34
- })
35
- );
36
- const startIndex = (_b = (_a = element.textContent) == null ? void 0 : _a.indexOf(text)) != null ? _b : -1;
37
- const selection = document2.getSelection();
38
- const range = document2.createRange();
39
- for (let i = 1; i <= text.length; i++) {
40
- const iterator = document2.createNodeIterator(element, NodeFilter.SHOW_TEXT);
41
- const textSlice = text.slice(0, i);
42
- const endIndex = startIndex + textSlice.length;
43
- let index = startIndex;
44
- let node = null;
45
- let charCount = 0;
46
- let startContainer = null;
47
- let startOffset = -1;
48
- let endContainer = null;
49
- let endOffset = -1;
50
- while (index >= 0 && index < endIndex && charCount < endIndex && (node = iterator.nextNode())) {
51
- const textContent = node.textContent;
52
- if (!textContent)
53
- continue;
54
- charCount += textContent.length;
55
- if (index > charCount)
56
- continue;
57
- if (!startContainer) {
58
- startContainer = node;
59
- startOffset = index - charCount + textContent.length;
60
- }
61
- endContainer = node;
62
- endOffset = endIndex - charCount + textContent.length;
63
- index++;
64
- }
65
- if (!startContainer || !endContainer)
66
- continue;
67
- await hover(element, options);
68
- range.setStart(startContainer, startOffset);
69
- range.setEnd(endContainer, endOffset);
70
- selection == null ? void 0 : selection.removeAllRanges();
71
- selection == null ? void 0 : selection.addRange(range);
72
- }
73
- await sleep();
74
- mouseUp(element, options);
75
- fireEvent.click(element, __spreadValues({ detail: 1 }, options));
76
- selection == null ? void 0 : selection.removeAllRanges();
77
- selection == null ? void 0 : selection.addRange(range);
78
- await sleep();
79
- }
80
-
81
- export {
82
- select
83
- };
@@ -1,14 +0,0 @@
1
- import {
2
- __spreadValues
3
- } from "./6XO5G2QR.js";
4
-
5
- // src/render.ts
6
- import { StrictMode } from "react";
7
- import { render } from "@testing-library/react";
8
- function customRender(ui, options) {
9
- return render(ui, __spreadValues({ wrapper: StrictMode }, options));
10
- }
11
-
12
- export {
13
- customRender
14
- };
@@ -1,12 +0,0 @@
1
- import {
2
- click
3
- } from "./SWUQE4WB.js";
4
-
5
- // src/tap.ts
6
- async function tap(element, options) {
7
- await click(element, options, true);
8
- }
9
-
10
- export {
11
- tap
12
- };