@react-aria/test-utils 1.0.0-beta.1 → 1.0.0-beta.3

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 (133) hide show
  1. package/dist/import.mjs +5 -5
  2. package/dist/main.js +9 -9
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +5 -5
  5. package/dist/module.js.map +1 -1
  6. package/dist/private/checkboxgroup.cjs +104 -0
  7. package/dist/private/checkboxgroup.cjs.map +1 -0
  8. package/dist/private/checkboxgroup.js +99 -0
  9. package/dist/private/checkboxgroup.js.map +1 -0
  10. package/dist/{combobox.main.js → private/combobox.cjs} +35 -35
  11. package/dist/private/combobox.cjs.map +1 -0
  12. package/dist/{combobox.mjs → private/combobox.js} +35 -35
  13. package/dist/private/combobox.js.map +1 -0
  14. package/dist/private/dialog.cjs +105 -0
  15. package/dist/private/dialog.cjs.map +1 -0
  16. package/dist/private/dialog.js +100 -0
  17. package/dist/private/dialog.js.map +1 -0
  18. package/dist/{events.main.js → private/events.cjs} +32 -34
  19. package/dist/private/events.cjs.map +1 -0
  20. package/dist/{events.mjs → private/events.js} +29 -31
  21. package/dist/private/events.js.map +1 -0
  22. package/dist/{gridlist.main.js → private/gridlist.cjs} +27 -28
  23. package/dist/private/gridlist.cjs.map +1 -0
  24. package/dist/{gridlist.mjs → private/gridlist.js} +27 -28
  25. package/dist/private/gridlist.js.map +1 -0
  26. package/dist/{listbox.main.js → private/listbox.cjs} +24 -24
  27. package/dist/private/listbox.cjs.map +1 -0
  28. package/dist/{listbox.mjs → private/listbox.js} +24 -24
  29. package/dist/private/listbox.js.map +1 -0
  30. package/dist/{menu.main.js → private/menu.cjs} +46 -48
  31. package/dist/private/menu.cjs.map +1 -0
  32. package/dist/{menu.mjs → private/menu.js} +46 -48
  33. package/dist/private/menu.js.map +1 -0
  34. package/dist/private/radiogroup.cjs +120 -0
  35. package/dist/private/radiogroup.cjs.map +1 -0
  36. package/dist/private/radiogroup.js +115 -0
  37. package/dist/private/radiogroup.js.map +1 -0
  38. package/dist/{select.main.js → private/select.cjs} +31 -29
  39. package/dist/private/select.cjs.map +1 -0
  40. package/dist/{select.mjs → private/select.js} +31 -29
  41. package/dist/private/select.js.map +1 -0
  42. package/dist/{table.main.js → private/table.cjs} +82 -57
  43. package/dist/private/table.cjs.map +1 -0
  44. package/dist/{table.module.js → private/table.js} +82 -57
  45. package/dist/private/table.js.map +1 -0
  46. package/dist/{tabs.main.js → private/tabs.cjs} +24 -26
  47. package/dist/private/tabs.cjs.map +1 -0
  48. package/dist/{tabs.mjs → private/tabs.js} +24 -26
  49. package/dist/private/tabs.js.map +1 -0
  50. package/dist/private/testSetup.cjs +87 -0
  51. package/dist/private/testSetup.cjs.map +1 -0
  52. package/dist/private/testSetup.js +81 -0
  53. package/dist/private/testSetup.js.map +1 -0
  54. package/dist/{tree.main.js → private/tree.cjs} +34 -35
  55. package/dist/private/tree.cjs.map +1 -0
  56. package/dist/{tree.mjs → private/tree.js} +34 -35
  57. package/dist/private/tree.js.map +1 -0
  58. package/dist/private/user.cjs +85 -0
  59. package/dist/private/user.cjs.map +1 -0
  60. package/dist/private/user.js +76 -0
  61. package/dist/private/user.js.map +1 -0
  62. package/dist/{userEventMaps.main.js → private/userEventMaps.cjs} +3 -3
  63. package/dist/{userEventMaps.main.js.map → private/userEventMaps.cjs.map} +1 -1
  64. package/dist/{userEventMaps.mjs → private/userEventMaps.js} +3 -3
  65. package/dist/{userEventMaps.module.js.map → private/userEventMaps.js.map} +1 -1
  66. package/dist/types/src/checkboxgroup.d.ts +45 -0
  67. package/dist/types/src/combobox.d.ts +75 -0
  68. package/dist/types/src/dialog.d.ts +36 -0
  69. package/dist/types/src/events.d.ts +25 -0
  70. package/dist/types/src/gridlist.d.ts +51 -0
  71. package/dist/types/src/index.d.ts +16 -0
  72. package/dist/types/src/listbox.d.ts +80 -0
  73. package/dist/types/src/menu.d.ts +102 -0
  74. package/dist/types/src/radiogroup.d.ts +46 -0
  75. package/dist/types/src/select.d.ts +67 -0
  76. package/dist/types/src/table.d.ts +104 -0
  77. package/dist/types/src/tabs.d.ts +58 -0
  78. package/dist/types/src/testSetup.d.ts +6 -0
  79. package/dist/types/src/tree.d.ts +57 -0
  80. package/dist/types/src/types.d.ts +136 -0
  81. package/dist/types/src/user.d.ts +47 -0
  82. package/dist/types/src/userEventMaps.d.ts +2 -0
  83. package/package.json +7 -7
  84. package/src/checkboxgroup.ts +158 -0
  85. package/src/dialog.ts +143 -0
  86. package/src/index.ts +11 -0
  87. package/src/radiogroup.ts +176 -0
  88. package/src/select.ts +10 -2
  89. package/src/table.ts +46 -1
  90. package/src/tabs.ts +7 -2
  91. package/src/testSetup.ts +30 -28
  92. package/src/types.ts +21 -0
  93. package/src/user.ts +25 -7
  94. package/dist/combobox.main.js.map +0 -1
  95. package/dist/combobox.module.js +0 -167
  96. package/dist/combobox.module.js.map +0 -1
  97. package/dist/events.main.js.map +0 -1
  98. package/dist/events.module.js +0 -112
  99. package/dist/events.module.js.map +0 -1
  100. package/dist/gridlist.main.js.map +0 -1
  101. package/dist/gridlist.module.js +0 -149
  102. package/dist/gridlist.module.js.map +0 -1
  103. package/dist/listbox.main.js.map +0 -1
  104. package/dist/listbox.module.js +0 -138
  105. package/dist/listbox.module.js.map +0 -1
  106. package/dist/menu.main.js.map +0 -1
  107. package/dist/menu.module.js +0 -269
  108. package/dist/menu.module.js.map +0 -1
  109. package/dist/select.main.js.map +0 -1
  110. package/dist/select.module.js +0 -158
  111. package/dist/select.module.js.map +0 -1
  112. package/dist/table.main.js.map +0 -1
  113. package/dist/table.mjs +0 -290
  114. package/dist/table.module.js.map +0 -1
  115. package/dist/tabs.main.js.map +0 -1
  116. package/dist/tabs.module.js +0 -128
  117. package/dist/tabs.module.js.map +0 -1
  118. package/dist/testSetup.main.js +0 -78
  119. package/dist/testSetup.main.js.map +0 -1
  120. package/dist/testSetup.mjs +0 -72
  121. package/dist/testSetup.module.js +0 -72
  122. package/dist/testSetup.module.js.map +0 -1
  123. package/dist/tree.main.js.map +0 -1
  124. package/dist/tree.module.js +0 -179
  125. package/dist/tree.module.js.map +0 -1
  126. package/dist/types.d.ts +0 -694
  127. package/dist/types.d.ts.map +0 -1
  128. package/dist/user.main.js +0 -76
  129. package/dist/user.main.js.map +0 -1
  130. package/dist/user.mjs +0 -67
  131. package/dist/user.module.js +0 -67
  132. package/dist/user.module.js.map +0 -1
  133. package/dist/userEventMaps.module.js +0 -38
@@ -1,5 +1,5 @@
1
- import {getAltKey as $5d1eca18f92ad0e6$export$6fc0ccaebd758b9d, getMetaKey as $5d1eca18f92ad0e6$export$7943c508934e27ce, pressElement as $5d1eca18f92ad0e6$export$6ffa3eb717517feb, triggerLongPress as $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b} from "./events.mjs";
2
- import {within as $3mnbZ$within, act as $3mnbZ$act} from "@testing-library/react";
1
+ import {getAltKey as $22d7d9b763402afa$export$6fc0ccaebd758b9d, getMetaKey as $22d7d9b763402afa$export$7943c508934e27ce, pressElement as $22d7d9b763402afa$export$6ffa3eb717517feb, triggerLongPress as $22d7d9b763402afa$export$3a22a5a9bc0fd3b} from "./events.js";
2
+ import {within as $5Fhol$within, act as $5Fhol$act} from "@testing-library/react";
3
3
 
4
4
  /*
5
5
  * Copyright 2024 Adobe. All rights reserved.
@@ -13,7 +13,17 @@ import {within as $3mnbZ$within, act as $3mnbZ$act} from "@testing-library/react
13
13
  * governing permissions and limitations under the License.
14
14
  */
15
15
 
16
- class $962758aa2f16f1a4$export$4445864b14128396 {
16
+ class $d721d67b8ba87a3b$export$4445864b14128396 {
17
+ constructor(opts){
18
+ let { root: root, user: user, interactionType: interactionType, advanceTimer: advanceTimer } = opts;
19
+ this.user = user;
20
+ this._interactionType = interactionType || 'mouse';
21
+ this._advanceTimer = advanceTimer;
22
+ this._tree = root;
23
+ // TODO: should all helpers do this?
24
+ let tree = (0, $5Fhol$within)(root).queryByRole('treegrid');
25
+ if (root.getAttribute('role') !== 'treegrid' && tree) this._tree = tree;
26
+ }
17
27
  /**
18
28
  * Set the interaction type used by the tree tester.
19
29
  */ setInteractionType(type) {
@@ -25,17 +35,17 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
25
35
  let { rowIndexOrText: rowIndexOrText } = opts;
26
36
  let row;
27
37
  if (typeof rowIndexOrText === 'number') row = this.rows[rowIndexOrText];
28
- else if (typeof rowIndexOrText === 'string') row = (0, $3mnbZ$within)(this.tree).getByText(rowIndexOrText).closest('[role=row]');
38
+ else if (typeof rowIndexOrText === 'string') row = (0, $5Fhol$within)(this.tree).getByText(rowIndexOrText).closest('[role=row]');
29
39
  return row;
30
40
  }
31
41
  // TODO: RTL
32
42
  async keyboardNavigateToRow(opts) {
33
43
  let { row: row, selectionOnNav: selectionOnNav = 'default' } = opts;
34
- let altKey = (0, $5d1eca18f92ad0e6$export$6fc0ccaebd758b9d)();
44
+ let altKey = (0, $22d7d9b763402afa$export$6fc0ccaebd758b9d)();
35
45
  let rows = this.rows;
36
46
  let targetIndex = rows.indexOf(row);
37
47
  if (targetIndex === -1) throw new Error('Option provided is not in the tree');
38
- if (document.activeElement !== this._tree && !this._tree.contains(document.activeElement)) (0, $3mnbZ$act)(()=>this._tree.focus());
48
+ if (document.activeElement !== this._tree && !this._tree.contains(document.activeElement)) (0, $5Fhol$act)(()=>this._tree.focus());
39
49
  if (document.activeElement === this.tree) await this.user.keyboard(`${selectionOnNav === 'none' ? `[${altKey}>]` : ''}[ArrowDown]${selectionOnNav === 'none' ? `[/${altKey}]` : ''}`);
40
50
  else if (this._tree.contains(document.activeElement) && document.activeElement.getAttribute('role') !== 'row') do await this.user.keyboard('[ArrowLeft]');
41
51
  while (document.activeElement.getAttribute('role') !== 'row');
@@ -51,16 +61,16 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
51
61
  * Note that this will endevor to always add/remove JUST the provided row to the set of selected rows.
52
62
  */ async toggleRowSelection(opts) {
53
63
  let { row: row, needsLongPress: needsLongPress, checkboxSelection: checkboxSelection = true, interactionType: interactionType = this._interactionType, selectionBehavior: selectionBehavior = 'toggle' } = opts;
54
- let altKey = (0, $5d1eca18f92ad0e6$export$6fc0ccaebd758b9d)();
55
- let metaKey = (0, $5d1eca18f92ad0e6$export$7943c508934e27ce)();
64
+ let altKey = (0, $22d7d9b763402afa$export$6fc0ccaebd758b9d)();
65
+ let metaKey = (0, $22d7d9b763402afa$export$7943c508934e27ce)();
56
66
  if (typeof row === 'string' || typeof row === 'number') row = this.findRow({
57
67
  rowIndexOrText: row
58
68
  });
59
69
  if (!row) throw new Error('Target row not found in the tree.');
60
- let rowCheckbox = (0, $3mnbZ$within)(row).queryByRole('checkbox');
70
+ let rowCheckbox = (0, $5Fhol$within)(row).queryByRole('checkbox');
61
71
  // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually
62
72
  // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)
63
- if (interactionType === 'keyboard' && ((rowCheckbox === null || rowCheckbox === void 0 ? void 0 : rowCheckbox.getAttribute('disabled')) === '' || (row === null || row === void 0 ? void 0 : row.getAttribute('aria-disabled')) === 'true')) return;
73
+ if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) return;
64
74
  // this would be better than the check to do nothing in events.ts
65
75
  // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly
66
76
  if (interactionType === 'keyboard' && (!checkboxSelection || !rowCheckbox)) {
@@ -73,13 +83,13 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
73
83
  if (selectionBehavior === 'replace') await this.user.keyboard(`[/${altKey}]`);
74
84
  return;
75
85
  }
76
- if (rowCheckbox && checkboxSelection) await (0, $5d1eca18f92ad0e6$export$6ffa3eb717517feb)(this.user, rowCheckbox, interactionType);
86
+ if (rowCheckbox && checkboxSelection) await (0, $22d7d9b763402afa$export$6ffa3eb717517feb)(this.user, rowCheckbox, interactionType);
77
87
  else {
78
- let cell = (0, $3mnbZ$within)(row).getAllByRole('gridcell')[0];
88
+ let cell = (0, $5Fhol$within)(row).getAllByRole('gridcell')[0];
79
89
  if (needsLongPress && interactionType === 'touch') {
80
90
  if (this._advanceTimer == null) throw new Error('No advanceTimers provided for long press.');
81
91
  // Note that long press interactions with rows is strictly touch only for grid rows
82
- await (0, $5d1eca18f92ad0e6$export$3a22a5a9bc0fd3b)({
92
+ await (0, $22d7d9b763402afa$export$3a22a5a9bc0fd3b)({
83
93
  element: cell,
84
94
  advanceTimer: this._advanceTimer,
85
95
  pointerOpts: {
@@ -89,7 +99,7 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
89
99
  } else {
90
100
  // TODO add modifiers here? Maybe move into pressElement if we get more cases for different types of modifier keys
91
101
  if (selectionBehavior === 'replace' && interactionType !== 'touch') await this.user.keyboard(`[${metaKey}>]`);
92
- await (0, $5d1eca18f92ad0e6$export$6ffa3eb717517feb)(this.user, row, interactionType);
102
+ await (0, $22d7d9b763402afa$export$6ffa3eb717517feb)(this.user, row, interactionType);
93
103
  if (selectionBehavior === 'replace' && interactionType !== 'touch') await this.user.keyboard(`[/${metaKey}]`);
94
104
  }
95
105
  }
@@ -98,7 +108,7 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
98
108
  * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.
99
109
  */ async toggleRowExpansion(opts) {
100
110
  let { row: row, interactionType: interactionType = this._interactionType } = opts;
101
- if (!this.tree.contains(document.activeElement)) await (0, $3mnbZ$act)(async ()=>{
111
+ if (!this.tree.contains(document.activeElement)) await (0, $5Fhol$act)(async ()=>{
102
112
  this.tree.focus();
103
113
  });
104
114
  if (typeof row === 'string' || typeof row === 'number') row = this.findRow({
@@ -107,10 +117,10 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
107
117
  if (!row) throw new Error('Target row not found in the tree.');
108
118
  else if (row.getAttribute('aria-expanded') == null) throw new Error('Target row is not expandable.');
109
119
  if (interactionType === 'mouse' || interactionType === 'touch') {
110
- let rowExpander = (0, $3mnbZ$within)(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?
111
- await (0, $5d1eca18f92ad0e6$export$6ffa3eb717517feb)(this.user, rowExpander, interactionType);
120
+ let rowExpander = (0, $5Fhol$within)(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?
121
+ await (0, $22d7d9b763402afa$export$6ffa3eb717517feb)(this.user, rowExpander, interactionType);
112
122
  } else if (interactionType === 'keyboard') {
113
- if ((row === null || row === void 0 ? void 0 : row.getAttribute('aria-disabled')) === 'true') return;
123
+ if (row?.getAttribute('aria-disabled') === 'true') return;
114
124
  // TODO: We always Use Option/Ctrl when keyboard navigating so selection isn't changed
115
125
  // in selectionmode="replace"/highlight selection when navigating to the row that the user wants
116
126
  // to expand. Discuss if this is useful or not
@@ -131,14 +141,14 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
131
141
  if (!row) throw new Error('Target row not found in the tree.');
132
142
  if (needsDoubleClick) await this.user.dblClick(row);
133
143
  else if (interactionType === 'keyboard') {
134
- if ((row === null || row === void 0 ? void 0 : row.getAttribute('aria-disabled')) === 'true') return;
144
+ if (row?.getAttribute('aria-disabled') === 'true') return;
135
145
  // TODO: same as above, uses the modifier key to make sure we don't modify selection state on row focus
136
146
  // as we keyboard navigate to the row we want activate
137
147
  await this.keyboardNavigateToRow({
138
148
  row: row
139
149
  });
140
150
  await this.user.keyboard('[Enter]');
141
- } else await (0, $5d1eca18f92ad0e6$export$6ffa3eb717517feb)(this.user, row, interactionType);
151
+ } else await (0, $22d7d9b763402afa$export$6ffa3eb717517feb)(this.user, row, interactionType);
142
152
  }
143
153
  /**
144
154
  * Returns the tree.
@@ -148,8 +158,7 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
148
158
  /**
149
159
  * Returns the tree's rows if any.
150
160
  */ get rows() {
151
- var _this;
152
- return (0, $3mnbZ$within)((_this = this) === null || _this === void 0 ? void 0 : _this.tree).queryAllByRole('row');
161
+ return (0, $5Fhol$within)(this?.tree).queryAllByRole('row');
153
162
  }
154
163
  /**
155
164
  * Returns the tree's selected rows if any.
@@ -160,20 +169,10 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
160
169
  * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.
161
170
  */ cells(opts = {}) {
162
171
  let { element: element = this.tree } = opts;
163
- return (0, $3mnbZ$within)(element).queryAllByRole('gridcell');
164
- }
165
- constructor(opts){
166
- let { root: root, user: user, interactionType: interactionType, advanceTimer: advanceTimer } = opts;
167
- this.user = user;
168
- this._interactionType = interactionType || 'mouse';
169
- this._advanceTimer = advanceTimer;
170
- this._tree = root;
171
- // TODO: should all helpers do this?
172
- let tree = (0, $3mnbZ$within)(root).queryByRole('treegrid');
173
- if (root.getAttribute('role') !== 'treegrid' && tree) this._tree = tree;
172
+ return (0, $5Fhol$within)(element).queryAllByRole('gridcell');
174
173
  }
175
174
  }
176
175
 
177
176
 
178
- export {$962758aa2f16f1a4$export$4445864b14128396 as TreeTester};
179
- //# sourceMappingURL=tree.module.js.map
177
+ export {$d721d67b8ba87a3b$export$4445864b14128396 as TreeTester};
178
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM;IAMX,YAAY,IAAoB,CAAE;QAChC,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG;QAClD,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,KAAK,GAAG;QACb,oCAAoC;QACpC,IAAI,OAAO,CAAA,GAAA,aAAK,EAAE,MAAM,WAAW,CAAC;QACpC,IAAI,KAAK,YAAY,CAAC,YAAY,cAAc,MAC9C,IAAI,CAAC,KAAK,GAAG;IAEjB;IAEA;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,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AAuG;YACvG,sDAAsD;YACtD,MAAM,IAAI,CAAC,qBAAqB,CAAC;qBAAC;YAAG;YACrC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,OACE,MAAM,CAAA,GAAA,yCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK;IAEvC;IAEA;;GAEC,GACD,IAAI,OAAqB;QACvB,OAAO,IAAI,CAAC,KAAK;IACnB;IAEA;;GAEC,GACD,IAAI,OAAsB;QACxB,OAAO,CAAA,GAAA,aAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;IAC3C;IAEA;;GAEC,GACD,IAAI,eAA8B;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,MAAO,IAAI,YAAY,CAAC,qBAAqB;IACvE;IAEA;;GAEC,GACD,MAAM,OAAgC,CAAC,CAAC,EAAiB;QACvD,IAAI,WAAC,UAAU,IAAI,CAAC,IAAI,EAAC,GAAG;QAC5B,OAAO,CAAA,GAAA,aAAK,EAAE,SAAS,cAAc,CAAC;IACxC;AACF","sources":["packages/@react-aria/test-utils/src/tree.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, within} from '@testing-library/react';\nimport {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';\nimport {getAltKey, getMetaKey, pressElement, triggerLongPress} from './events';\n\ninterface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}\ninterface TreeToggleRowOpts extends ToggleGridRowOpts {}\ninterface TreeRowActionOpts extends GridRowActionOpts {}\n\n// TODO: this ended up being pretty much the same as gridlist, refactor so it extends from gridlist\nexport class TreeTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _tree: HTMLElement;\n\n constructor(opts: TreeTesterOpts) {\n let {root, user, interactionType, advanceTimer} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n this._tree = root;\n // TODO: should all helpers do this?\n let tree = within(root).queryByRole('treegrid');\n if (root.getAttribute('role') !== 'treegrid' && tree) {\n this._tree = tree;\n }\n }\n\n /**\n * Set the interaction type used by the tree tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n };\n\n /**\n * Returns a row matching the specified index or text content.\n */\n findRow(opts: {rowIndexOrText: number | string}): HTMLElement {\n let {\n rowIndexOrText\n } = opts;\n\n let row;\n if (typeof rowIndexOrText === 'number') {\n row = this.rows[rowIndexOrText];\n } else if (typeof rowIndexOrText === 'string') {\n row = (within(this.tree!).getByText(rowIndexOrText).closest('[role=row]'))! as HTMLElement;\n }\n\n return row;\n }\n\n // TODO: RTL\n private async keyboardNavigateToRow(opts: {row: HTMLElement, selectionOnNav?: 'default' | 'none'}) {\n let {row, selectionOnNav = 'default'} = opts;\n let altKey = getAltKey();\n let rows = this.rows;\n let targetIndex = rows.indexOf(row);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the tree');\n }\n\n if (document.activeElement !== this._tree && !this._tree.contains(document.activeElement)) {\n act(() => this._tree.focus());\n }\n\n if (document.activeElement === this.tree) {\n await this.user.keyboard(`${selectionOnNav === 'none' ? `[${altKey}>]` : ''}[ArrowDown]${selectionOnNav === 'none' ? `[/${altKey}]` : ''}`);\n } else if (this._tree.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {\n do {\n await this.user.keyboard('[ArrowLeft]');\n } while (document.activeElement!.getAttribute('role') !== 'row');\n }\n let currIndex = rows.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tree');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n if (selectionOnNav === 'none') {\n await this.user.keyboard(`[${altKey}>]`);\n }\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n if (selectionOnNav === 'none') {\n await this.user.keyboard(`[/${altKey}]`);\n }\n };\n\n /**\n * Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.\n * Note that this will endevor to always add/remove JUST the provided row to the set of selected rows.\n */\n async toggleRowSelection(opts: TreeToggleRowOpts): Promise<void> {\n let {\n row,\n needsLongPress,\n checkboxSelection = true,\n interactionType = this._interactionType,\n selectionBehavior = 'toggle'\n } = opts;\n\n let altKey = getAltKey();\n let metaKey = getMetaKey();\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n let rowCheckbox = within(row).queryByRole('checkbox');\n\n // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually\n // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)\n if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) {\n return;\n }\n\n // this would be better than the check to do nothing in events.ts\n // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly\n if (interactionType === 'keyboard' && (!checkboxSelection || !rowCheckbox)) {\n await this.keyboardNavigateToRow({row, selectionOnNav: selectionBehavior === 'replace' ? 'none' : 'default'});\n if (selectionBehavior === 'replace') {\n await this.user.keyboard(`[${altKey}>]`);\n }\n await this.user.keyboard('[Space]');\n if (selectionBehavior === 'replace') {\n await this.user.keyboard(`[/${altKey}]`);\n }\n return;\n }\n if (rowCheckbox && checkboxSelection) {\n await pressElement(this.user, rowCheckbox, interactionType);\n } else {\n let cell = within(row).getAllByRole('gridcell')[0];\n if (needsLongPress && interactionType === 'touch') {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n\n // Note that long press interactions with rows is strictly touch only for grid rows\n await triggerLongPress({element: cell, advanceTimer: this._advanceTimer, pointerOpts: {pointerType: 'touch'}});\n } else {\n // TODO add modifiers here? Maybe move into pressElement if we get more cases for different types of modifier keys\n if (selectionBehavior === 'replace' && interactionType !== 'touch') {\n await this.user.keyboard(`[${metaKey}>]`);\n }\n await pressElement(this.user, row, interactionType);\n if (selectionBehavior === 'replace' && interactionType !== 'touch') {\n await this.user.keyboard(`[/${metaKey}]`);\n }\n }\n }\n };\n\n /**\n * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowExpansion(opts: TreeToggleExpansionOpts): Promise<void> {\n let {\n row,\n interactionType = this._interactionType\n } = opts;\n if (!this.tree.contains(document.activeElement)) {\n await act(async () => {\n this.tree.focus();\n });\n }\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n } else if (row.getAttribute('aria-expanded') == null) {\n throw new Error('Target row is not expandable.');\n }\n\n if (interactionType === 'mouse' || interactionType === 'touch') {\n let rowExpander = within(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?\n await pressElement(this.user, rowExpander, interactionType);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n // TODO: We always Use Option/Ctrl when keyboard navigating so selection isn't changed\n // in selectionmode=\"replace\"/highlight selection when navigating to the row that the user wants\n // to expand. Discuss if this is useful or not\n await this.keyboardNavigateToRow({row});\n if (row.getAttribute('aria-expanded') === 'true') {\n await this.user.keyboard('[ArrowLeft]');\n } else {\n await this.user.keyboard('[ArrowRight]');\n }\n }\n };\n\n /**\n * Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async triggerRowAction(opts: TreeRowActionOpts): Promise<void> {\n let {\n row,\n needsDoubleClick,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n if (needsDoubleClick) {\n await this.user.dblClick(row);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n // TODO: same as above, uses the modifier key to make sure we don't modify selection state on row focus\n // as we keyboard navigate to the row we want activate\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('[Enter]');\n } else {\n await pressElement(this.user, row, interactionType);\n }\n };\n\n /**\n * Returns the tree.\n */\n get tree(): HTMLElement {\n return this._tree;\n }\n\n /**\n * Returns the tree's rows if any.\n */\n get rows(): HTMLElement[] {\n return within(this?.tree).queryAllByRole('row');\n }\n\n /**\n * Returns the tree's selected rows if any.\n */\n get selectedRows(): HTMLElement[] {\n return this.rows.filter(row => row.getAttribute('aria-selected') === 'true');\n }\n\n /**\n * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.\n */\n cells(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.tree} = opts;\n return within(element).queryAllByRole('gridcell');\n }\n}\n"],"names":[],"version":3,"file":"tree.js.map"}
@@ -0,0 +1,85 @@
1
+ var $2c71bb2c1e5033f0$exports = require("./checkboxgroup.cjs");
2
+ var $2cdddd94ee78eafe$exports = require("./combobox.cjs");
3
+ var $cde1dbf8bdfa11d9$exports = require("./dialog.cjs");
4
+ var $31bb3cd1e8c56ca2$exports = require("./gridlist.cjs");
5
+ var $c0f7ae61eac30828$exports = require("./listbox.cjs");
6
+ var $72b6079685b45ac0$exports = require("./menu.cjs");
7
+ var $b3fc8c302673b35d$exports = require("./userEventMaps.cjs");
8
+ var $4308942495e5af40$exports = require("./radiogroup.cjs");
9
+ var $842eb702165f4e83$exports = require("./select.cjs");
10
+ var $b9d4e4f005cd9015$exports = require("./table.cjs");
11
+ var $d225318b7bd4eacf$exports = require("./tabs.cjs");
12
+ var $c7f71a5a893f714a$exports = require("./tree.cjs");
13
+ var $2DbTQ$testinglibraryuserevent = require("@testing-library/user-event");
14
+
15
+
16
+ function $parcel$interopDefault(a) {
17
+ return a && a.__esModule ? a.default : a;
18
+ }
19
+
20
+ function $parcel$export(e, n, v, s) {
21
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
22
+ }
23
+
24
+ $parcel$export(module.exports, "User", function () { return $3117e6a7fac3686b$export$1f44aaf2ec115b54; });
25
+ /*
26
+ * Copyright 2024 Adobe. All rights reserved.
27
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
28
+ * you may not use this file except in compliance with the License. You may obtain a copy
29
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software distributed under
32
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
33
+ * OF ANY KIND, either express or implied. See the License for the specific language
34
+ * governing permissions and limitations under the License.
35
+ */
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+ let $3117e6a7fac3686b$var$keyToUtil = {
49
+ 'CheckboxGroup': (0, $2c71bb2c1e5033f0$exports.CheckboxGroupTester),
50
+ 'ComboBox': (0, $2cdddd94ee78eafe$exports.ComboBoxTester),
51
+ 'Dialog': (0, $cde1dbf8bdfa11d9$exports.DialogTester),
52
+ 'GridList': (0, $31bb3cd1e8c56ca2$exports.GridListTester),
53
+ 'ListBox': (0, $c0f7ae61eac30828$exports.ListBoxTester),
54
+ 'Menu': (0, $72b6079685b45ac0$exports.MenuTester),
55
+ 'RadioGroup': (0, $4308942495e5af40$exports.RadioGroupTester),
56
+ 'Select': (0, $842eb702165f4e83$exports.SelectTester),
57
+ 'Table': (0, $b9d4e4f005cd9015$exports.TableTester),
58
+ 'Tabs': (0, $d225318b7bd4eacf$exports.TabsTester),
59
+ 'Tree': (0, $c7f71a5a893f714a$exports.TreeTester)
60
+ };
61
+ let $3117e6a7fac3686b$var$defaultAdvanceTimer = (waitTime)=>new Promise((resolve)=>setTimeout(resolve, waitTime));
62
+ class $3117e6a7fac3686b$export$1f44aaf2ec115b54 {
63
+ constructor(opts = {}){
64
+ let { interactionType: interactionType, advanceTimer: advanceTimer } = opts;
65
+ this.user = (0, ($parcel$interopDefault($2DbTQ$testinglibraryuserevent))).setup({
66
+ delay: null,
67
+ pointerMap: $b3fc8c302673b35d$exports.pointerMap
68
+ });
69
+ this.interactionType = interactionType;
70
+ this.advanceTimer = advanceTimer || $3117e6a7fac3686b$var$defaultAdvanceTimer;
71
+ }
72
+ /**
73
+ * Creates an aria pattern tester, inheriting the options provided to the original user.
74
+ */ createTester(patternName, opts) {
75
+ return new $3117e6a7fac3686b$var$keyToUtil[patternName]({
76
+ interactionType: this.interactionType,
77
+ advanceTimer: this.advanceTimer,
78
+ ...opts,
79
+ user: this.user
80
+ });
81
+ }
82
+ }
83
+
84
+
85
+ //# sourceMappingURL=user.cjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AA8BD,IAAI,kCAYA;IACF,iBAAiB,CAAA,GAAA,6CAAkB;IACnC,YAAY,CAAA,GAAA,wCAAa;IACzB,UAAU,CAAA,GAAA,sCAAW;IACrB,YAAY,CAAA,GAAA,wCAAa;IACzB,WAAW,CAAA,GAAA,uCAAY;IACvB,QAAQ,CAAA,GAAA,oCAAS;IACjB,cAAc,CAAA,GAAA,0CAAe;IAC7B,UAAU,CAAA,GAAA,sCAAW;IACrB,SAAS,CAAA,GAAA,qCAAU;IACnB,QAAQ,CAAA,GAAA,oCAAS;IACjB,QAAQ,CAAA,GAAA,oCAAS;AACnB;AAgCA,IAAI,4CAAsB,CAAC,WAAiC,IAAI,QAAQ,CAAC,UAAY,WAAW,SAAS;AAElG,MAAM;IAaX,YAAY,OAAiB,CAAC,CAAC,CAAE;QAC/B,IAAI,mBAAC,eAAe,gBAAE,YAAY,EAAC,GAAG;QACtC,IAAI,CAAC,IAAI,GAAG,CAAA,GAAA,wDAAQ,EAAE,KAAK,CAAC;YAAC,OAAO;wBAAM;QAAU;QACpD,IAAI,CAAC,eAAe,GAAG;QACvB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;IAEA;;GAEC,GACD,aAAqC,WAAc,EAAE,IAAmB,EAAa;QACnF,OAAO,IAAI,AAAC,+BAAU,CAAC,YAAY,CAAC;YAAC,iBAAiB,IAAI,CAAC,eAAe;YAAE,cAAc,IAAI,CAAC,YAAY;YAAE,GAAG,IAAI;YAAE,MAAM,IAAI,CAAC,IAAI;QAAA;IACvI;AACF","sources":["packages/@react-aria/test-utils/src/user.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 {CheckboxGroupTester} from './checkboxgroup';\nimport {\n CheckboxGroupTesterOpts,\n ComboBoxTesterOpts,\n DialogTesterOpts,\n GridListTesterOpts,\n ListBoxTesterOpts,\n MenuTesterOpts,\n RadioGroupTesterOpts,\n SelectTesterOpts,\n TableTesterOpts,\n TabsTesterOpts,\n TreeTesterOpts,\n UserOpts\n} from './types';\nimport {ComboBoxTester} from './combobox';\nimport {DialogTester} from './dialog';\nimport {GridListTester} from './gridlist';\nimport {ListBoxTester} from './listbox';\nimport {MenuTester} from './menu';\nimport {pointerMap} from './';\nimport {RadioGroupTester} from './radiogroup';\nimport {SelectTester} from './select';\nimport {TableTester} from './table';\nimport {TabsTester} from './tabs';\nimport {TreeTester} from './tree';\nimport userEvent from '@testing-library/user-event';\n\nlet keyToUtil: {\n 'CheckboxGroup': typeof CheckboxGroupTester,\n 'ComboBox': typeof ComboBoxTester,\n 'Dialog': typeof DialogTester,\n 'GridList': typeof GridListTester,\n 'ListBox': typeof ListBoxTester,\n 'Menu': typeof MenuTester,\n 'RadioGroup': typeof RadioGroupTester,\n 'Select': typeof SelectTester,\n 'Table': typeof TableTester,\n 'Tabs': typeof TabsTester,\n 'Tree': typeof TreeTester\n} = {\n 'CheckboxGroup': CheckboxGroupTester,\n 'ComboBox': ComboBoxTester,\n 'Dialog': DialogTester,\n 'GridList': GridListTester,\n 'ListBox': ListBoxTester,\n 'Menu': MenuTester,\n 'RadioGroup': RadioGroupTester,\n 'Select': SelectTester,\n 'Table': TableTester,\n 'Tabs': TabsTester,\n 'Tree': TreeTester\n} as const;\nexport type PatternNames = keyof typeof keyToUtil;\n\n// Conditional type: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html\ntype Tester<T> =\n T extends 'CheckboxGroup' ? CheckboxGroupTester :\n T extends 'ComboBox' ? ComboBoxTester :\n T extends 'Dialog' ? DialogTester :\n T extends 'GridList' ? GridListTester :\n T extends 'ListBox' ? ListBoxTester :\n T extends 'Menu' ? MenuTester :\n T extends 'RadioGroup' ? RadioGroupTester :\n T extends 'Select' ? SelectTester :\n T extends 'Table' ? TableTester :\n T extends 'Tabs' ? TabsTester :\n T extends 'Tree' ? TreeTester :\n never;\n\ntype TesterOpts<T> =\n T extends 'CheckboxGroup' ? CheckboxGroupTesterOpts :\n T extends 'ComboBox' ? ComboBoxTesterOpts :\n T extends 'Dialog' ? DialogTesterOpts :\n T extends 'GridList' ? GridListTesterOpts :\n T extends 'ListBox' ? ListBoxTesterOpts :\n T extends 'Menu' ? MenuTesterOpts :\n T extends 'RadioGroup' ? RadioGroupTesterOpts :\n T extends 'Select' ? SelectTesterOpts :\n T extends 'Table' ? TableTesterOpts :\n T extends 'Tabs' ? TabsTesterOpts :\n T extends 'Tree' ? TreeTesterOpts :\n never;\n\nlet defaultAdvanceTimer = (waitTime: number | undefined) => new Promise((resolve) => setTimeout(resolve, waitTime));\n\nexport class User {\n private user;\n /**\n * The interaction type (mouse, touch, keyboard) that the test util user will use when interacting with a component. This can be overridden\n * at the aria pattern util level if needed.\n * @default mouse\n */\n interactionType: UserOpts['interactionType'];\n /**\n * A function used by the test utils to advance timers during interactions. Required for certain aria patterns (e.g. table).\n */\n advanceTimer: UserOpts['advanceTimer'];\n\n constructor(opts: UserOpts = {}) {\n let {interactionType, advanceTimer} = opts;\n this.user = userEvent.setup({delay: null, pointerMap});\n this.interactionType = interactionType;\n this.advanceTimer = advanceTimer || defaultAdvanceTimer;\n }\n\n /**\n * Creates an aria pattern tester, inheriting the options provided to the original user.\n */\n createTester<T extends PatternNames>(patternName: T, opts: TesterOpts<T>): Tester<T> {\n return new (keyToUtil)[patternName]({interactionType: this.interactionType, advanceTimer: this.advanceTimer, ...opts, user: this.user}) as Tester<T>;\n }\n}\n"],"names":[],"version":3,"file":"user.cjs.map"}
@@ -0,0 +1,76 @@
1
+ import {CheckboxGroupTester as $e7160b4be83b4967$export$f54f4bde770cc5a6} from "./checkboxgroup.js";
2
+ import {ComboBoxTester as $a2202d8b369e6a8a$export$f97e14e96d71ab3b} from "./combobox.js";
3
+ import {DialogTester as $1bad24930969e309$export$e79328f5295cc2a1} from "./dialog.js";
4
+ import {GridListTester as $ed42840525c46506$export$93a85aaed9fabd83} from "./gridlist.js";
5
+ import {ListBoxTester as $8d2aea0e455eb460$export$54c24f7ee8577f4f} from "./listbox.js";
6
+ import {MenuTester as $460bfe9f038d2630$export$f73bbc9212ed861e} from "./menu.js";
7
+ import {pointerMap as $759f061d800cf446$export$7dbde2c4caaa8d35} from "./userEventMaps.js";
8
+ import {RadioGroupTester as $14dc6ef63d191867$export$d66326e63d27e116} from "./radiogroup.js";
9
+ import {SelectTester as $6acb352063615cf0$export$d1859707465446a9} from "./select.js";
10
+ import {TableTester as $196900c7f8f394b6$export$4c6a9d6ae3b0086} from "./table.js";
11
+ import {TabsTester as $e1a5bc7455cf5719$export$f1539bff3fc7d485} from "./tabs.js";
12
+ import {TreeTester as $d721d67b8ba87a3b$export$4445864b14128396} from "./tree.js";
13
+ import $9gPuy$testinglibraryuserevent from "@testing-library/user-event";
14
+
15
+ /*
16
+ * Copyright 2024 Adobe. All rights reserved.
17
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License. You may obtain a copy
19
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software distributed under
22
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
+ * OF ANY KIND, either express or implied. See the License for the specific language
24
+ * governing permissions and limitations under the License.
25
+ */
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+ let $4ab48216ddc89c32$var$keyToUtil = {
39
+ 'CheckboxGroup': (0, $e7160b4be83b4967$export$f54f4bde770cc5a6),
40
+ 'ComboBox': (0, $a2202d8b369e6a8a$export$f97e14e96d71ab3b),
41
+ 'Dialog': (0, $1bad24930969e309$export$e79328f5295cc2a1),
42
+ 'GridList': (0, $ed42840525c46506$export$93a85aaed9fabd83),
43
+ 'ListBox': (0, $8d2aea0e455eb460$export$54c24f7ee8577f4f),
44
+ 'Menu': (0, $460bfe9f038d2630$export$f73bbc9212ed861e),
45
+ 'RadioGroup': (0, $14dc6ef63d191867$export$d66326e63d27e116),
46
+ 'Select': (0, $6acb352063615cf0$export$d1859707465446a9),
47
+ 'Table': (0, $196900c7f8f394b6$export$4c6a9d6ae3b0086),
48
+ 'Tabs': (0, $e1a5bc7455cf5719$export$f1539bff3fc7d485),
49
+ 'Tree': (0, $d721d67b8ba87a3b$export$4445864b14128396)
50
+ };
51
+ let $4ab48216ddc89c32$var$defaultAdvanceTimer = (waitTime)=>new Promise((resolve)=>setTimeout(resolve, waitTime));
52
+ class $4ab48216ddc89c32$export$1f44aaf2ec115b54 {
53
+ constructor(opts = {}){
54
+ let { interactionType: interactionType, advanceTimer: advanceTimer } = opts;
55
+ this.user = (0, $9gPuy$testinglibraryuserevent).setup({
56
+ delay: null,
57
+ pointerMap: $759f061d800cf446$export$7dbde2c4caaa8d35
58
+ });
59
+ this.interactionType = interactionType;
60
+ this.advanceTimer = advanceTimer || $4ab48216ddc89c32$var$defaultAdvanceTimer;
61
+ }
62
+ /**
63
+ * Creates an aria pattern tester, inheriting the options provided to the original user.
64
+ */ createTester(patternName, opts) {
65
+ return new $4ab48216ddc89c32$var$keyToUtil[patternName]({
66
+ interactionType: this.interactionType,
67
+ advanceTimer: this.advanceTimer,
68
+ ...opts,
69
+ user: this.user
70
+ });
71
+ }
72
+ }
73
+
74
+
75
+ export {$4ab48216ddc89c32$export$1f44aaf2ec115b54 as User};
76
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AA8BD,IAAI,kCAYA;IACF,iBAAiB,CAAA,GAAA,yCAAkB;IACnC,YAAY,CAAA,GAAA,yCAAa;IACzB,UAAU,CAAA,GAAA,yCAAW;IACrB,YAAY,CAAA,GAAA,yCAAa;IACzB,WAAW,CAAA,GAAA,yCAAY;IACvB,QAAQ,CAAA,GAAA,yCAAS;IACjB,cAAc,CAAA,GAAA,yCAAe;IAC7B,UAAU,CAAA,GAAA,yCAAW;IACrB,SAAS,CAAA,GAAA,wCAAU;IACnB,QAAQ,CAAA,GAAA,yCAAS;IACjB,QAAQ,CAAA,GAAA,yCAAS;AACnB;AAgCA,IAAI,4CAAsB,CAAC,WAAiC,IAAI,QAAQ,CAAC,UAAY,WAAW,SAAS;AAElG,MAAM;IAaX,YAAY,OAAiB,CAAC,CAAC,CAAE;QAC/B,IAAI,mBAAC,eAAe,gBAAE,YAAY,EAAC,GAAG;QACtC,IAAI,CAAC,IAAI,GAAG,CAAA,GAAA,8BAAQ,EAAE,KAAK,CAAC;YAAC,OAAO;wBAAM;QAAU;QACpD,IAAI,CAAC,eAAe,GAAG;QACvB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;IAEA;;GAEC,GACD,aAAqC,WAAc,EAAE,IAAmB,EAAa;QACnF,OAAO,IAAI,AAAC,+BAAU,CAAC,YAAY,CAAC;YAAC,iBAAiB,IAAI,CAAC,eAAe;YAAE,cAAc,IAAI,CAAC,YAAY;YAAE,GAAG,IAAI;YAAE,MAAM,IAAI,CAAC,IAAI;QAAA;IACvI;AACF","sources":["packages/@react-aria/test-utils/src/user.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 {CheckboxGroupTester} from './checkboxgroup';\nimport {\n CheckboxGroupTesterOpts,\n ComboBoxTesterOpts,\n DialogTesterOpts,\n GridListTesterOpts,\n ListBoxTesterOpts,\n MenuTesterOpts,\n RadioGroupTesterOpts,\n SelectTesterOpts,\n TableTesterOpts,\n TabsTesterOpts,\n TreeTesterOpts,\n UserOpts\n} from './types';\nimport {ComboBoxTester} from './combobox';\nimport {DialogTester} from './dialog';\nimport {GridListTester} from './gridlist';\nimport {ListBoxTester} from './listbox';\nimport {MenuTester} from './menu';\nimport {pointerMap} from './';\nimport {RadioGroupTester} from './radiogroup';\nimport {SelectTester} from './select';\nimport {TableTester} from './table';\nimport {TabsTester} from './tabs';\nimport {TreeTester} from './tree';\nimport userEvent from '@testing-library/user-event';\n\nlet keyToUtil: {\n 'CheckboxGroup': typeof CheckboxGroupTester,\n 'ComboBox': typeof ComboBoxTester,\n 'Dialog': typeof DialogTester,\n 'GridList': typeof GridListTester,\n 'ListBox': typeof ListBoxTester,\n 'Menu': typeof MenuTester,\n 'RadioGroup': typeof RadioGroupTester,\n 'Select': typeof SelectTester,\n 'Table': typeof TableTester,\n 'Tabs': typeof TabsTester,\n 'Tree': typeof TreeTester\n} = {\n 'CheckboxGroup': CheckboxGroupTester,\n 'ComboBox': ComboBoxTester,\n 'Dialog': DialogTester,\n 'GridList': GridListTester,\n 'ListBox': ListBoxTester,\n 'Menu': MenuTester,\n 'RadioGroup': RadioGroupTester,\n 'Select': SelectTester,\n 'Table': TableTester,\n 'Tabs': TabsTester,\n 'Tree': TreeTester\n} as const;\nexport type PatternNames = keyof typeof keyToUtil;\n\n// Conditional type: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html\ntype Tester<T> =\n T extends 'CheckboxGroup' ? CheckboxGroupTester :\n T extends 'ComboBox' ? ComboBoxTester :\n T extends 'Dialog' ? DialogTester :\n T extends 'GridList' ? GridListTester :\n T extends 'ListBox' ? ListBoxTester :\n T extends 'Menu' ? MenuTester :\n T extends 'RadioGroup' ? RadioGroupTester :\n T extends 'Select' ? SelectTester :\n T extends 'Table' ? TableTester :\n T extends 'Tabs' ? TabsTester :\n T extends 'Tree' ? TreeTester :\n never;\n\ntype TesterOpts<T> =\n T extends 'CheckboxGroup' ? CheckboxGroupTesterOpts :\n T extends 'ComboBox' ? ComboBoxTesterOpts :\n T extends 'Dialog' ? DialogTesterOpts :\n T extends 'GridList' ? GridListTesterOpts :\n T extends 'ListBox' ? ListBoxTesterOpts :\n T extends 'Menu' ? MenuTesterOpts :\n T extends 'RadioGroup' ? RadioGroupTesterOpts :\n T extends 'Select' ? SelectTesterOpts :\n T extends 'Table' ? TableTesterOpts :\n T extends 'Tabs' ? TabsTesterOpts :\n T extends 'Tree' ? TreeTesterOpts :\n never;\n\nlet defaultAdvanceTimer = (waitTime: number | undefined) => new Promise((resolve) => setTimeout(resolve, waitTime));\n\nexport class User {\n private user;\n /**\n * The interaction type (mouse, touch, keyboard) that the test util user will use when interacting with a component. This can be overridden\n * at the aria pattern util level if needed.\n * @default mouse\n */\n interactionType: UserOpts['interactionType'];\n /**\n * A function used by the test utils to advance timers during interactions. Required for certain aria patterns (e.g. table).\n */\n advanceTimer: UserOpts['advanceTimer'];\n\n constructor(opts: UserOpts = {}) {\n let {interactionType, advanceTimer} = opts;\n this.user = userEvent.setup({delay: null, pointerMap});\n this.interactionType = interactionType;\n this.advanceTimer = advanceTimer || defaultAdvanceTimer;\n }\n\n /**\n * Creates an aria pattern tester, inheriting the options provided to the original user.\n */\n createTester<T extends PatternNames>(patternName: T, opts: TesterOpts<T>): Tester<T> {\n return new (keyToUtil)[patternName]({interactionType: this.interactionType, advanceTimer: this.advanceTimer, ...opts, user: this.user}) as Tester<T>;\n }\n}\n"],"names":[],"version":3,"file":"user.js.map"}
@@ -3,8 +3,8 @@ function $parcel$export(e, n, v, s) {
3
3
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
4
  }
5
5
 
6
- $parcel$export(module.exports, "pointerMap", () => $0e568517a25183a7$export$7dbde2c4caaa8d35);
7
- let $0e568517a25183a7$export$7dbde2c4caaa8d35 = [
6
+ $parcel$export(module.exports, "pointerMap", function () { return $b3fc8c302673b35d$export$7dbde2c4caaa8d35; });
7
+ let $b3fc8c302673b35d$export$7dbde2c4caaa8d35 = [
8
8
  {
9
9
  name: 'MouseLeft',
10
10
  pointerType: 'mouse',
@@ -40,4 +40,4 @@ let $0e568517a25183a7$export$7dbde2c4caaa8d35 = [
40
40
  ];
41
41
 
42
42
 
43
- //# sourceMappingURL=userEventMaps.main.js.map
43
+ //# sourceMappingURL=userEventMaps.cjs.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAEO,IAAI,4CAA2B;IACpC;QAAC,MAAM;QAAa,aAAa;QAAS,QAAQ;QAAW,QAAQ;QAAG,OAAO;QAAG,UAAU;IAAG;IAC/F;QAAC,MAAM;QAAc,aAAa;QAAS,QAAQ;IAAW;IAC9D;QAAC,MAAM;QAAe,aAAa;QAAS,QAAQ;IAAW;IAC/D;QAAC,MAAM;QAAU,aAAa;QAAS,QAAQ;QAAG,OAAO;IAAC;IAC1D;QAAC,MAAM;QAAU,aAAa;IAAO;IACrC;QAAC,MAAM;QAAU,aAAa;IAAO;CACtC","sources":["packages/@react-aria/test-utils/src/userEventMaps.ts"],"sourcesContent":["import {pointerKey} from '@testing-library/user-event';\n\nexport let pointerMap: pointerKey[] = [\n {name: 'MouseLeft', pointerType: 'mouse', button: 'primary', height: 1, width: 1, pressure: 0.5},\n {name: 'MouseRight', pointerType: 'mouse', button: 'secondary'},\n {name: 'MouseMiddle', pointerType: 'mouse', button: 'auxiliary'},\n {name: 'TouchA', pointerType: 'touch', height: 1, width: 1},\n {name: 'TouchB', pointerType: 'touch'},\n {name: 'TouchC', pointerType: 'touch'}\n] as unknown as pointerKey[];\n"],"names":[],"version":3,"file":"userEventMaps.main.js.map"}
1
+ {"mappings":";;;;;;AAEO,IAAI,4CAA2B;IACpC;QAAC,MAAM;QAAa,aAAa;QAAS,QAAQ;QAAW,QAAQ;QAAG,OAAO;QAAG,UAAU;IAAG;IAC/F;QAAC,MAAM;QAAc,aAAa;QAAS,QAAQ;IAAW;IAC9D;QAAC,MAAM;QAAe,aAAa;QAAS,QAAQ;IAAW;IAC/D;QAAC,MAAM;QAAU,aAAa;QAAS,QAAQ;QAAG,OAAO;IAAC;IAC1D;QAAC,MAAM;QAAU,aAAa;IAAO;IACrC;QAAC,MAAM;QAAU,aAAa;IAAO;CACtC","sources":["packages/@react-aria/test-utils/src/userEventMaps.ts"],"sourcesContent":["import {pointerKey} from '@testing-library/user-event';\n\nexport let pointerMap: pointerKey[] = [\n {name: 'MouseLeft', pointerType: 'mouse', button: 'primary', height: 1, width: 1, pressure: 0.5},\n {name: 'MouseRight', pointerType: 'mouse', button: 'secondary'},\n {name: 'MouseMiddle', pointerType: 'mouse', button: 'auxiliary'},\n {name: 'TouchA', pointerType: 'touch', height: 1, width: 1},\n {name: 'TouchB', pointerType: 'touch'},\n {name: 'TouchC', pointerType: 'touch'}\n] as unknown as pointerKey[];\n"],"names":[],"version":3,"file":"userEventMaps.cjs.map"}
@@ -1,4 +1,4 @@
1
- let $50ecfb18069ec897$export$7dbde2c4caaa8d35 = [
1
+ let $759f061d800cf446$export$7dbde2c4caaa8d35 = [
2
2
  {
3
3
  name: 'MouseLeft',
4
4
  pointerType: 'mouse',
@@ -34,5 +34,5 @@ let $50ecfb18069ec897$export$7dbde2c4caaa8d35 = [
34
34
  ];
35
35
 
36
36
 
37
- export {$50ecfb18069ec897$export$7dbde2c4caaa8d35 as pointerMap};
38
- //# sourceMappingURL=userEventMaps.module.js.map
37
+ export {$759f061d800cf446$export$7dbde2c4caaa8d35 as pointerMap};
38
+ //# sourceMappingURL=userEventMaps.js.map
@@ -1 +1 @@
1
- {"mappings":"AAEO,IAAI,4CAA2B;IACpC;QAAC,MAAM;QAAa,aAAa;QAAS,QAAQ;QAAW,QAAQ;QAAG,OAAO;QAAG,UAAU;IAAG;IAC/F;QAAC,MAAM;QAAc,aAAa;QAAS,QAAQ;IAAW;IAC9D;QAAC,MAAM;QAAe,aAAa;QAAS,QAAQ;IAAW;IAC/D;QAAC,MAAM;QAAU,aAAa;QAAS,QAAQ;QAAG,OAAO;IAAC;IAC1D;QAAC,MAAM;QAAU,aAAa;IAAO;IACrC;QAAC,MAAM;QAAU,aAAa;IAAO;CACtC","sources":["packages/@react-aria/test-utils/src/userEventMaps.ts"],"sourcesContent":["import {pointerKey} from '@testing-library/user-event';\n\nexport let pointerMap: pointerKey[] = [\n {name: 'MouseLeft', pointerType: 'mouse', button: 'primary', height: 1, width: 1, pressure: 0.5},\n {name: 'MouseRight', pointerType: 'mouse', button: 'secondary'},\n {name: 'MouseMiddle', pointerType: 'mouse', button: 'auxiliary'},\n {name: 'TouchA', pointerType: 'touch', height: 1, width: 1},\n {name: 'TouchB', pointerType: 'touch'},\n {name: 'TouchC', pointerType: 'touch'}\n] as unknown as pointerKey[];\n"],"names":[],"version":3,"file":"userEventMaps.module.js.map"}
1
+ {"mappings":"AAEO,IAAI,4CAA2B;IACpC;QAAC,MAAM;QAAa,aAAa;QAAS,QAAQ;QAAW,QAAQ;QAAG,OAAO;QAAG,UAAU;IAAG;IAC/F;QAAC,MAAM;QAAc,aAAa;QAAS,QAAQ;IAAW;IAC9D;QAAC,MAAM;QAAe,aAAa;QAAS,QAAQ;IAAW;IAC/D;QAAC,MAAM;QAAU,aAAa;QAAS,QAAQ;QAAG,OAAO;IAAC;IAC1D;QAAC,MAAM;QAAU,aAAa;IAAO;IACrC;QAAC,MAAM;QAAU,aAAa;IAAO;CACtC","sources":["packages/@react-aria/test-utils/src/userEventMaps.ts"],"sourcesContent":["import {pointerKey} from '@testing-library/user-event';\n\nexport let pointerMap: pointerKey[] = [\n {name: 'MouseLeft', pointerType: 'mouse', button: 'primary', height: 1, width: 1, pressure: 0.5},\n {name: 'MouseRight', pointerType: 'mouse', button: 'secondary'},\n {name: 'MouseMiddle', pointerType: 'mouse', button: 'auxiliary'},\n {name: 'TouchA', pointerType: 'touch', height: 1, width: 1},\n {name: 'TouchB', pointerType: 'touch'},\n {name: 'TouchC', pointerType: 'touch'}\n] as unknown as pointerKey[];\n"],"names":[],"version":3,"file":"userEventMaps.js.map"}
@@ -0,0 +1,45 @@
1
+ import { CheckboxGroupTesterOpts, UserOpts } from './types';
2
+ interface TriggerCheckboxOptions {
3
+ /**
4
+ * What interaction type to use when triggering a checkbox. Defaults to the interaction type set on the tester.
5
+ */
6
+ interactionType?: UserOpts['interactionType'];
7
+ /**
8
+ * The index, text, or node of the checkbox to toggle selection for.
9
+ */
10
+ checkbox: number | string | HTMLElement;
11
+ }
12
+ export declare class CheckboxGroupTester {
13
+ private user;
14
+ private _interactionType;
15
+ private _checkboxgroup;
16
+ constructor(opts: CheckboxGroupTesterOpts);
17
+ /**
18
+ * Set the interaction type used by the checkbox group tester.
19
+ */
20
+ setInteractionType(type: UserOpts['interactionType']): void;
21
+ /**
22
+ * Returns a checkbox matching the specified index or text content.
23
+ */
24
+ findCheckbox(opts: {
25
+ checkboxIndexOrText: number | string;
26
+ }): HTMLElement;
27
+ private keyboardNavigateToCheckbox;
28
+ /**
29
+ * Toggles the specified checkbox. Defaults to using the interaction type set on the checkbox tester.
30
+ */
31
+ toggleCheckbox(opts: TriggerCheckboxOptions): Promise<void>;
32
+ /**
33
+ * Returns the checkboxgroup.
34
+ */
35
+ get checkboxgroup(): HTMLElement;
36
+ /**
37
+ * Returns the checkboxes.
38
+ */
39
+ get checkboxes(): HTMLElement[];
40
+ /**
41
+ * Returns the currently selected checkboxes in the checkboxgroup if any.
42
+ */
43
+ get selectedCheckboxes(): HTMLElement[];
44
+ }
45
+ export {};
@@ -0,0 +1,75 @@
1
+ import { ComboBoxTesterOpts, UserOpts } from './types';
2
+ interface ComboBoxOpenOpts {
3
+ /**
4
+ * Whether the combobox opens on focus or needs to be manually opened via user action.
5
+ * @default 'manual'
6
+ */
7
+ triggerBehavior?: 'focus' | 'manual';
8
+ /**
9
+ * What interaction type to use when opening the combobox. Defaults to the interaction type set on the tester.
10
+ */
11
+ interactionType?: UserOpts['interactionType'];
12
+ }
13
+ interface ComboBoxSelectOpts extends ComboBoxOpenOpts {
14
+ /**
15
+ * The index, text, or node of the option to select. Option nodes can be sourced via `options()`.
16
+ */
17
+ option: number | string | HTMLElement;
18
+ }
19
+ export declare class ComboBoxTester {
20
+ private user;
21
+ private _interactionType;
22
+ private _combobox;
23
+ private _trigger;
24
+ constructor(opts: ComboBoxTesterOpts);
25
+ /**
26
+ * Set the interaction type used by the combobox tester.
27
+ */
28
+ setInteractionType(type: UserOpts['interactionType']): void;
29
+ /**
30
+ * Opens the combobox dropdown. Defaults to using the interaction type set on the combobox tester.
31
+ */
32
+ open(opts?: ComboBoxOpenOpts): Promise<void>;
33
+ /**
34
+ * Returns an option matching the specified index or text content.
35
+ */
36
+ findOption(opts: {
37
+ optionIndexOrText: number | string;
38
+ }): HTMLElement;
39
+ /**
40
+ * Selects the desired combobox option. Defaults to using the interaction type set on the combobox tester. If necessary, will open the combobox dropdown beforehand.
41
+ * The desired option can be targeted via the option's node, the option's text, or the option's index.
42
+ */
43
+ selectOption(opts: ComboBoxSelectOpts): Promise<void>;
44
+ /**
45
+ * Closes the combobox dropdown.
46
+ */
47
+ close(): Promise<void>;
48
+ /**
49
+ * Returns the combobox.
50
+ */
51
+ get combobox(): HTMLElement;
52
+ /**
53
+ * Returns the combobox trigger button.
54
+ */
55
+ get trigger(): HTMLElement;
56
+ /**
57
+ * Returns the combobox's listbox if present.
58
+ */
59
+ get listbox(): HTMLElement | null;
60
+ /**
61
+ * Returns the combobox's sections if present.
62
+ */
63
+ get sections(): HTMLElement[];
64
+ /**
65
+ * Returns the combobox's options if present. Can be filtered to a subsection of the listbox if provided via `element`.
66
+ */
67
+ options(opts?: {
68
+ element?: HTMLElement;
69
+ }): HTMLElement[];
70
+ /**
71
+ * Returns the currently focused option in the combobox's dropdown if any.
72
+ */
73
+ get focusedOption(): HTMLElement | null;
74
+ }
75
+ export {};
@@ -0,0 +1,36 @@
1
+ import { DialogTesterOpts, UserOpts } from './types';
2
+ interface DialogOpenOpts {
3
+ /**
4
+ * What interaction type to use when opening the dialog. Defaults to the interaction type set on the tester.
5
+ */
6
+ interactionType?: UserOpts['interactionType'];
7
+ }
8
+ export declare class DialogTester {
9
+ private user;
10
+ private _interactionType;
11
+ private _trigger;
12
+ private _dialog;
13
+ private _overlayType;
14
+ constructor(opts: DialogTesterOpts);
15
+ /**
16
+ * Set the interaction type used by the dialog tester.
17
+ */
18
+ setInteractionType(type: UserOpts['interactionType']): void;
19
+ /**
20
+ * Opens the dialog. Defaults to using the interaction type set on the dialog tester.
21
+ */
22
+ open(opts?: DialogOpenOpts): Promise<void>;
23
+ /**
24
+ * Closes the dialog via the Escape key.
25
+ */
26
+ close(): Promise<void>;
27
+ /**
28
+ * Returns the dialog's trigger.
29
+ */
30
+ get trigger(): HTMLElement;
31
+ /**
32
+ * Returns the dialog if present.
33
+ */
34
+ get dialog(): HTMLElement | null;
35
+ }
36
+ export {};
@@ -0,0 +1,25 @@
1
+ import { UserOpts } from './types';
2
+ export declare const DEFAULT_LONG_PRESS_TIME = 500;
3
+ export declare function getAltKey(): 'Alt' | 'ControlLeft';
4
+ export declare function getMetaKey(): 'MetaLeft' | 'ControlLeft';
5
+ /**
6
+ * Simulates a "long press" event on a element.
7
+ * @param opts - Options for the long press.
8
+ * @param opts.element - Element to long press.
9
+ * @param opts.advanceTimer - Function that when called advances the timers in your test suite by a specific amount of time(ms).
10
+ * @param opts.pointeropts - Options to pass to the simulated event. Defaults to mouse. See https://testing-library.com/docs/dom-testing-library/api-events/#fireevent for more info.
11
+ */
12
+ export declare function triggerLongPress(opts: {
13
+ element: HTMLElement;
14
+ advanceTimer: (time: number) => unknown | Promise<unknown>;
15
+ pointerOpts?: Record<string, any>;
16
+ }): Promise<void>;
17
+ export declare function pressElement(user: {
18
+ click: (element: Element) => Promise<void>;
19
+ keyboard: (keys: string) => Promise<void>;
20
+ pointer: (opts: {
21
+ target: Element;
22
+ keys: string;
23
+ coords?: any;
24
+ }) => Promise<void>;
25
+ }, element: HTMLElement, interactionType: UserOpts['interactionType']): Promise<void>;