@react-aria/test-utils 3.0.0-nightly-796738501-260310 → 3.0.0-nightly-6a0d13c57-260322

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 (141) hide show
  1. package/dist/import.mjs +4 -4
  2. package/dist/main.js +4 -4
  3. package/dist/module.js +4 -4
  4. package/dist/private/act.cjs +28 -0
  5. package/dist/private/act.cjs.map +1 -0
  6. package/dist/private/act.js +23 -0
  7. package/dist/private/act.mjs +23 -0
  8. package/dist/private/act.mjs.map +1 -0
  9. package/dist/{checkboxgroup.main.js → private/checkboxgroup.cjs} +11 -9
  10. package/dist/private/checkboxgroup.cjs.map +1 -0
  11. package/dist/{checkboxgroup.module.js → private/checkboxgroup.js} +6 -4
  12. package/dist/{checkboxgroup.mjs → private/checkboxgroup.mjs} +5 -3
  13. package/dist/private/checkboxgroup.mjs.map +1 -0
  14. package/dist/{combobox.main.js → private/combobox.cjs} +15 -13
  15. package/dist/private/combobox.cjs.map +1 -0
  16. package/dist/{combobox.mjs → private/combobox.js} +6 -4
  17. package/dist/{combobox.module.js → private/combobox.mjs} +6 -4
  18. package/dist/private/combobox.mjs.map +1 -0
  19. package/dist/{dialog.main.js → private/dialog.cjs} +10 -8
  20. package/dist/private/dialog.cjs.map +1 -0
  21. package/dist/{dialog.mjs → private/dialog.js} +5 -3
  22. package/dist/{dialog.module.js → private/dialog.mjs} +5 -3
  23. package/dist/private/dialog.mjs.map +1 -0
  24. package/dist/{events.main.js → private/events.cjs} +17 -15
  25. package/dist/private/events.cjs.map +1 -0
  26. package/dist/{events.mjs → private/events.js} +8 -6
  27. package/dist/{events.module.js → private/events.mjs} +8 -6
  28. package/dist/private/events.mjs.map +1 -0
  29. package/dist/{gridlist.main.js → private/gridlist.cjs} +11 -9
  30. package/dist/private/gridlist.cjs.map +1 -0
  31. package/dist/{gridlist.module.js → private/gridlist.js} +6 -4
  32. package/dist/{gridlist.mjs → private/gridlist.mjs} +5 -3
  33. package/dist/private/gridlist.mjs.map +1 -0
  34. package/dist/{listbox.main.js → private/listbox.cjs} +9 -7
  35. package/dist/private/listbox.cjs.map +1 -0
  36. package/dist/{listbox.module.js → private/listbox.js} +6 -4
  37. package/dist/{listbox.mjs → private/listbox.mjs} +5 -3
  38. package/dist/private/listbox.mjs.map +1 -0
  39. package/dist/{menu.main.js → private/menu.cjs} +25 -23
  40. package/dist/private/menu.cjs.map +1 -0
  41. package/dist/{menu.module.js → private/menu.js} +10 -8
  42. package/dist/{menu.mjs → private/menu.mjs} +9 -7
  43. package/dist/private/menu.mjs.map +1 -0
  44. package/dist/{radiogroup.main.js → private/radiogroup.cjs} +12 -10
  45. package/dist/private/radiogroup.cjs.map +1 -0
  46. package/dist/{radiogroup.module.js → private/radiogroup.js} +7 -5
  47. package/dist/{radiogroup.mjs → private/radiogroup.mjs} +6 -4
  48. package/dist/private/radiogroup.mjs.map +1 -0
  49. package/dist/{select.main.js → private/select.cjs} +19 -15
  50. package/dist/private/select.cjs.map +1 -0
  51. package/dist/{select.module.js → private/select.js} +11 -7
  52. package/dist/{select.mjs → private/select.mjs} +11 -7
  53. package/dist/private/select.mjs.map +1 -0
  54. package/dist/{table.main.js → private/table.cjs} +35 -33
  55. package/dist/private/table.cjs.map +1 -0
  56. package/dist/{table.module.js → private/table.js} +9 -7
  57. package/dist/{table.mjs → private/table.mjs} +8 -6
  58. package/dist/private/table.mjs.map +1 -0
  59. package/dist/{tabs.main.js → private/tabs.cjs} +11 -9
  60. package/dist/private/tabs.cjs.map +1 -0
  61. package/dist/{tabs.module.js → private/tabs.js} +8 -6
  62. package/dist/{tabs.mjs → private/tabs.mjs} +7 -5
  63. package/dist/private/tabs.mjs.map +1 -0
  64. package/dist/{testSetup.main.js → private/testSetup.cjs} +1 -1
  65. package/dist/{testSetup.main.js.map → private/testSetup.cjs.map} +1 -1
  66. package/dist/{testSetup.module.js → private/testSetup.js} +1 -1
  67. package/dist/{testSetup.mjs → private/testSetup.mjs} +1 -1
  68. package/dist/{testSetup.module.js.map → private/testSetup.mjs.map} +1 -1
  69. package/dist/{tree.main.js → private/tree.cjs} +14 -12
  70. package/dist/private/tree.cjs.map +1 -0
  71. package/dist/{tree.module.js → private/tree.js} +7 -5
  72. package/dist/{tree.mjs → private/tree.mjs} +6 -4
  73. package/dist/private/tree.mjs.map +1 -0
  74. package/dist/{user.main.js → private/user.cjs} +13 -13
  75. package/dist/{user.main.js.map → private/user.cjs.map} +1 -1
  76. package/dist/{user.module.js → private/user.js} +13 -13
  77. package/dist/{user.mjs → private/user.mjs} +1 -1
  78. package/dist/{user.module.js.map → private/user.mjs.map} +1 -1
  79. package/dist/{userEventMaps.main.js → private/userEventMaps.cjs} +1 -1
  80. package/dist/{userEventMaps.main.js.map → private/userEventMaps.cjs.map} +1 -1
  81. package/dist/{userEventMaps.module.js → private/userEventMaps.js} +1 -1
  82. package/dist/{userEventMaps.mjs → private/userEventMaps.mjs} +1 -1
  83. package/dist/{userEventMaps.module.js.map → private/userEventMaps.mjs.map} +1 -1
  84. package/dist/types/src/act.d.ts +2 -0
  85. package/dist/types/src/checkboxgroup.d.ts +45 -0
  86. package/dist/types/src/combobox.d.ts +75 -0
  87. package/dist/types/src/dialog.d.ts +36 -0
  88. package/dist/types/src/events.d.ts +25 -0
  89. package/dist/types/src/gridlist.d.ts +51 -0
  90. package/dist/types/src/index.d.ts +16 -0
  91. package/dist/types/src/listbox.d.ts +80 -0
  92. package/dist/types/src/menu.d.ts +102 -0
  93. package/dist/types/src/radiogroup.d.ts +46 -0
  94. package/dist/types/src/select.d.ts +67 -0
  95. package/dist/types/src/table.d.ts +104 -0
  96. package/dist/types/src/tabs.d.ts +58 -0
  97. package/dist/types/src/testSetup.d.ts +6 -0
  98. package/dist/types/src/tree.d.ts +57 -0
  99. package/dist/types/src/types.d.ts +136 -0
  100. package/dist/types/src/user.d.ts +47 -0
  101. package/dist/types/src/userEventMaps.d.ts +2 -0
  102. package/package.json +7 -6
  103. package/src/act.ts +23 -0
  104. package/src/checkboxgroup.ts +2 -1
  105. package/src/combobox.ts +2 -1
  106. package/src/dialog.ts +2 -1
  107. package/src/events.ts +2 -1
  108. package/src/gridlist.ts +2 -1
  109. package/src/listbox.ts +2 -1
  110. package/src/menu.ts +2 -1
  111. package/src/radiogroup.ts +2 -1
  112. package/src/select.ts +12 -3
  113. package/src/table.ts +2 -1
  114. package/src/tabs.ts +2 -1
  115. package/src/tree.ts +2 -1
  116. package/dist/checkboxgroup.main.js.map +0 -1
  117. package/dist/checkboxgroup.module.js.map +0 -1
  118. package/dist/combobox.main.js.map +0 -1
  119. package/dist/combobox.module.js.map +0 -1
  120. package/dist/dialog.main.js.map +0 -1
  121. package/dist/dialog.module.js.map +0 -1
  122. package/dist/events.main.js.map +0 -1
  123. package/dist/events.module.js.map +0 -1
  124. package/dist/gridlist.main.js.map +0 -1
  125. package/dist/gridlist.module.js.map +0 -1
  126. package/dist/listbox.main.js.map +0 -1
  127. package/dist/listbox.module.js.map +0 -1
  128. package/dist/menu.main.js.map +0 -1
  129. package/dist/menu.module.js.map +0 -1
  130. package/dist/radiogroup.main.js.map +0 -1
  131. package/dist/radiogroup.module.js.map +0 -1
  132. package/dist/select.main.js.map +0 -1
  133. package/dist/select.module.js.map +0 -1
  134. package/dist/table.main.js.map +0 -1
  135. package/dist/table.module.js.map +0 -1
  136. package/dist/tabs.main.js.map +0 -1
  137. package/dist/tabs.module.js.map +0 -1
  138. package/dist/tree.main.js.map +0 -1
  139. package/dist/tree.module.js.map +0 -1
  140. package/dist/types.d.ts +0 -829
  141. package/dist/types.d.ts.map +0 -1
package/dist/import.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.mjs";
2
- import {installMouseEvent as $68df97871cfb5e33$export$de31e3987c917741, installPointerEvent as $68df97871cfb5e33$export$82f0b04c1d69a901} from "./testSetup.mjs";
3
- import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./userEventMaps.mjs";
4
- import {User as $0d71b4e9cc4df40a$export$1f44aaf2ec115b54} from "./user.mjs";
1
+ import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./private/events.mjs";
2
+ import {installMouseEvent as $68df97871cfb5e33$export$de31e3987c917741, installPointerEvent as $68df97871cfb5e33$export$82f0b04c1d69a901} from "./private/testSetup.mjs";
3
+ import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./private/userEventMaps.mjs";
4
+ import {User as $0d71b4e9cc4df40a$export$1f44aaf2ec115b54} from "./private/user.mjs";
5
5
 
6
6
  /*
7
7
  * Copyright 2023 Adobe. All rights reserved.
package/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
- var $5a8bfe1663b8366d$exports = require("./events.main.js");
2
- var $b53408e40e8d56d0$exports = require("./testSetup.main.js");
3
- var $0e568517a25183a7$exports = require("./userEventMaps.main.js");
4
- var $4168d511756883ff$exports = require("./user.main.js");
1
+ var $5a8bfe1663b8366d$exports = require("./private/events.cjs");
2
+ var $b53408e40e8d56d0$exports = require("./private/testSetup.cjs");
3
+ var $0e568517a25183a7$exports = require("./private/userEventMaps.cjs");
4
+ var $4168d511756883ff$exports = require("./private/user.cjs");
5
5
 
6
6
 
7
7
  function $parcel$export(e, n, v, s) {
package/dist/module.js CHANGED
@@ -1,7 +1,7 @@
1
- import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.module.js";
2
- import {installMouseEvent as $68df97871cfb5e33$export$de31e3987c917741, installPointerEvent as $68df97871cfb5e33$export$82f0b04c1d69a901} from "./testSetup.module.js";
3
- import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./userEventMaps.module.js";
4
- import {User as $0d71b4e9cc4df40a$export$1f44aaf2ec115b54} from "./user.module.js";
1
+ import {triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./private/events.js";
2
+ import {installMouseEvent as $68df97871cfb5e33$export$de31e3987c917741, installPointerEvent as $68df97871cfb5e33$export$82f0b04c1d69a901} from "./private/testSetup.js";
3
+ import {pointerMap as $50ecfb18069ec897$export$7dbde2c4caaa8d35} from "./private/userEventMaps.js";
4
+ import {User as $0d71b4e9cc4df40a$export$1f44aaf2ec115b54} from "./private/user.js";
5
5
 
6
6
  /*
7
7
  * Copyright 2023 Adobe. All rights reserved.
@@ -0,0 +1,28 @@
1
+ var $6ZHZG$react = require("react");
2
+ var $6ZHZG$reactdomtestutils = require("react-dom/test-utils");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "act", () => $72b9f4c3b7f70828$export$3ba232387fd5d6dd);
10
+ /*
11
+ * Copyright 2025 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ let $72b9f4c3b7f70828$var$actImpl;
23
+ if (typeof $6ZHZG$react.act === 'function') $72b9f4c3b7f70828$var$actImpl = $6ZHZG$react.act;
24
+ else $72b9f4c3b7f70828$var$actImpl = $6ZHZG$reactdomtestutils.act;
25
+ const $72b9f4c3b7f70828$export$3ba232387fd5d6dd = $72b9f4c3b7f70828$var$actImpl;
26
+
27
+
28
+ //# sourceMappingURL=act.cjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAKD,IAAI;AACJ,IAAI,OAAO,qBAAc,YACvB,gCAAU;KAEV,gCAAU;AAGL,MAAM,4CAAM","sources":["packages/@react-aria/test-utils/src/act.ts"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport * as ReactDOMTestUtils from 'react-dom/test-utils';\n\nlet actImpl: typeof ReactDOMTestUtils.act;\nif (typeof React.act === 'function') {\n actImpl = React.act;\n} else {\n actImpl = ReactDOMTestUtils.act;\n}\n\nexport const act = actImpl;\n"],"names":[],"version":3,"file":"act.cjs.map"}
@@ -0,0 +1,23 @@
1
+ import {act as $iGmPy$act} from "react";
2
+ import {act as $iGmPy$act1} from "react-dom/test-utils";
3
+
4
+ /*
5
+ * Copyright 2025 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ let $f420be24bb4eafeb$var$actImpl;
17
+ if (typeof $iGmPy$act === 'function') $f420be24bb4eafeb$var$actImpl = $iGmPy$act;
18
+ else $f420be24bb4eafeb$var$actImpl = $iGmPy$act1;
19
+ const $f420be24bb4eafeb$export$3ba232387fd5d6dd = $f420be24bb4eafeb$var$actImpl;
20
+
21
+
22
+ export {$f420be24bb4eafeb$export$3ba232387fd5d6dd as act};
23
+ //# sourceMappingURL=act.mjs.map
@@ -0,0 +1,23 @@
1
+ import {act as $iGmPy$act} from "react";
2
+ import {act as $iGmPy$act1} from "react-dom/test-utils";
3
+
4
+ /*
5
+ * Copyright 2025 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ let $f420be24bb4eafeb$var$actImpl;
17
+ if (typeof $iGmPy$act === 'function') $f420be24bb4eafeb$var$actImpl = $iGmPy$act;
18
+ else $f420be24bb4eafeb$var$actImpl = $iGmPy$act1;
19
+ const $f420be24bb4eafeb$export$3ba232387fd5d6dd = $f420be24bb4eafeb$var$actImpl;
20
+
21
+
22
+ export {$f420be24bb4eafeb$export$3ba232387fd5d6dd as act};
23
+ //# sourceMappingURL=act.mjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAKD,IAAI;AACJ,IAAI,OAAO,eAAc,YACvB,gCAAU;KAEV,gCAAU;AAGL,MAAM,4CAAM","sources":["packages/@react-aria/test-utils/src/act.ts"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport * as ReactDOMTestUtils from 'react-dom/test-utils';\n\nlet actImpl: typeof ReactDOMTestUtils.act;\nif (typeof React.act === 'function') {\n actImpl = React.act;\n} else {\n actImpl = ReactDOMTestUtils.act;\n}\n\nexport const act = actImpl;\n"],"names":[],"version":3,"file":"act.mjs.map"}
@@ -1,5 +1,6 @@
1
- var $5a8bfe1663b8366d$exports = require("./events.main.js");
2
- var $7ADgU$testinglibraryreact = require("@testing-library/react");
1
+ var $72b9f4c3b7f70828$exports = require("./act.cjs");
2
+ var $5a8bfe1663b8366d$exports = require("./events.cjs");
3
+ var $7ADgU$testinglibrarydom = require("@testing-library/dom");
3
4
 
4
5
 
5
6
  function $parcel$export(e, n, v, s) {
@@ -19,6 +20,7 @@ $parcel$export(module.exports, "CheckboxGroupTester", () => $18c3478e4f4e94c5$ex
19
20
  * governing permissions and limitations under the License.
20
21
  */
21
22
 
23
+
22
24
  class $18c3478e4f4e94c5$export$f54f4bde770cc5a6 {
23
25
  /**
24
26
  * Set the interaction type used by the checkbox group tester.
@@ -32,13 +34,13 @@ class $18c3478e4f4e94c5$export$f54f4bde770cc5a6 {
32
34
  let checkbox;
33
35
  if (typeof checkboxIndexOrText === 'number') checkbox = this.checkboxes[checkboxIndexOrText];
34
36
  else if (typeof checkboxIndexOrText === 'string') {
35
- let label = (0, $7ADgU$testinglibraryreact.within)(this.checkboxgroup).getByText(checkboxIndexOrText);
37
+ let label = (0, $7ADgU$testinglibrarydom.within)(this.checkboxgroup).getByText(checkboxIndexOrText);
36
38
  // Label may wrap the checkbox, or the actual label may be a sibling span, or the checkbox div could have the label within it
37
39
  if (label) {
38
- checkbox = (0, $7ADgU$testinglibraryreact.within)(label).queryByRole('checkbox');
40
+ checkbox = (0, $7ADgU$testinglibrarydom.within)(label).queryByRole('checkbox');
39
41
  if (!checkbox) {
40
42
  let labelWrapper = label.closest('label');
41
- if (labelWrapper) checkbox = (0, $7ADgU$testinglibraryreact.within)(labelWrapper).queryByRole('checkbox');
43
+ if (labelWrapper) checkbox = (0, $7ADgU$testinglibrarydom.within)(labelWrapper).queryByRole('checkbox');
42
44
  else checkbox = label.closest('[role=checkbox]');
43
45
  }
44
46
  }
@@ -52,7 +54,7 @@ class $18c3478e4f4e94c5$export$f54f4bde770cc5a6 {
52
54
  if (checkboxes.length === 0) throw new Error('Checkbox group doesnt have any non-disabled checkboxes. Please double check your checkbox group.');
53
55
  let targetIndex = checkboxes.indexOf(checkbox);
54
56
  if (targetIndex === -1) throw new Error('Checkbox provided is not in the checkbox group.');
55
- if (!this.checkboxgroup.contains(document.activeElement)) (0, $7ADgU$testinglibraryreact.act)(()=>checkboxes[0].focus());
57
+ if (!this.checkboxgroup.contains(document.activeElement)) (0, $72b9f4c3b7f70828$exports.act)(()=>checkboxes[0].focus());
56
58
  let currIndex = checkboxes.indexOf(document.activeElement);
57
59
  if (currIndex === -1) throw new Error('Active element is not in the checkbox group.');
58
60
  for(let i = 0; i < Math.abs(targetIndex - currIndex); i++)await this.user.tab({
@@ -83,7 +85,7 @@ class $18c3478e4f4e94c5$export$f54f4bde770cc5a6 {
83
85
  /**
84
86
  * Returns the checkboxes.
85
87
  */ get checkboxes() {
86
- return (0, $7ADgU$testinglibraryreact.within)(this.checkboxgroup).queryAllByRole('checkbox');
88
+ return (0, $7ADgU$testinglibrarydom.within)(this.checkboxgroup).queryAllByRole('checkbox');
87
89
  }
88
90
  /**
89
91
  * Returns the currently selected checkboxes in the checkboxgroup if any.
@@ -95,10 +97,10 @@ class $18c3478e4f4e94c5$export$f54f4bde770cc5a6 {
95
97
  this.user = user;
96
98
  this._interactionType = interactionType || 'mouse';
97
99
  this._checkboxgroup = root;
98
- let checkboxgroup = (0, $7ADgU$testinglibraryreact.within)(root).queryAllByRole('group');
100
+ let checkboxgroup = (0, $7ADgU$testinglibrarydom.within)(root).queryAllByRole('group');
99
101
  if (checkboxgroup.length > 0) this._checkboxgroup = checkboxgroup[0];
100
102
  }
101
103
  }
102
104
 
103
105
 
104
- //# sourceMappingURL=checkboxgroup.main.js.map
106
+ //# sourceMappingURL=checkboxgroup.cjs.map
@@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QAE3C,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,gBAAgB,CAAA,GAAA,+BAAK,EAAE,MAAM,cAAc,CAAC;QAChD,IAAI,cAAc,MAAM,GAAG,GACzB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,EAAE;IAE1C;AAkHF","sources":["packages/@react-aria/test-utils/src/checkboxgroup.ts"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act} from './act';\nimport {CheckboxGroupTesterOpts, UserOpts} from './types';\nimport {pressElement} from './events';\nimport {within} from '@testing-library/dom';\n\ninterface TriggerCheckboxOptions {\n /**\n * What interaction type to use when triggering a checkbox. Defaults to the interaction type set on the tester.\n */\n interactionType?: UserOpts['interactionType'],\n /**\n * The index, text, or node of the checkbox to toggle selection for.\n */\n checkbox: number | string | HTMLElement\n}\n\nexport class CheckboxGroupTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _checkboxgroup: HTMLElement;\n\n\n constructor(opts: CheckboxGroupTesterOpts) {\n let {root, user, interactionType} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n\n this._checkboxgroup = root;\n let checkboxgroup = within(root).queryAllByRole('group');\n if (checkboxgroup.length > 0) {\n this._checkboxgroup = checkboxgroup[0];\n }\n }\n\n /**\n * Set the interaction type used by the checkbox group tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n }\n\n /**\n * Returns a checkbox matching the specified index or text content.\n */\n findCheckbox(opts: {checkboxIndexOrText: number | string}): HTMLElement {\n let {\n checkboxIndexOrText\n } = opts;\n\n let checkbox;\n if (typeof checkboxIndexOrText === 'number') {\n checkbox = this.checkboxes[checkboxIndexOrText];\n } else if (typeof checkboxIndexOrText === 'string') {\n let label = within(this.checkboxgroup).getByText(checkboxIndexOrText);\n\n // Label may wrap the checkbox, or the actual label may be a sibling span, or the checkbox div could have the label within it\n if (label) {\n checkbox = within(label).queryByRole('checkbox');\n if (!checkbox) {\n let labelWrapper = label.closest('label');\n if (labelWrapper) {\n checkbox = within(labelWrapper).queryByRole('checkbox');\n } else {\n checkbox = label.closest('[role=checkbox]');\n }\n }\n }\n }\n\n return checkbox;\n }\n\n private async keyboardNavigateToCheckbox(opts: {checkbox: HTMLElement}) {\n let {checkbox} = opts;\n let checkboxes = this.checkboxes;\n checkboxes = checkboxes.filter(checkbox => !(checkbox.hasAttribute('disabled') || checkbox.getAttribute('aria-disabled') === 'true'));\n if (checkboxes.length === 0) {\n throw new Error('Checkbox group doesnt have any non-disabled checkboxes. Please double check your checkbox group.');\n }\n\n let targetIndex = checkboxes.indexOf(checkbox);\n if (targetIndex === -1) {\n throw new Error('Checkbox provided is not in the checkbox group.');\n }\n\n if (!this.checkboxgroup.contains(document.activeElement)) {\n act(() => checkboxes[0].focus());\n }\n\n let currIndex = checkboxes.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('Active element is not in the checkbox group.');\n }\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.tab({shift: targetIndex < currIndex});\n }\n };\n\n /**\n * Toggles the specified checkbox. Defaults to using the interaction type set on the checkbox tester.\n */\n async toggleCheckbox(opts: TriggerCheckboxOptions): Promise<void> {\n let {\n checkbox,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof checkbox === 'string' || typeof checkbox === 'number') {\n checkbox = this.findCheckbox({checkboxIndexOrText: checkbox});\n }\n\n if (!checkbox) {\n throw new Error('Target checkbox not found in the checkboxgroup.');\n } else if (checkbox.hasAttribute('disabled')) {\n throw new Error('Target checkbox is disabled.');\n }\n\n if (interactionType === 'keyboard') {\n await this.keyboardNavigateToCheckbox({checkbox});\n await this.user.keyboard('[Space]');\n } else {\n await pressElement(this.user, checkbox, interactionType);\n }\n }\n\n /**\n * Returns the checkboxgroup.\n */\n get checkboxgroup(): HTMLElement {\n return this._checkboxgroup;\n }\n\n /**\n * Returns the checkboxes.\n */\n get checkboxes(): HTMLElement[] {\n return within(this.checkboxgroup).queryAllByRole('checkbox');\n }\n\n /**\n * Returns the currently selected checkboxes in the checkboxgroup if any.\n */\n get selectedCheckboxes(): HTMLElement[] {\n return this.checkboxes.filter(checkbox => (checkbox as HTMLInputElement).checked || checkbox.getAttribute('aria-checked') === 'true');\n }\n}\n"],"names":[],"version":3,"file":"checkboxgroup.cjs.map"}
@@ -1,5 +1,6 @@
1
- import {pressElement as $5d1eca18f92ad0e6$export$6ffa3eb717517feb} from "./events.module.js";
2
- import {within as $jmBF6$within, act as $jmBF6$act} from "@testing-library/react";
1
+ import {act as $f420be24bb4eafeb$export$3ba232387fd5d6dd} from "./act.js";
2
+ import {pressElement as $5d1eca18f92ad0e6$export$6ffa3eb717517feb} from "./events.js";
3
+ import {within as $jmBF6$within} from "@testing-library/dom";
3
4
 
4
5
  /*
5
6
  * Copyright 2025 Adobe. All rights reserved.
@@ -13,6 +14,7 @@ import {within as $jmBF6$within, act as $jmBF6$act} from "@testing-library/react
13
14
  * governing permissions and limitations under the License.
14
15
  */
15
16
 
17
+
16
18
  class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
17
19
  /**
18
20
  * Set the interaction type used by the checkbox group tester.
@@ -46,7 +48,7 @@ class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
46
48
  if (checkboxes.length === 0) throw new Error('Checkbox group doesnt have any non-disabled checkboxes. Please double check your checkbox group.');
47
49
  let targetIndex = checkboxes.indexOf(checkbox);
48
50
  if (targetIndex === -1) throw new Error('Checkbox provided is not in the checkbox group.');
49
- if (!this.checkboxgroup.contains(document.activeElement)) (0, $jmBF6$act)(()=>checkboxes[0].focus());
51
+ if (!this.checkboxgroup.contains(document.activeElement)) (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>checkboxes[0].focus());
50
52
  let currIndex = checkboxes.indexOf(document.activeElement);
51
53
  if (currIndex === -1) throw new Error('Active element is not in the checkbox group.');
52
54
  for(let i = 0; i < Math.abs(targetIndex - currIndex); i++)await this.user.tab({
@@ -96,4 +98,4 @@ class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
96
98
 
97
99
 
98
100
  export {$8473f5d1df4c8eb7$export$f54f4bde770cc5a6 as CheckboxGroupTester};
99
- //# sourceMappingURL=checkboxgroup.module.js.map
101
+ //# sourceMappingURL=checkboxgroup.mjs.map
@@ -1,5 +1,6 @@
1
+ import {act as $f420be24bb4eafeb$export$3ba232387fd5d6dd} from "./act.mjs";
1
2
  import {pressElement as $5d1eca18f92ad0e6$export$6ffa3eb717517feb} from "./events.mjs";
2
- import {within as $jmBF6$within, act as $jmBF6$act} from "@testing-library/react";
3
+ import {within as $jmBF6$within} from "@testing-library/dom";
3
4
 
4
5
  /*
5
6
  * Copyright 2025 Adobe. All rights reserved.
@@ -13,6 +14,7 @@ import {within as $jmBF6$within, act as $jmBF6$act} from "@testing-library/react
13
14
  * governing permissions and limitations under the License.
14
15
  */
15
16
 
17
+
16
18
  class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
17
19
  /**
18
20
  * Set the interaction type used by the checkbox group tester.
@@ -46,7 +48,7 @@ class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
46
48
  if (checkboxes.length === 0) throw new Error('Checkbox group doesnt have any non-disabled checkboxes. Please double check your checkbox group.');
47
49
  let targetIndex = checkboxes.indexOf(checkbox);
48
50
  if (targetIndex === -1) throw new Error('Checkbox provided is not in the checkbox group.');
49
- if (!this.checkboxgroup.contains(document.activeElement)) (0, $jmBF6$act)(()=>checkboxes[0].focus());
51
+ if (!this.checkboxgroup.contains(document.activeElement)) (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>checkboxes[0].focus());
50
52
  let currIndex = checkboxes.indexOf(document.activeElement);
51
53
  if (currIndex === -1) throw new Error('Active element is not in the checkbox group.');
52
54
  for(let i = 0; i < Math.abs(targetIndex - currIndex); i++)await this.user.tab({
@@ -96,4 +98,4 @@ class $8473f5d1df4c8eb7$export$f54f4bde770cc5a6 {
96
98
 
97
99
 
98
100
  export {$8473f5d1df4c8eb7$export$f54f4bde770cc5a6 as CheckboxGroupTester};
99
- //# sourceMappingURL=checkboxgroup.module.js.map
101
+ //# sourceMappingURL=checkboxgroup.mjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAkBM,MAAM;IAkBX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,aAAa,IAA4C,EAAe;QACtE,IAAI,uBACF,mBAAmB,EACpB,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,wBAAwB,UACjC,WAAW,IAAI,CAAC,UAAU,CAAC,oBAAoB;aAC1C,IAAI,OAAO,wBAAwB,UAAU;YAClD,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;YAEjD,6HAA6H;YAC7H,IAAI,OAAO;gBACT,WAAW,CAAA,GAAA,aAAK,EAAE,OAAO,WAAW,CAAC;gBACrC,IAAI,CAAC,UAAU;oBACb,IAAI,eAAe,MAAM,OAAO,CAAC;oBACjC,IAAI,cACF,WAAW,CAAA,GAAA,aAAK,EAAE,cAAc,WAAW,CAAC;yBAE5C,WAAW,MAAM,OAAO,CAAC;gBAE7B;YACF;QACF;QAEA,OAAO;IACT;IAEA,MAAc,2BAA2B,IAA6B,EAAE;QACtE,IAAI,YAAC,QAAQ,EAAC,GAAG;QACjB,IAAI,aAAa,IAAI,CAAC,UAAU;QAChC,aAAa,WAAW,MAAM,CAAC,CAAA,WA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A,aAAK,EAAE,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC;IACnD;IAEA;;GAEC,GACD,IAAI,qBAAoC;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA,WAAY,AAAC,SAA8B,OAAO,IAAI,SAAS,YAAY,CAAC,oBAAoB;IAChI;IA3HA,YAAY,IAA6B,CAAE;QACzC,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,EAAC,GAAG;QACpC,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAE3C,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE,MAAM,cAAc,CAAC;QAChD,IAAI,cAAc,MAAM,GAAG,GACzB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,EAAE;IAE1C;AAkHF","sources":["packages/@react-aria/test-utils/src/checkboxgroup.ts"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act} from './act';\nimport {CheckboxGroupTesterOpts, UserOpts} from './types';\nimport {pressElement} from './events';\nimport {within} from '@testing-library/dom';\n\ninterface TriggerCheckboxOptions {\n /**\n * What interaction type to use when triggering a checkbox. Defaults to the interaction type set on the tester.\n */\n interactionType?: UserOpts['interactionType'],\n /**\n * The index, text, or node of the checkbox to toggle selection for.\n */\n checkbox: number | string | HTMLElement\n}\n\nexport class CheckboxGroupTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _checkboxgroup: HTMLElement;\n\n\n constructor(opts: CheckboxGroupTesterOpts) {\n let {root, user, interactionType} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n\n this._checkboxgroup = root;\n let checkboxgroup = within(root).queryAllByRole('group');\n if (checkboxgroup.length > 0) {\n this._checkboxgroup = checkboxgroup[0];\n }\n }\n\n /**\n * Set the interaction type used by the checkbox group tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n }\n\n /**\n * Returns a checkbox matching the specified index or text content.\n */\n findCheckbox(opts: {checkboxIndexOrText: number | string}): HTMLElement {\n let {\n checkboxIndexOrText\n } = opts;\n\n let checkbox;\n if (typeof checkboxIndexOrText === 'number') {\n checkbox = this.checkboxes[checkboxIndexOrText];\n } else if (typeof checkboxIndexOrText === 'string') {\n let label = within(this.checkboxgroup).getByText(checkboxIndexOrText);\n\n // Label may wrap the checkbox, or the actual label may be a sibling span, or the checkbox div could have the label within it\n if (label) {\n checkbox = within(label).queryByRole('checkbox');\n if (!checkbox) {\n let labelWrapper = label.closest('label');\n if (labelWrapper) {\n checkbox = within(labelWrapper).queryByRole('checkbox');\n } else {\n checkbox = label.closest('[role=checkbox]');\n }\n }\n }\n }\n\n return checkbox;\n }\n\n private async keyboardNavigateToCheckbox(opts: {checkbox: HTMLElement}) {\n let {checkbox} = opts;\n let checkboxes = this.checkboxes;\n checkboxes = checkboxes.filter(checkbox => !(checkbox.hasAttribute('disabled') || checkbox.getAttribute('aria-disabled') === 'true'));\n if (checkboxes.length === 0) {\n throw new Error('Checkbox group doesnt have any non-disabled checkboxes. Please double check your checkbox group.');\n }\n\n let targetIndex = checkboxes.indexOf(checkbox);\n if (targetIndex === -1) {\n throw new Error('Checkbox provided is not in the checkbox group.');\n }\n\n if (!this.checkboxgroup.contains(document.activeElement)) {\n act(() => checkboxes[0].focus());\n }\n\n let currIndex = checkboxes.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('Active element is not in the checkbox group.');\n }\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.tab({shift: targetIndex < currIndex});\n }\n };\n\n /**\n * Toggles the specified checkbox. Defaults to using the interaction type set on the checkbox tester.\n */\n async toggleCheckbox(opts: TriggerCheckboxOptions): Promise<void> {\n let {\n checkbox,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof checkbox === 'string' || typeof checkbox === 'number') {\n checkbox = this.findCheckbox({checkboxIndexOrText: checkbox});\n }\n\n if (!checkbox) {\n throw new Error('Target checkbox not found in the checkboxgroup.');\n } else if (checkbox.hasAttribute('disabled')) {\n throw new Error('Target checkbox is disabled.');\n }\n\n if (interactionType === 'keyboard') {\n await this.keyboardNavigateToCheckbox({checkbox});\n await this.user.keyboard('[Space]');\n } else {\n await pressElement(this.user, checkbox, interactionType);\n }\n }\n\n /**\n * Returns the checkboxgroup.\n */\n get checkboxgroup(): HTMLElement {\n return this._checkboxgroup;\n }\n\n /**\n * Returns the checkboxes.\n */\n get checkboxes(): HTMLElement[] {\n return within(this.checkboxgroup).queryAllByRole('checkbox');\n }\n\n /**\n * Returns the currently selected checkboxes in the checkboxgroup if any.\n */\n get selectedCheckboxes(): HTMLElement[] {\n return this.checkboxes.filter(checkbox => (checkbox as HTMLInputElement).checked || checkbox.getAttribute('aria-checked') === 'true');\n }\n}\n"],"names":[],"version":3,"file":"checkboxgroup.mjs.map"}
@@ -1,4 +1,5 @@
1
- var $f8PS3$testinglibraryreact = require("@testing-library/react");
1
+ var $72b9f4c3b7f70828$exports = require("./act.cjs");
2
+ var $f8PS3$testinglibrarydom = require("@testing-library/dom");
2
3
 
3
4
 
4
5
  function $parcel$export(e, n, v, s) {
@@ -17,6 +18,7 @@ $parcel$export(module.exports, "ComboBoxTester", () => $15e4b71f2b6c4964$export$
17
18
  * OF ANY KIND, either express or implied. See the License for the specific language
18
19
  * governing permissions and limitations under the License.
19
20
  */
21
+
20
22
  class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
21
23
  /**
22
24
  * Set the interaction type used by the combobox tester.
@@ -34,7 +36,7 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
34
36
  if (triggerBehavior === 'focus') await this.user.click(combobox);
35
37
  else await this.user.click(trigger);
36
38
  } else if (interactionType === 'keyboard' && this._trigger != null) {
37
- (0, $f8PS3$testinglibraryreact.act)(()=>this._trigger.focus());
39
+ (0, $72b9f4c3b7f70828$exports.act)(()=>this._trigger.focus());
38
40
  if (triggerBehavior !== 'focus') await this.user.keyboard('{ArrowDown}');
39
41
  } else if (interactionType === 'touch') {
40
42
  if (triggerBehavior === 'focus') await this.user.pointer({
@@ -46,12 +48,12 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
46
48
  keys: '[TouchA]'
47
49
  });
48
50
  }
49
- await (0, $f8PS3$testinglibraryreact.waitFor)(()=>{
51
+ await (0, $f8PS3$testinglibrarydom.waitFor)(()=>{
50
52
  if (!isDisabled && combobox.getAttribute('aria-controls') == null) throw new Error('No aria-controls found on combobox trigger element.');
51
53
  else return true;
52
54
  });
53
55
  let listBoxId = combobox.getAttribute('aria-controls');
54
- await (0, $f8PS3$testinglibraryreact.waitFor)(()=>{
56
+ await (0, $f8PS3$testinglibrarydom.waitFor)(()=>{
55
57
  if (!isDisabled && (!listBoxId || document.getElementById(listBoxId) == null)) throw new Error(`Listbox with id of ${listBoxId} not found in document.`);
56
58
  else return true;
57
59
  });
@@ -64,7 +66,7 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
64
66
  let options = this.options();
65
67
  let listbox = this.listbox;
66
68
  if (typeof optionIndexOrText === 'number') option = options[optionIndexOrText];
67
- else if (typeof optionIndexOrText === 'string' && listbox != null) option = (0, $f8PS3$testinglibraryreact.within)(listbox).getByText(optionIndexOrText).closest('[role=option]');
69
+ else if (typeof optionIndexOrText === 'string' && listbox != null) option = (0, $f8PS3$testinglibrarydom.within)(listbox).getByText(optionIndexOrText).closest('[role=option]');
68
70
  return option;
69
71
  }
70
72
  /**
@@ -89,7 +91,7 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
89
91
  target: option,
90
92
  keys: '[TouchA]'
91
93
  });
92
- if (option.getAttribute('href') == null) await (0, $f8PS3$testinglibraryreact.waitFor)(()=>{
94
+ if (option.getAttribute('href') == null) await (0, $f8PS3$testinglibrarydom.waitFor)(()=>{
93
95
  if (document.contains(listbox)) throw new Error('Expected listbox element to not be in the document after selecting an option');
94
96
  else return true;
95
97
  });
@@ -100,9 +102,9 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
100
102
  */ async close() {
101
103
  let listbox = this.listbox;
102
104
  if (listbox) {
103
- (0, $f8PS3$testinglibraryreact.act)(()=>this.combobox.focus());
105
+ (0, $72b9f4c3b7f70828$exports.act)(()=>this.combobox.focus());
104
106
  await this.user.keyboard('[Escape]');
105
- await (0, $f8PS3$testinglibraryreact.waitFor)(()=>{
107
+ await (0, $f8PS3$testinglibrarydom.waitFor)(()=>{
106
108
  if (document.contains(listbox)) throw new Error('Expected listbox element to not be in the document after selecting an option');
107
109
  else return true;
108
110
  });
@@ -128,14 +130,14 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
128
130
  * Returns the combobox's sections if present.
129
131
  */ get sections() {
130
132
  let listbox = this.listbox;
131
- return listbox ? (0, $f8PS3$testinglibraryreact.within)(listbox).queryAllByRole('group') : [];
133
+ return listbox ? (0, $f8PS3$testinglibrarydom.within)(listbox).queryAllByRole('group') : [];
132
134
  }
133
135
  /**
134
136
  * Returns the combobox's options if present. Can be filtered to a subsection of the listbox if provided via `element`.
135
137
  */ options(opts = {}) {
136
138
  let { element: element = this.listbox } = opts;
137
139
  let options = [];
138
- if (element) options = (0, $f8PS3$testinglibraryreact.within)(element).queryAllByRole('option');
140
+ if (element) options = (0, $f8PS3$testinglibrarydom.within)(element).queryAllByRole('option');
139
141
  return options;
140
142
  }
141
143
  /**
@@ -151,12 +153,12 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
151
153
  // Handle case where element provided is a wrapper around the combobox. The expectation is that the user at least uses a ref/data attribute to
152
154
  // query their combobox/combobox wrapper (in the case of RSP) which they then pass to thhis
153
155
  this._combobox = root;
154
- let combobox = (0, $f8PS3$testinglibraryreact.within)(root).queryByRole('combobox');
156
+ let combobox = (0, $f8PS3$testinglibrarydom.within)(root).queryByRole('combobox');
155
157
  if (combobox) this._combobox = combobox;
156
158
  // This is for if user need to directly set the trigger button element (aka the element provided in setElement was the combobox input or the trigger is somewhere unexpected)
157
159
  if (trigger) this._trigger = trigger;
158
160
  else {
159
- let buttons = (0, $f8PS3$testinglibraryreact.within)(root).queryAllByRole('button', {
161
+ let buttons = (0, $f8PS3$testinglibrarydom.within)(root).queryAllByRole('button', {
160
162
  hidden: true
161
163
  });
162
164
  if (buttons.length === 1) trigger = buttons[0];
@@ -169,4 +171,4 @@ class $15e4b71f2b6c4964$export$f97e14e96d71ab3b {
169
171
  }
170
172
 
171
173
 
172
- //# sourceMappingURL=combobox.main.js.map
174
+ //# sourceMappingURL=combobox.cjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAyBM,MAAM;IAqCX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,MAAM,KAAK,OAAyB,CAAC,CAAC,EAAiB;QACrD,IAAI,mBAAC,kBAAkB,2BAAU,kBAAkB,IAAI,CAAC,gBAAgB,EAAC,GAAG;QAC5E,IAAI,UAAU,IAAI,CAAC,OAAO;QAC1B,IAAI,WAAW,IAAI,CAAC,QAAQ;QAC5B,IAAI,aAAa,QAAS,YAAY,CAAC;QAEvC,IAAI,oBAAoB;YACtB,IAAI,oBAAoB,SACtB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;iBAEtB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;eAEnB,IAAI,oBAAoB,cAAc,IAAI,CAAC,QAAQ,IAAI,MAAM;YAClE,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AAY,CAAC;YAGvD,qHAAqH;YACrH,6BAA6B;YAC7B,IAAI,CAAC,QAAQ,GAAG,WAAW,IAAI,CAAC,SAAS;QAC3C;IACF;AA8LF","sources":["packages/@react-aria/test-utils/src/combobox.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act} from './act';\nimport {ComboBoxTesterOpts, UserOpts} from './types';\nimport {waitFor, within} from '@testing-library/dom';\n\ninterface ComboBoxOpenOpts {\n /**\n * Whether the combobox opens on focus or needs to be manually opened via user action.\n * @default 'manual'\n */\n triggerBehavior?: 'focus' | 'manual',\n /**\n * What interaction type to use when opening the combobox. Defaults to the interaction type set on the tester.\n */\n interactionType?: UserOpts['interactionType']\n}\n\ninterface ComboBoxSelectOpts extends ComboBoxOpenOpts {\n /**\n * The index, text, or node of the option to select. Option nodes can be sourced via `options()`.\n */\n option: number | string | HTMLElement\n}\n\nexport class ComboBoxTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _combobox: HTMLElement;\n private _trigger: HTMLElement;\n\n constructor(opts: ComboBoxTesterOpts) {\n let {root, trigger, user, interactionType} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n\n // Handle case where element provided is a wrapper around the combobox. The expectation is that the user at least uses a ref/data attribute to\n // query their combobox/combobox wrapper (in the case of RSP) which they then pass to thhis\n this._combobox = root;\n let combobox = within(root).queryByRole('combobox');\n if (combobox) {\n this._combobox = combobox;\n }\n\n // This is for if user need to directly set the trigger button element (aka the element provided in setElement was the combobox input or the trigger is somewhere unexpected)\n if (trigger) {\n this._trigger = trigger;\n } else {\n let buttons = within(root).queryAllByRole('button', {hidden: true});\n\n if (buttons.length === 1) {\n trigger = buttons[0];\n } else if (buttons.length > 1) {\n trigger = buttons.find(button => button.hasAttribute('aria-haspopup'));\n }\n\n // For cases like https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ where the combobox\n // is also the trigger button\n this._trigger = trigger || this._combobox;\n }\n }\n\n /**\n * Set the interaction type used by the combobox tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n }\n\n /**\n * Opens the combobox dropdown. Defaults to using the interaction type set on the combobox tester.\n */\n async open(opts: ComboBoxOpenOpts = {}): Promise<void> {\n let {triggerBehavior = 'manual', interactionType = this._interactionType} = opts;\n let trigger = this.trigger;\n let combobox = this.combobox;\n let isDisabled = trigger!.hasAttribute('disabled');\n\n if (interactionType === 'mouse') {\n if (triggerBehavior === 'focus') {\n await this.user.click(combobox);\n } else {\n await this.user.click(trigger);\n }\n } else if (interactionType === 'keyboard' && this._trigger != null) {\n act(() => this._trigger!.focus());\n if (triggerBehavior !== 'focus') {\n await this.user.keyboard('{ArrowDown}');\n }\n } else if (interactionType === 'touch') {\n if (triggerBehavior === 'focus') {\n await this.user.pointer({target: combobox, keys: '[TouchA]'});\n } else {\n await this.user.pointer({target: trigger, keys: '[TouchA]'});\n }\n }\n\n await waitFor(() => {\n if (!isDisabled && combobox.getAttribute('aria-controls') == null) {\n throw new Error('No aria-controls found on combobox trigger element.');\n } else {\n return true;\n }\n });\n let listBoxId = combobox.getAttribute('aria-controls');\n await waitFor(() => {\n if (!isDisabled && (!listBoxId || document.getElementById(listBoxId) == null)) {\n throw new Error(`Listbox with id of ${listBoxId} not found in document.`);\n } else {\n return true;\n }\n });\n }\n\n /**\n * Returns an option matching the specified index or text content.\n */\n findOption(opts: {optionIndexOrText: number | string}): HTMLElement {\n let {\n optionIndexOrText\n } = opts;\n\n let option;\n let options = this.options();\n let listbox = this.listbox;\n\n if (typeof optionIndexOrText === 'number') {\n option = options[optionIndexOrText];\n } else if (typeof optionIndexOrText === 'string' && listbox != null) {\n option = (within(listbox!).getByText(optionIndexOrText).closest('[role=option]'))! as HTMLElement;\n }\n\n return option;\n }\n\n /**\n * Selects the desired combobox option. Defaults to using the interaction type set on the combobox tester. If necessary, will open the combobox dropdown beforehand.\n * The desired option can be targeted via the option's node, the option's text, or the option's index.\n */\n async selectOption(opts: ComboBoxSelectOpts): Promise<void> {\n let {option, triggerBehavior, interactionType = this._interactionType} = opts;\n if (!this.combobox.getAttribute('aria-controls')) {\n await this.open({triggerBehavior});\n }\n\n let listbox = this.listbox;\n if (!listbox) {\n throw new Error('Combobox\\'s listbox not found.');\n }\n\n if (listbox) {\n if (typeof option === 'string' || typeof option === 'number') {\n option = this.findOption({optionIndexOrText: option});\n }\n\n if (!option) {\n throw new Error('Target option not found in the listbox.');\n }\n\n // TODO: keyboard method of selecting the the option is a bit tricky unless I simply simulate the user pressing the down arrow\n // the required amount of times to reach the option. For now just click the option even in keyboard mode\n if (interactionType === 'mouse' || interactionType === 'keyboard') {\n await this.user.click(option);\n } else {\n await this.user.pointer({target: option, keys: '[TouchA]'});\n }\n\n if (option.getAttribute('href') == null) {\n await waitFor(() => {\n if (document.contains(listbox)) {\n throw new Error('Expected listbox element to not be in the document after selecting an option');\n } else {\n return true;\n }\n });\n }\n } else {\n throw new Error(\"Attempted to select a option in the combobox, but the listbox wasn't found.\");\n }\n }\n\n /**\n * Closes the combobox dropdown.\n */\n async close(): Promise<void> {\n let listbox = this.listbox;\n if (listbox) {\n act(() => this.combobox.focus());\n await this.user.keyboard('[Escape]');\n\n await waitFor(() => {\n if (document.contains(listbox)) {\n throw new Error('Expected listbox element to not be in the document after selecting an option');\n } else {\n return true;\n }\n });\n }\n }\n\n /**\n * Returns the combobox.\n */\n get combobox(): HTMLElement {\n return this._combobox;\n }\n\n /**\n * Returns the combobox trigger button.\n */\n get trigger(): HTMLElement {\n return this._trigger;\n }\n\n /**\n * Returns the combobox's listbox if present.\n */\n get listbox(): HTMLElement | null {\n let listBoxId = this.combobox.getAttribute('aria-controls');\n return listBoxId ? document.getElementById(listBoxId) || null : null;\n }\n\n /**\n * Returns the combobox's sections if present.\n */\n get sections(): HTMLElement[] {\n let listbox = this.listbox;\n return listbox ? within(listbox).queryAllByRole('group') : [];\n }\n\n /**\n * Returns the combobox's options if present. Can be filtered to a subsection of the listbox if provided via `element`.\n */\n options(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.listbox} = opts;\n let options = [];\n if (element) {\n options = within(element).queryAllByRole('option');\n }\n\n return options;\n }\n\n /**\n * Returns the currently focused option in the combobox's dropdown if any.\n */\n get focusedOption(): HTMLElement | null {\n let focusedOptionId = this.combobox.getAttribute('aria-activedescendant');\n return focusedOptionId ? document.getElementById(focusedOptionId) : null;\n }\n}\n"],"names":[],"version":3,"file":"combobox.cjs.map"}
@@ -1,4 +1,5 @@
1
- import {act as $1n52X$act, waitFor as $1n52X$waitFor, within as $1n52X$within} from "@testing-library/react";
1
+ import {act as $f420be24bb4eafeb$export$3ba232387fd5d6dd} from "./act.js";
2
+ import {waitFor as $1n52X$waitFor, within as $1n52X$within} from "@testing-library/dom";
2
3
 
3
4
  /*
4
5
  * Copyright 2024 Adobe. All rights reserved.
@@ -11,6 +12,7 @@ import {act as $1n52X$act, waitFor as $1n52X$waitFor, within as $1n52X$within} f
11
12
  * OF ANY KIND, either express or implied. See the License for the specific language
12
13
  * governing permissions and limitations under the License.
13
14
  */
15
+
14
16
  class $dab75f394483aa9c$export$f97e14e96d71ab3b {
15
17
  /**
16
18
  * Set the interaction type used by the combobox tester.
@@ -28,7 +30,7 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
28
30
  if (triggerBehavior === 'focus') await this.user.click(combobox);
29
31
  else await this.user.click(trigger);
30
32
  } else if (interactionType === 'keyboard' && this._trigger != null) {
31
- (0, $1n52X$act)(()=>this._trigger.focus());
33
+ (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>this._trigger.focus());
32
34
  if (triggerBehavior !== 'focus') await this.user.keyboard('{ArrowDown}');
33
35
  } else if (interactionType === 'touch') {
34
36
  if (triggerBehavior === 'focus') await this.user.pointer({
@@ -94,7 +96,7 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
94
96
  */ async close() {
95
97
  let listbox = this.listbox;
96
98
  if (listbox) {
97
- (0, $1n52X$act)(()=>this.combobox.focus());
99
+ (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>this.combobox.focus());
98
100
  await this.user.keyboard('[Escape]');
99
101
  await (0, $1n52X$waitFor)(()=>{
100
102
  if (document.contains(listbox)) throw new Error('Expected listbox element to not be in the document after selecting an option');
@@ -164,4 +166,4 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
164
166
 
165
167
 
166
168
  export {$dab75f394483aa9c$export$f97e14e96d71ab3b as ComboBoxTester};
167
- //# sourceMappingURL=combobox.module.js.map
169
+ //# sourceMappingURL=combobox.mjs.map
@@ -1,4 +1,5 @@
1
- import {act as $1n52X$act, waitFor as $1n52X$waitFor, within as $1n52X$within} from "@testing-library/react";
1
+ import {act as $f420be24bb4eafeb$export$3ba232387fd5d6dd} from "./act.mjs";
2
+ import {waitFor as $1n52X$waitFor, within as $1n52X$within} from "@testing-library/dom";
2
3
 
3
4
  /*
4
5
  * Copyright 2024 Adobe. All rights reserved.
@@ -11,6 +12,7 @@ import {act as $1n52X$act, waitFor as $1n52X$waitFor, within as $1n52X$within} f
11
12
  * OF ANY KIND, either express or implied. See the License for the specific language
12
13
  * governing permissions and limitations under the License.
13
14
  */
15
+
14
16
  class $dab75f394483aa9c$export$f97e14e96d71ab3b {
15
17
  /**
16
18
  * Set the interaction type used by the combobox tester.
@@ -28,7 +30,7 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
28
30
  if (triggerBehavior === 'focus') await this.user.click(combobox);
29
31
  else await this.user.click(trigger);
30
32
  } else if (interactionType === 'keyboard' && this._trigger != null) {
31
- (0, $1n52X$act)(()=>this._trigger.focus());
33
+ (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>this._trigger.focus());
32
34
  if (triggerBehavior !== 'focus') await this.user.keyboard('{ArrowDown}');
33
35
  } else if (interactionType === 'touch') {
34
36
  if (triggerBehavior === 'focus') await this.user.pointer({
@@ -94,7 +96,7 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
94
96
  */ async close() {
95
97
  let listbox = this.listbox;
96
98
  if (listbox) {
97
- (0, $1n52X$act)(()=>this.combobox.focus());
99
+ (0, $f420be24bb4eafeb$export$3ba232387fd5d6dd)(()=>this.combobox.focus());
98
100
  await this.user.keyboard('[Escape]');
99
101
  await (0, $1n52X$waitFor)(()=>{
100
102
  if (document.contains(listbox)) throw new Error('Expected listbox element to not be in the document after selecting an option');
@@ -164,4 +166,4 @@ class $dab75f394483aa9c$export$f97e14e96d71ab3b {
164
166
 
165
167
 
166
168
  export {$dab75f394483aa9c$export$f97e14e96d71ab3b as ComboBoxTester};
167
- //# sourceMappingURL=combobox.module.js.map
169
+ //# sourceMappingURL=combobox.mjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAyBM,MAAM;IAqCX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,MAAM,KAAK,OAAyB,CAAC,CAAC,EAAiB;QACrD,IAAI,mBAAC,kBAAkB,2BAAU,kBAAkB,IAAI,CAAC,gBAAgB,EAAC,GAAG;QAC5E,IAAI,UAAU,IAAI,CAAC,OAAO;QAC1B,IAAI,WAAW,IAAI,CAAC,QAAQ;QAC5B,IAAI,aAAa,QAAS,YAAY,CAAC;QAEvC,IAAI,oBAAoB;YACtB,IAAI,oBAAoB,SACtB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;iBAEtB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;e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,GAC1B,UAAU,QAAQ,IAAI,CAAC,CAAA,SAAU,OAAO,YAAY,CAAC;YAGvD,qHAAqH;YACrH,6BAA6B;YAC7B,IAAI,CAAC,QAAQ,GAAG,WAAW,IAAI,CAAC,SAAS;QAC3C;IACF;AA8LF","sources":["packages/@react-aria/test-utils/src/combobox.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act} from './act';\nimport {ComboBoxTesterOpts, UserOpts} from './types';\nimport {waitFor, within} from '@testing-library/dom';\n\ninterface ComboBoxOpenOpts {\n /**\n * Whether the combobox opens on focus or needs to be manually opened via user action.\n * @default 'manual'\n */\n triggerBehavior?: 'focus' | 'manual',\n /**\n * What interaction type to use when opening the combobox. Defaults to the interaction type set on the tester.\n */\n interactionType?: UserOpts['interactionType']\n}\n\ninterface ComboBoxSelectOpts extends ComboBoxOpenOpts {\n /**\n * The index, text, or node of the option to select. Option nodes can be sourced via `options()`.\n */\n option: number | string | HTMLElement\n}\n\nexport class ComboBoxTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _combobox: HTMLElement;\n private _trigger: HTMLElement;\n\n constructor(opts: ComboBoxTesterOpts) {\n let {root, trigger, user, interactionType} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n\n // Handle case where element provided is a wrapper around the combobox. The expectation is that the user at least uses a ref/data attribute to\n // query their combobox/combobox wrapper (in the case of RSP) which they then pass to thhis\n this._combobox = root;\n let combobox = within(root).queryByRole('combobox');\n if (combobox) {\n this._combobox = combobox;\n }\n\n // This is for if user need to directly set the trigger button element (aka the element provided in setElement was the combobox input or the trigger is somewhere unexpected)\n if (trigger) {\n this._trigger = trigger;\n } else {\n let buttons = within(root).queryAllByRole('button', {hidden: true});\n\n if (buttons.length === 1) {\n trigger = buttons[0];\n } else if (buttons.length > 1) {\n trigger = buttons.find(button => button.hasAttribute('aria-haspopup'));\n }\n\n // For cases like https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ where the combobox\n // is also the trigger button\n this._trigger = trigger || this._combobox;\n }\n }\n\n /**\n * Set the interaction type used by the combobox tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n }\n\n /**\n * Opens the combobox dropdown. Defaults to using the interaction type set on the combobox tester.\n */\n async open(opts: ComboBoxOpenOpts = {}): Promise<void> {\n let {triggerBehavior = 'manual', interactionType = this._interactionType} = opts;\n let trigger = this.trigger;\n let combobox = this.combobox;\n let isDisabled = trigger!.hasAttribute('disabled');\n\n if (interactionType === 'mouse') {\n if (triggerBehavior === 'focus') {\n await this.user.click(combobox);\n } else {\n await this.user.click(trigger);\n }\n } else if (interactionType === 'keyboard' && this._trigger != null) {\n act(() => this._trigger!.focus());\n if (triggerBehavior !== 'focus') {\n await this.user.keyboard('{ArrowDown}');\n }\n } else if (interactionType === 'touch') {\n if (triggerBehavior === 'focus') {\n await this.user.pointer({target: combobox, keys: '[TouchA]'});\n } else {\n await this.user.pointer({target: trigger, keys: '[TouchA]'});\n }\n }\n\n await waitFor(() => {\n if (!isDisabled && combobox.getAttribute('aria-controls') == null) {\n throw new Error('No aria-controls found on combobox trigger element.');\n } else {\n return true;\n }\n });\n let listBoxId = combobox.getAttribute('aria-controls');\n await waitFor(() => {\n if (!isDisabled && (!listBoxId || document.getElementById(listBoxId) == null)) {\n throw new Error(`Listbox with id of ${listBoxId} not found in document.`);\n } else {\n return true;\n }\n });\n }\n\n /**\n * Returns an option matching the specified index or text content.\n */\n findOption(opts: {optionIndexOrText: number | string}): HTMLElement {\n let {\n optionIndexOrText\n } = opts;\n\n let option;\n let options = this.options();\n let listbox = this.listbox;\n\n if (typeof optionIndexOrText === 'number') {\n option = options[optionIndexOrText];\n } else if (typeof optionIndexOrText === 'string' && listbox != null) {\n option = (within(listbox!).getByText(optionIndexOrText).closest('[role=option]'))! as HTMLElement;\n }\n\n return option;\n }\n\n /**\n * Selects the desired combobox option. Defaults to using the interaction type set on the combobox tester. If necessary, will open the combobox dropdown beforehand.\n * The desired option can be targeted via the option's node, the option's text, or the option's index.\n */\n async selectOption(opts: ComboBoxSelectOpts): Promise<void> {\n let {option, triggerBehavior, interactionType = this._interactionType} = opts;\n if (!this.combobox.getAttribute('aria-controls')) {\n await this.open({triggerBehavior});\n }\n\n let listbox = this.listbox;\n if (!listbox) {\n throw new Error('Combobox\\'s listbox not found.');\n }\n\n if (listbox) {\n if (typeof option === 'string' || typeof option === 'number') {\n option = this.findOption({optionIndexOrText: option});\n }\n\n if (!option) {\n throw new Error('Target option not found in the listbox.');\n }\n\n // TODO: keyboard method of selecting the the option is a bit tricky unless I simply simulate the user pressing the down arrow\n // the required amount of times to reach the option. For now just click the option even in keyboard mode\n if (interactionType === 'mouse' || interactionType === 'keyboard') {\n await this.user.click(option);\n } else {\n await this.user.pointer({target: option, keys: '[TouchA]'});\n }\n\n if (option.getAttribute('href') == null) {\n await waitFor(() => {\n if (document.contains(listbox)) {\n throw new Error('Expected listbox element to not be in the document after selecting an option');\n } else {\n return true;\n }\n });\n }\n } else {\n throw new Error(\"Attempted to select a option in the combobox, but the listbox wasn't found.\");\n }\n }\n\n /**\n * Closes the combobox dropdown.\n */\n async close(): Promise<void> {\n let listbox = this.listbox;\n if (listbox) {\n act(() => this.combobox.focus());\n await this.user.keyboard('[Escape]');\n\n await waitFor(() => {\n if (document.contains(listbox)) {\n throw new Error('Expected listbox element to not be in the document after selecting an option');\n } else {\n return true;\n }\n });\n }\n }\n\n /**\n * Returns the combobox.\n */\n get combobox(): HTMLElement {\n return this._combobox;\n }\n\n /**\n * Returns the combobox trigger button.\n */\n get trigger(): HTMLElement {\n return this._trigger;\n }\n\n /**\n * Returns the combobox's listbox if present.\n */\n get listbox(): HTMLElement | null {\n let listBoxId = this.combobox.getAttribute('aria-controls');\n return listBoxId ? document.getElementById(listBoxId) || null : null;\n }\n\n /**\n * Returns the combobox's sections if present.\n */\n get sections(): HTMLElement[] {\n let listbox = this.listbox;\n return listbox ? within(listbox).queryAllByRole('group') : [];\n }\n\n /**\n * Returns the combobox's options if present. Can be filtered to a subsection of the listbox if provided via `element`.\n */\n options(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.listbox} = opts;\n let options = [];\n if (element) {\n options = within(element).queryAllByRole('option');\n }\n\n return options;\n }\n\n /**\n * Returns the currently focused option in the combobox's dropdown if any.\n */\n get focusedOption(): HTMLElement | null {\n let focusedOptionId = this.combobox.getAttribute('aria-activedescendant');\n return focusedOptionId ? document.getElementById(focusedOptionId) : null;\n }\n}\n"],"names":[],"version":3,"file":"combobox.mjs.map"}
@@ -1,4 +1,5 @@
1
- var $7D3o2$testinglibraryreact = require("@testing-library/react");
1
+ var $72b9f4c3b7f70828$exports = require("./act.cjs");
2
+ var $7D3o2$testinglibrarydom = require("@testing-library/dom");
2
3
 
3
4
 
4
5
  function $parcel$export(e, n, v, s) {
@@ -17,6 +18,7 @@ $parcel$export(module.exports, "DialogTester", () => $fe51f406377a5335$export$e7
17
18
  * OF ANY KIND, either express or implied. See the License for the specific language
18
19
  * governing permissions and limitations under the License.
19
20
  */
21
+
20
22
  class $fe51f406377a5335$export$e79328f5295cc2a1 {
21
23
  /**
22
24
  * Set the interaction type used by the dialog tester.
@@ -35,16 +37,16 @@ class $fe51f406377a5335$export$e79328f5295cc2a1 {
35
37
  keys: '[TouchA]'
36
38
  });
37
39
  else if (interactionType === 'keyboard') {
38
- (0, $7D3o2$testinglibraryreact.act)(()=>trigger.focus());
40
+ (0, $72b9f4c3b7f70828$exports.act)(()=>trigger.focus());
39
41
  await this.user.keyboard('[Enter]');
40
42
  }
41
43
  if (this._overlayType === 'popover') {
42
- await (0, $7D3o2$testinglibraryreact.waitFor)(()=>{
44
+ await (0, $7D3o2$testinglibrarydom.waitFor)(()=>{
43
45
  if (trigger.getAttribute('aria-controls') == null) throw new Error('No aria-controls found on dialog trigger element.');
44
46
  else return true;
45
47
  });
46
48
  let dialogId = trigger.getAttribute('aria-controls');
47
- await (0, $7D3o2$testinglibraryreact.waitFor)(()=>{
49
+ await (0, $7D3o2$testinglibrarydom.waitFor)(()=>{
48
50
  if (!dialogId || document.getElementById(dialogId) == null) throw new Error(`Dialog with id of ${dialogId} not found in document.`);
49
51
  else {
50
52
  this._dialog = document.getElementById(dialogId);
@@ -53,7 +55,7 @@ class $fe51f406377a5335$export$e79328f5295cc2a1 {
53
55
  });
54
56
  } else {
55
57
  let dialog;
56
- await (0, $7D3o2$testinglibraryreact.waitFor)(()=>{
58
+ await (0, $7D3o2$testinglibrarydom.waitFor)(()=>{
57
59
  dialog = document.querySelector('[role=dialog], [role=alertdialog]');
58
60
  if (dialog == null) throw new Error('No dialog of type role="dialog" or role="alertdialog" found after pressing the trigger.');
59
61
  else return true;
@@ -69,7 +71,7 @@ class $fe51f406377a5335$export$e79328f5295cc2a1 {
69
71
  let dialog = this._dialog;
70
72
  if (dialog) {
71
73
  await this.user.keyboard('[Escape]');
72
- await (0, $7D3o2$testinglibraryreact.waitFor)(()=>{
74
+ await (0, $7D3o2$testinglibrarydom.waitFor)(()=>{
73
75
  if (document.contains(dialog)) throw new Error('Expected the dialog to not be in the document after closing it.');
74
76
  else {
75
77
  this._dialog = undefined;
@@ -95,11 +97,11 @@ class $fe51f406377a5335$export$e79328f5295cc2a1 {
95
97
  this._interactionType = interactionType || 'mouse';
96
98
  this._overlayType = overlayType || 'modal';
97
99
  // Handle case where element provided is a wrapper of the trigger button
98
- let trigger = (0, $7D3o2$testinglibraryreact.within)(root).queryByRole('button');
100
+ let trigger = (0, $7D3o2$testinglibrarydom.within)(root).queryByRole('button');
99
101
  if (trigger) this._trigger = trigger;
100
102
  else this._trigger = root;
101
103
  }
102
104
  }
103
105
 
104
106
 
105
- //# sourceMappingURL=dialog.main.js.map
107
+ //# sourceMappingURL=dialog.cjs.map