@testing-library/user-event 14.4.3 → 14.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/cjs/_interop/dtl.js +27 -0
  2. package/dist/cjs/_interop/dtlEventMap.js +27 -0
  3. package/dist/cjs/_interop/dtlHelpers.js +27 -0
  4. package/dist/cjs/clipboard/copy.js +2 -2
  5. package/dist/cjs/clipboard/cut.js +2 -2
  6. package/dist/cjs/clipboard/paste.js +4 -4
  7. package/dist/cjs/convenience/tab.js +1 -1
  8. package/dist/cjs/document/UI.js +5 -5
  9. package/dist/cjs/document/interceptor.js +1 -1
  10. package/dist/cjs/document/trackValue.js +4 -4
  11. package/dist/cjs/event/behavior/keydown.js +6 -6
  12. package/dist/cjs/event/behavior/keypress.js +2 -2
  13. package/dist/cjs/event/behavior/keyup.js +2 -2
  14. package/dist/cjs/event/behavior/paste.js +2 -2
  15. package/dist/cjs/event/createEvent.js +41 -41
  16. package/dist/cjs/event/dispatchEvent.js +2 -2
  17. package/dist/cjs/event/eventMap.js +22 -2
  18. package/dist/cjs/event/focus.js +1 -4
  19. package/dist/cjs/event/input.js +4 -4
  20. package/dist/cjs/event/selection/getInputRange.js +2 -2
  21. package/dist/cjs/event/selection/modifySelection.js +3 -3
  22. package/dist/cjs/event/selection/modifySelectionPerMouse.js +1 -1
  23. package/dist/cjs/event/selection/moveSelection.js +5 -5
  24. package/dist/cjs/event/selection/resolveCaretPosition.js +1 -1
  25. package/dist/cjs/event/selection/selectAll.js +4 -4
  26. package/dist/cjs/event/selection/setSelection.js +3 -3
  27. package/dist/cjs/event/selection/setSelectionPerMouse.js +5 -5
  28. package/dist/cjs/event/selection/setSelectionRange.js +2 -2
  29. package/dist/cjs/event/selection/updateSelectionOnFocus.js +2 -2
  30. package/dist/cjs/event/wrapEvent.js +23 -2
  31. package/dist/cjs/index.js +1 -0
  32. package/dist/cjs/keyboard/index.js +2 -2
  33. package/dist/cjs/keyboard/parseKeyDef.js +8 -8
  34. package/dist/cjs/pointer/index.js +11 -11
  35. package/dist/cjs/pointer/keyMap.js +1 -1
  36. package/dist/cjs/pointer/parseKeyDef.js +1 -1
  37. package/dist/cjs/setup/api.js +19 -17
  38. package/dist/cjs/setup/directApi.js +3 -3
  39. package/dist/cjs/setup/setup.js +10 -10
  40. package/dist/cjs/setup/wrapAsync.js +23 -2
  41. package/dist/cjs/system/index.js +15 -2
  42. package/dist/cjs/system/keyboard.js +27 -12
  43. package/dist/cjs/system/pointer/buttons.js +14 -1
  44. package/dist/cjs/system/pointer/device.js +14 -1
  45. package/dist/cjs/system/pointer/index.js +34 -17
  46. package/dist/cjs/system/pointer/mouse.js +33 -19
  47. package/dist/cjs/system/pointer/pointer.js +24 -8
  48. package/dist/cjs/system/pointer/shared.js +2 -2
  49. package/dist/cjs/utility/selectOptions.js +32 -11
  50. package/dist/cjs/utility/type.js +1 -1
  51. package/dist/cjs/utility/upload.js +4 -4
  52. package/dist/cjs/utils/dataTransfer/Clipboard.js +22 -8
  53. package/dist/cjs/utils/dataTransfer/DataTransfer.js +23 -8
  54. package/dist/cjs/utils/edit/maxLength.js +2 -2
  55. package/dist/cjs/utils/edit/setFiles.js +4 -4
  56. package/dist/cjs/utils/focus/cursor.js +2 -2
  57. package/dist/cjs/utils/focus/getActiveElement.js +2 -2
  58. package/dist/cjs/utils/focus/selector.js +1 -1
  59. package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
  60. package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
  61. package/dist/cjs/utils/misc/getWindow.js +23 -2
  62. package/dist/cjs/utils/misc/isDisabled.js +3 -3
  63. package/dist/cjs/utils/misc/isVisible.js +1 -1
  64. package/dist/cjs/utils/misc/wait.js +1 -1
  65. package/dist/cjs/utils/pointer/cssPointerEvents.js +13 -13
  66. package/dist/esm/_interop/dtl.js +2 -0
  67. package/dist/esm/_interop/dtlEventMap.js +2 -0
  68. package/dist/esm/_interop/dtlHelpers.js +2 -0
  69. package/dist/esm/clipboard/copy.js +2 -2
  70. package/dist/esm/clipboard/cut.js +2 -2
  71. package/dist/esm/clipboard/paste.js +4 -4
  72. package/dist/esm/convenience/tab.js +1 -1
  73. package/dist/esm/document/UI.js +5 -5
  74. package/dist/esm/document/interceptor.js +1 -1
  75. package/dist/esm/document/trackValue.js +4 -4
  76. package/dist/esm/event/behavior/keydown.js +6 -6
  77. package/dist/esm/event/behavior/keypress.js +2 -2
  78. package/dist/esm/event/behavior/keyup.js +2 -2
  79. package/dist/esm/event/behavior/paste.js +2 -2
  80. package/dist/esm/event/createEvent.js +41 -41
  81. package/dist/esm/event/dispatchEvent.js +2 -2
  82. package/dist/esm/event/eventMap.js +2 -2
  83. package/dist/esm/event/focus.js +1 -4
  84. package/dist/esm/event/input.js +4 -4
  85. package/dist/esm/event/selection/getInputRange.js +2 -2
  86. package/dist/esm/event/selection/modifySelection.js +3 -3
  87. package/dist/esm/event/selection/modifySelectionPerMouse.js +1 -1
  88. package/dist/esm/event/selection/moveSelection.js +5 -5
  89. package/dist/esm/event/selection/resolveCaretPosition.js +1 -1
  90. package/dist/esm/event/selection/selectAll.js +4 -4
  91. package/dist/esm/event/selection/setSelection.js +3 -3
  92. package/dist/esm/event/selection/setSelectionPerMouse.js +5 -5
  93. package/dist/esm/event/selection/setSelectionRange.js +2 -2
  94. package/dist/esm/event/selection/updateSelectionOnFocus.js +2 -2
  95. package/dist/esm/event/wrapEvent.js +2 -1
  96. package/dist/esm/index.js +1 -1
  97. package/dist/esm/keyboard/index.js +2 -2
  98. package/dist/esm/keyboard/parseKeyDef.js +8 -8
  99. package/dist/esm/pointer/index.js +11 -11
  100. package/dist/esm/pointer/keyMap.js +1 -1
  101. package/dist/esm/pointer/parseKeyDef.js +1 -1
  102. package/dist/esm/setup/api.js +33 -12
  103. package/dist/esm/setup/directApi.js +3 -3
  104. package/dist/esm/setup/setup.js +11 -11
  105. package/dist/esm/setup/wrapAsync.js +2 -1
  106. package/dist/esm/system/index.js +15 -2
  107. package/dist/esm/system/keyboard.js +27 -12
  108. package/dist/esm/system/pointer/buttons.js +14 -1
  109. package/dist/esm/system/pointer/device.js +14 -1
  110. package/dist/esm/system/pointer/index.js +34 -17
  111. package/dist/esm/system/pointer/mouse.js +33 -19
  112. package/dist/esm/system/pointer/pointer.js +24 -8
  113. package/dist/esm/system/pointer/shared.js +2 -2
  114. package/dist/esm/utility/selectOptions.js +8 -7
  115. package/dist/esm/utility/type.js +1 -1
  116. package/dist/esm/utility/upload.js +4 -4
  117. package/dist/esm/utils/dataTransfer/Clipboard.js +22 -8
  118. package/dist/esm/utils/dataTransfer/DataTransfer.js +23 -8
  119. package/dist/esm/utils/edit/maxLength.js +2 -2
  120. package/dist/esm/utils/edit/setFiles.js +4 -4
  121. package/dist/esm/utils/focus/cursor.js +2 -2
  122. package/dist/esm/utils/focus/getActiveElement.js +2 -2
  123. package/dist/esm/utils/focus/selector.js +1 -1
  124. package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
  125. package/dist/esm/utils/misc/getTreeDiff.js +3 -3
  126. package/dist/esm/utils/misc/getWindow.js +2 -1
  127. package/dist/esm/utils/misc/isDisabled.js +3 -3
  128. package/dist/esm/utils/misc/isVisible.js +1 -1
  129. package/dist/esm/utils/misc/wait.js +1 -1
  130. package/dist/esm/utils/pointer/cssPointerEvents.js +13 -13
  131. package/dist/types/_interop/dtl.d.ts +2 -0
  132. package/dist/types/_interop/dtlEventMap.d.ts +2 -0
  133. package/dist/types/_interop/dtlHelpers.d.ts +2 -0
  134. package/dist/types/clipboard/copy.d.ts +1 -1
  135. package/dist/types/clipboard/cut.d.ts +1 -1
  136. package/dist/types/clipboard/paste.d.ts +1 -1
  137. package/dist/types/convenience/click.d.ts +1 -1
  138. package/dist/types/convenience/hover.d.ts +1 -1
  139. package/dist/types/convenience/tab.d.ts +1 -1
  140. package/dist/types/document/UI.d.ts +3 -3
  141. package/dist/types/document/interceptor.d.ts +3 -3
  142. package/dist/types/event/behavior/registry.d.ts +1 -1
  143. package/dist/types/event/createEvent.d.ts +1 -1
  144. package/dist/types/event/dispatchEvent.d.ts +1 -1
  145. package/dist/types/event/eventMap.d.ts +8 -0
  146. package/dist/types/event/input.d.ts +1 -1
  147. package/dist/types/event/radio.d.ts +1 -1
  148. package/dist/types/event/selection/index.d.ts +2 -2
  149. package/dist/types/event/selection/modifySelectionPerMouse.d.ts +1 -1
  150. package/dist/types/event/selection/setSelectionPerMouse.d.ts +1 -1
  151. package/dist/types/event/types.d.ts +3 -3
  152. package/dist/types/index.d.ts +3 -1
  153. package/dist/types/keyboard/index.d.ts +1 -1
  154. package/dist/types/options.d.ts +2 -2
  155. package/dist/types/pointer/index.d.ts +7 -7
  156. package/dist/types/setup/api.d.ts +23 -5
  157. package/dist/types/setup/directApi.d.ts +5 -5
  158. package/dist/types/setup/setup.d.ts +5 -5
  159. package/dist/types/system/keyboard.d.ts +2 -2
  160. package/dist/types/system/pointer/buttons.d.ts +2 -2
  161. package/dist/types/system/pointer/device.d.ts +1 -1
  162. package/dist/types/system/pointer/mouse.d.ts +2 -2
  163. package/dist/types/system/pointer/pointer.d.ts +2 -2
  164. package/dist/types/utility/clear.d.ts +1 -1
  165. package/dist/types/utility/selectOptions.d.ts +1 -1
  166. package/dist/types/utility/type.d.ts +2 -2
  167. package/dist/types/utility/upload.d.ts +1 -1
  168. package/dist/types/utils/click/isClickableInput.d.ts +1 -1
  169. package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
  170. package/dist/types/utils/edit/isEditable.d.ts +2 -2
  171. package/dist/types/utils/edit/maxLength.d.ts +1 -1
  172. package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
  173. package/dist/types/utils/misc/isElementType.d.ts +1 -1
  174. package/dist/types/utils/misc/level.d.ts +2 -2
  175. package/dist/types/utils/misc/wait.d.ts +1 -1
  176. package/dist/types/utils/pointer/cssPointerEvents.d.ts +1 -1
  177. package/package.json +22 -11
  178. /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
  179. /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
  180. /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
  181. /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
@@ -3,7 +3,19 @@ import { Device } from './device.js';
3
3
  import { Mouse } from './mouse.js';
4
4
  import { Pointer } from './pointer.js';
5
5
 
6
- var _registry, _k;
6
+ function _define_property(obj, key, value) {
7
+ if (key in obj) {
8
+ Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ } else {
15
+ obj[key] = value;
16
+ }
17
+ return obj;
18
+ }
7
19
  class PointerHost {
8
20
  isKeyPressed(keyDef) {
9
21
  return this.devices.get(keyDef.pointerType).isPressed(keyDef);
@@ -63,10 +75,10 @@ class PointerHost {
63
75
  this.mouse.down(instance, keyDef, pointer);
64
76
  }
65
77
  if (!pointer.isMultitouch) {
66
- const mousemove1 = this.mouse.move(instance, pointer.position);
67
- mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.leave();
68
- mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.enter();
69
- mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.move();
78
+ const mousemove = this.mouse.move(instance, pointer.position);
79
+ mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
80
+ mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
81
+ mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
70
82
  this.mouse.up(instance, keyDef, pointer);
71
83
  }
72
84
  }
@@ -81,25 +93,30 @@ class PointerHost {
81
93
  this.mouse.resetClickCount();
82
94
  }
83
95
  getMouseTarget(instance) {
84
- var _target;
85
- return (_target = this.mouse.position.target) !== null && _target !== void 0 ? _target : instance.config.document.body;
96
+ var _this_mouse_position_target;
97
+ return (_this_mouse_position_target = this.mouse.position.target) !== null && _this_mouse_position_target !== void 0 ? _this_mouse_position_target : instance.config.document.body;
86
98
  }
87
99
  setMousePosition(position) {
88
100
  this.mouse.position = position;
89
101
  this.pointers.get('mouse').position = position;
90
102
  }
91
103
  constructor(system){
92
- this.devices = new class {
104
+ _define_property(this, "system", void 0);
105
+ _define_property(this, "mouse", void 0);
106
+ _define_property(this, "buttons", void 0);
107
+ _define_property(this, "devices", new class {
93
108
  get(k) {
94
- var ref;
95
- (ref = (_registry = this.registry)[_k = k]) !== null && ref !== void 0 ? ref : _registry[_k] = new Device();
109
+ var // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
110
+ _this_registry, _k;
111
+ var _;
112
+ (_ = (_this_registry = this.registry)[_k = k]) !== null && _ !== void 0 ? _ : _this_registry[_k] = new Device();
96
113
  return this.registry[k];
97
114
  }
98
115
  constructor(){
99
- this.registry = {};
116
+ _define_property(this, "registry", {});
100
117
  }
101
- }();
102
- this.pointers = new class {
118
+ }());
119
+ _define_property(this, "pointers", new class {
103
120
  new(pointerName, keyDef) {
104
121
  const isPrimary = keyDef.pointerType !== 'touch' || !Object.values(this.registry).some((p)=>p.pointerType === 'touch' && !p.isCancelled);
105
122
  if (!isPrimary) {
@@ -126,16 +143,16 @@ class PointerHost {
126
143
  return pointerName in this.registry;
127
144
  }
128
145
  constructor(){
129
- this.registry = {
146
+ _define_property(this, "registry", {
130
147
  mouse: new Pointer({
131
148
  pointerId: 1,
132
149
  pointerType: 'mouse',
133
150
  isPrimary: true
134
151
  })
135
- };
136
- this.nextId = 2;
152
+ });
153
+ _define_property(this, "nextId", 2);
137
154
  }
138
- }();
155
+ }());
139
156
  this.system = system;
140
157
  this.buttons = new Buttons();
141
158
  this.mouse = new Mouse();
@@ -22,6 +22,19 @@ import { modifySelectionPerMouseMove } from '../../event/selection/modifySelecti
22
22
  import { getMouseEventButton, Buttons } from './buttons.js';
23
23
  import { isDifferentPointerPosition } from './shared.js';
24
24
 
25
+ function _define_property(obj, key, value) {
26
+ if (key in obj) {
27
+ Object.defineProperty(obj, key, {
28
+ value: value,
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true
32
+ });
33
+ } else {
34
+ obj[key] = value;
35
+ }
36
+ return obj;
37
+ }
25
38
  /**
26
39
  * This object is the single "virtual" mouse that might be controlled by multiple different pointer devices.
27
40
  */ class Mouse {
@@ -119,39 +132,40 @@ import { isDifferentPointerPosition } from './shared.js';
119
132
  return init;
120
133
  }
121
134
  getTarget(instance) {
122
- var _target;
123
- return (_target = this.position.target) !== null && _target !== void 0 ? _target : instance.config.document.body;
135
+ var _this_position_target;
136
+ return (_this_position_target = this.position.target) !== null && _this_position_target !== void 0 ? _this_position_target : instance.config.document.body;
124
137
  }
125
138
  startSelecting(instance, clickCount) {
126
- var ref, ref1;
139
+ var _this_position_caret, _this_position_caret1;
127
140
  // TODO: support extending range (shift)
128
141
  this.selecting = setSelectionPerMouseDown({
129
142
  document: instance.config.document,
130
143
  target: this.getTarget(instance),
131
- node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node,
132
- offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset,
144
+ node: (_this_position_caret = this.position.caret) === null || _this_position_caret === void 0 ? void 0 : _this_position_caret.node,
145
+ offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === void 0 ? void 0 : _this_position_caret1.offset,
133
146
  clickCount
134
147
  });
135
148
  }
136
149
  modifySelecting(instance) {
137
- var ref, ref1;
150
+ var _this_position_caret, _this_position_caret1;
138
151
  if (!this.selecting) {
139
152
  return;
140
153
  }
141
154
  modifySelectionPerMouseMove(this.selecting, {
142
155
  document: instance.config.document,
143
156
  target: this.getTarget(instance),
144
- node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node,
145
- offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset
157
+ node: (_this_position_caret = this.position.caret) === null || _this_position_caret === void 0 ? void 0 : _this_position_caret.node,
158
+ offset: (_this_position_caret1 = this.position.caret) === null || _this_position_caret1 === void 0 ? void 0 : _this_position_caret1.offset
146
159
  });
147
160
  }
148
161
  endSelecting() {
149
162
  this.selecting = undefined;
150
163
  }
151
164
  constructor(){
152
- this.position = {};
153
- this.buttons = new Buttons();
154
- this.buttonDownTarget = {};
165
+ _define_property(this, "position", {});
166
+ _define_property(this, "buttons", new Buttons());
167
+ _define_property(this, "selecting", void 0);
168
+ _define_property(this, "buttonDownTarget", {});
155
169
  // According to spec the `detail` on click events should be the number
156
170
  // of *consecutive* clicks with a specific button.
157
171
  // On `mousedown` and `mouseup` it should be this number increased by one.
@@ -162,7 +176,7 @@ import { isDifferentPointerPosition } from './shared.js';
162
176
  // If there is a delay while a button is pressed,
163
177
  // the `mouseup` and `click` are normal, but a following `mousedown` starts a new click count.
164
178
  // We'll follow the minimal implementation of Webkit.
165
- this.clickCount = new class {
179
+ _define_property(this, "clickCount", new class {
166
180
  incOnClick(button) {
167
181
  const current = this.down[button] === undefined ? undefined : Number(this.down[button]) + 1;
168
182
  this.count = this.count[button] === undefined ? {} : {
@@ -171,13 +185,13 @@ import { isDifferentPointerPosition } from './shared.js';
171
185
  return current;
172
186
  }
173
187
  getOnDown(button) {
174
- var _button;
188
+ var _this_count_button;
175
189
  this.down = {
176
- [button]: (_button = this.count[button]) !== null && _button !== void 0 ? _button : 0
190
+ [button]: (_this_count_button = this.count[button]) !== null && _this_count_button !== void 0 ? _this_count_button : 0
177
191
  };
178
- var _button1;
192
+ var _this_count_button1;
179
193
  this.count = {
180
- [button]: (_button1 = this.count[button]) !== null && _button1 !== void 0 ? _button1 : 0
194
+ [button]: (_this_count_button1 = this.count[button]) !== null && _this_count_button1 !== void 0 ? _this_count_button1 : 0
181
195
  };
182
196
  return Number(this.count[button]) + 1;
183
197
  }
@@ -188,10 +202,10 @@ import { isDifferentPointerPosition } from './shared.js';
188
202
  this.count = {};
189
203
  }
190
204
  constructor(){
191
- this.down = {};
192
- this.count = {};
205
+ _define_property(this, "down", {});
206
+ _define_property(this, "count", {});
193
207
  }
194
- }();
208
+ }());
195
209
  }
196
210
  }
197
211
 
@@ -9,6 +9,19 @@ import '../../utils/misc/level.js';
9
9
  import { assertPointerEvents, hasPointerEvents } from '../../utils/pointer/cssPointerEvents.js';
10
10
  import { isDifferentPointerPosition } from './shared.js';
11
11
 
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  class Pointer {
13
26
  init(instance, position) {
14
27
  this.position = position;
@@ -82,8 +95,8 @@ class Pointer {
82
95
  this.isCancelled = true;
83
96
  }
84
97
  getTarget(instance) {
85
- var _target;
86
- return (_target = this.position.target) !== null && _target !== void 0 ? _target : instance.config.document.body;
98
+ var _this_position_target;
99
+ return (_this_position_target = this.position.target) !== null && _this_position_target !== void 0 ? _this_position_target : instance.config.document.body;
87
100
  }
88
101
  getEventInit() {
89
102
  return {
@@ -93,12 +106,15 @@ class Pointer {
93
106
  isPrimary: this.isPrimary
94
107
  };
95
108
  }
96
- constructor({ pointerId , pointerType , isPrimary }){
97
- this.isMultitouch = false;
98
- this.isCancelled = false;
99
- this.isDown = false;
100
- this.isPrevented = false;
101
- this.position = {};
109
+ constructor({ pointerId, pointerType, isPrimary }){
110
+ _define_property(this, "pointerId", void 0);
111
+ _define_property(this, "pointerType", void 0);
112
+ _define_property(this, "isPrimary", void 0);
113
+ _define_property(this, "isMultitouch", false);
114
+ _define_property(this, "isCancelled", false);
115
+ _define_property(this, "isDown", false);
116
+ _define_property(this, "isPrevented", false);
117
+ _define_property(this, "position", {});
102
118
  this.pointerId = pointerId;
103
119
  this.pointerType = pointerType;
104
120
  this.isPrimary = isPrimary;
@@ -1,6 +1,6 @@
1
1
  function isDifferentPointerPosition(positionA, positionB) {
2
- var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
3
- return positionA.target !== positionB.target || ((ref = positionA.coords) === null || ref === void 0 ? void 0 : ref.x) !== ((ref1 = positionB.coords) === null || ref1 === void 0 ? void 0 : ref1.y) || ((ref2 = positionA.coords) === null || ref2 === void 0 ? void 0 : ref2.y) !== ((ref3 = positionB.coords) === null || ref3 === void 0 ? void 0 : ref3.y) || ((ref4 = positionA.caret) === null || ref4 === void 0 ? void 0 : ref4.node) !== ((ref5 = positionB.caret) === null || ref5 === void 0 ? void 0 : ref5.node) || ((ref6 = positionA.caret) === null || ref6 === void 0 ? void 0 : ref6.offset) !== ((ref7 = positionB.caret) === null || ref7 === void 0 ? void 0 : ref7.offset);
2
+ var _positionA_coords, _positionB_coords, _positionA_coords1, _positionB_coords1, _positionA_caret, _positionB_caret, _positionA_caret1, _positionB_caret1;
3
+ return positionA.target !== positionB.target || ((_positionA_coords = positionA.coords) === null || _positionA_coords === void 0 ? void 0 : _positionA_coords.x) !== ((_positionB_coords = positionB.coords) === null || _positionB_coords === void 0 ? void 0 : _positionB_coords.y) || ((_positionA_coords1 = positionA.coords) === null || _positionA_coords1 === void 0 ? void 0 : _positionA_coords1.y) !== ((_positionB_coords1 = positionB.coords) === null || _positionB_coords1 === void 0 ? void 0 : _positionB_coords1.y) || ((_positionA_caret = positionA.caret) === null || _positionA_caret === void 0 ? void 0 : _positionA_caret.node) !== ((_positionB_caret = positionB.caret) === null || _positionB_caret === void 0 ? void 0 : _positionB_caret.node) || ((_positionA_caret1 = positionA.caret) === null || _positionA_caret1 === void 0 ? void 0 : _positionA_caret1.offset) !== ((_positionB_caret1 = positionB.caret) === null || _positionB_caret1 === void 0 ? void 0 : _positionB_caret1.offset);
4
4
  }
5
5
 
6
6
  export { isDifferentPointerPosition };
@@ -1,4 +1,4 @@
1
- import { getConfig } from '@testing-library/dom';
1
+ import * as named from '@testing-library/dom';
2
2
  import '../utils/click/isClickableInput.js';
3
3
  import '../utils/dataTransfer/Clipboard.js';
4
4
  import '../utils/edit/isEditable.js';
@@ -19,6 +19,7 @@ import '../event/behavior/paste.js';
19
19
  import '../event/eventMap.js';
20
20
  import { focusElement } from '../event/focus.js';
21
21
 
22
+ const { getConfig } = named;
22
23
  async function selectOptions(select, values) {
23
24
  return selectOptionsBase.call(this, true, select, values);
24
25
  }
@@ -82,15 +83,15 @@ async function selectOptionsBase(newValue, select, values) {
82
83
  await wait(this.config);
83
84
  }
84
85
  } else if (selectedOptions.length === 1) {
85
- const withPointerEvents1 = this.config.pointerEventsCheck === 0 ? true : hasPointerEvents(this, select);
86
+ const withPointerEvents = this.config.pointerEventsCheck === 0 ? true : hasPointerEvents(this, select);
86
87
  // the click to open the select options
87
- if (withPointerEvents1) {
88
+ if (withPointerEvents) {
88
89
  await this.click(select);
89
90
  } else {
90
91
  focusElement(select);
91
92
  }
92
93
  selectOption(selectedOptions[0]);
93
- if (withPointerEvents1) {
94
+ if (withPointerEvents) {
94
95
  // the browser triggers another click event on the select for the click on the option
95
96
  // this second click has no 'down' phase
96
97
  this.dispatchUIEvent(select, 'pointerover');
@@ -106,9 +107,9 @@ async function selectOptionsBase(newValue, select, values) {
106
107
  throw getConfig().getElementError(`Cannot select multiple options on a non-multiple select`, select);
107
108
  }
108
109
  } else if (select.getAttribute('role') === 'listbox') {
109
- for (const option1 of selectedOptions){
110
- await this.click(option1);
111
- await this.unhover(option1);
110
+ for (const option of selectedOptions){
111
+ await this.click(option);
112
+ await this.unhover(option);
112
113
  }
113
114
  } else {
114
115
  throw getConfig().getElementError(`Cannot select options on elements that are neither select nor listbox elements`, select);
@@ -9,7 +9,7 @@ import '../utils/misc/level.js';
9
9
  import '../options.js';
10
10
  import { setSelectionRange } from '../event/selection/setSelectionRange.js';
11
11
 
12
- async function type(element, text, { skipClick =this.config.skipClick , skipAutoClose =this.config.skipAutoClose , initialSelectionStart , initialSelectionEnd } = {}) {
12
+ async function type(element, text, { skipClick = this.config.skipClick, skipAutoClose = this.config.skipAutoClose, initialSelectionStart, initialSelectionEnd } = {}) {
13
13
  // TODO: properly type guard
14
14
  // we use this workaround for now to prevent changing behavior
15
15
  if (element.disabled) return;
@@ -23,11 +23,11 @@ async function upload(element, fileOrFiles) {
23
23
  fileOrFiles
24
24
  ]).filter((file)=>!this.config.applyAccept || isAcceptableFile(file, input.accept)).slice(0, input.multiple ? undefined : 1);
25
25
  const fileDialog = ()=>{
26
- var ref;
26
+ var _input_files;
27
27
  // do not fire an input event if the file selection does not change
28
- if (files.length === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.length) && files.every((f, i)=>{
29
- var ref;
30
- return f === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.item(i));
28
+ if (files.length === ((_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files.length) && files.every((f, i)=>{
29
+ var _input_files;
30
+ return f === ((_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files.item(i));
31
31
  })) {
32
32
  return;
33
33
  }
@@ -3,13 +3,26 @@ import { readBlobText } from './Blob.js';
3
3
  import { createDataTransfer, getBlobFromDataTransferItem } from './DataTransfer.js';
4
4
 
5
5
  // Clipboard is not available in jsdom
6
+ function _define_property(obj, key, value) {
7
+ if (key in obj) {
8
+ Object.defineProperty(obj, key, {
9
+ value: value,
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ } else {
15
+ obj[key] = value;
16
+ }
17
+ return obj;
18
+ }
6
19
  // MDN lists string|Blob|Promise<Blob|string> as possible types in ClipboardItemData
7
20
  // lib.dom.d.ts lists only Promise<Blob|string>
8
21
  // https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem/ClipboardItem#syntax
9
22
  function createClipboardItem(window, ...blobs) {
10
23
  const dataMap = Object.fromEntries(blobs.map((b)=>[
11
24
  typeof b === 'string' ? 'text/plain' : b.type,
12
- Promise.resolve(b),
25
+ Promise.resolve(b)
13
26
  ]));
14
27
  // use real ClipboardItem if available
15
28
  /* istanbul ignore if */ if (typeof window.ClipboardItem !== 'undefined') {
@@ -31,6 +44,7 @@ function createClipboardItem(window, ...blobs) {
31
44
  });
32
45
  }
33
46
  constructor(d){
47
+ _define_property(this, "data", void 0);
34
48
  this.data = d;
35
49
  }
36
50
  }(dataMap);
@@ -61,15 +75,14 @@ function createClipboardStub(window, control) {
61
75
  }
62
76
  constructor(...args){
63
77
  super(...args);
64
- this.items = [];
78
+ _define_property(this, "items", []);
65
79
  }
66
80
  }(), {
67
81
  [ClipboardStubControl]: control
68
82
  });
69
83
  }
70
84
  function isClipboardStub(clipboard) {
71
- var ref;
72
- return !!((ref = clipboard) === null || ref === void 0 ? void 0 : ref[ClipboardStubControl]);
85
+ return !!(clipboard === null || clipboard === void 0 ? void 0 : clipboard[ClipboardStubControl]);
73
86
  }
74
87
  function attachClipboardStubToView(window) {
75
88
  if (isClipboardStub(window.navigator.clipboard)) {
@@ -139,11 +152,12 @@ async function writeDataTransferToClipboard(document, clipboardData) {
139
152
  throw new Error('The Clipboard API is unavailable.');
140
153
  }
141
154
  }
142
- /* istanbul ignore else */ if (typeof globalThis.afterEach === 'function') {
143
- globalThis.afterEach(()=>resetClipboardStubOnView(globalThis.window));
155
+ const g = globalThis;
156
+ /* istanbul ignore else */ if (typeof g.afterEach === 'function') {
157
+ g.afterEach(()=>resetClipboardStubOnView(globalThis.window));
144
158
  }
145
- /* istanbul ignore else */ if (typeof globalThis.afterAll === 'function') {
146
- globalThis.afterAll(()=>detachClipboardStubFromView(globalThis.window));
159
+ /* istanbul ignore else */ if (typeof g.afterAll === 'function') {
160
+ g.afterAll(()=>detachClipboardStubFromView(globalThis.window));
147
161
  }
148
162
 
149
163
  export { attachClipboardStubToView, createClipboardItem, detachClipboardStubFromView, readDataTransferFromClipboard, resetClipboardStubOnView, writeDataTransferToClipboard };
@@ -1,5 +1,18 @@
1
1
  import { createFileList } from './FileList.js';
2
2
 
3
+ function _define_property(obj, key, value) {
4
+ if (key in obj) {
5
+ Object.defineProperty(obj, key, {
6
+ value: value,
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true
10
+ });
11
+ } else {
12
+ obj[key] = value;
13
+ }
14
+ return obj;
15
+ }
3
16
  // DataTransfer is not implemented in jsdom.
4
17
  // DataTransfer with FileList is being created by the browser on certain events.
5
18
  class DataTransferItemStub {
@@ -15,8 +28,10 @@ class DataTransferItemStub {
15
28
  throw new Error('not implemented');
16
29
  }
17
30
  constructor(dataOrFile, type){
18
- this.file = null;
19
- this.data = undefined;
31
+ _define_property(this, "kind", void 0);
32
+ _define_property(this, "type", void 0);
33
+ _define_property(this, "file", null);
34
+ _define_property(this, "data", undefined);
20
35
  if (typeof dataOrFile === 'string') {
21
36
  this.kind = 'string';
22
37
  this.type = String(type);
@@ -51,8 +66,8 @@ function getTypeMatcher(type, exact) {
51
66
  function createDataTransferStub(window) {
52
67
  return new class DataTransferStub {
53
68
  getData(format) {
54
- var ref;
55
- const match = (ref = this.items.find(getTypeMatcher(format, true))) !== null && ref !== void 0 ? ref : this.items.find(getTypeMatcher(format, false));
69
+ var _this_items_find;
70
+ const match = (_this_items_find = this.items.find(getTypeMatcher(format, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(format, false));
56
71
  let text = '';
57
72
  match === null || match === void 0 ? void 0 : match.getAsString((t)=>{
58
73
  text = t;
@@ -89,10 +104,10 @@ function createDataTransferStub(window) {
89
104
  }
90
105
  /* istanbul ignore next */ setDragImage() {}
91
106
  constructor(){
92
- this.dropEffect = 'none';
93
- this.effectAllowed = 'uninitialized';
94
- this.items = new DataTransferItemListStub();
95
- this.files = createFileList(window, []);
107
+ _define_property(this, "dropEffect", 'none');
108
+ _define_property(this, "effectAllowed", 'uninitialized');
109
+ _define_property(this, "items", new DataTransferItemListStub());
110
+ _define_property(this, "files", createFileList(window, []));
96
111
  }
97
112
  }();
98
113
  }
@@ -12,8 +12,8 @@ var maxLengthSupportedTypes;
12
12
  // can't use .maxLength property because of a jsdom bug:
13
13
  // https://github.com/jsdom/jsdom/issues/2927
14
14
  function getMaxLength(element) {
15
- var ref;
16
- const attr = (ref = element.getAttribute('maxlength')) !== null && ref !== void 0 ? ref : '';
15
+ var _element_getAttribute;
16
+ const attr = (_element_getAttribute = element.getAttribute('maxlength')) !== null && _element_getAttribute !== void 0 ? _element_getAttribute : '';
17
17
  return /^\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : undefined;
18
18
  }
19
19
  function supportsMaxLength(element) {
@@ -11,8 +11,8 @@ function restoreProperty(obj, prop, descriptor) {
11
11
  }
12
12
  }
13
13
  function setFiles(el, files) {
14
- var ref;
15
- (ref = el[fakeFiles]) === null || ref === void 0 ? void 0 : ref.restore();
14
+ var _el_fakeFiles;
15
+ (_el_fakeFiles = el[fakeFiles]) === null || _el_fakeFiles === void 0 ? void 0 : _el_fakeFiles.restore();
16
16
  const typeDescr = Object.getOwnPropertyDescriptor(el, 'type');
17
17
  const valueDescr = Object.getOwnPropertyDescriptor(el, 'value');
18
18
  const filesDescr = Object.getOwnPropertyDescriptor(el, 'files');
@@ -36,8 +36,8 @@ function setFiles(el, files) {
36
36
  if (v === '') {
37
37
  restore();
38
38
  } else {
39
- var ref;
40
- valueDescr === null || valueDescr === void 0 ? void 0 : (ref = valueDescr.set) === null || ref === void 0 ? void 0 : ref.call(el, v);
39
+ var _valueDescr_set;
40
+ valueDescr === null || valueDescr === void 0 ? void 0 : (_valueDescr_set = valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
41
41
  }
42
42
  }
43
43
  },
@@ -100,14 +100,14 @@ function isTextNode(node) {
100
100
  }
101
101
  function walkNodes(node, direction, callback) {
102
102
  for(;;){
103
- var ref;
103
+ var _node_ownerDocument;
104
104
  const sibling = node[`${direction}Sibling`];
105
105
  if (sibling) {
106
106
  node = getDescendant(sibling, direction === 'next' ? 'first' : 'last');
107
107
  if (callback(node)) {
108
108
  return node;
109
109
  }
110
- } else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== ((ref = node.ownerDocument) === null || ref === void 0 ? void 0 : ref.body))) {
110
+ } else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== ((_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.body))) {
111
111
  node = node.parentNode;
112
112
  } else {
113
113
  break;
@@ -13,8 +13,8 @@ function getActiveElement(document) {
13
13
  }
14
14
  }
15
15
  function getActiveElementOrBody(document) {
16
- var ref;
17
- return (ref = getActiveElement(document)) !== null && ref !== void 0 ? ref : /* istanbul ignore next */ document.body;
16
+ var _getActiveElement;
17
+ return (_getActiveElement = getActiveElement(document)) !== null && _getActiveElement !== void 0 ? _getActiveElement : /* istanbul ignore next */ document.body;
18
18
  }
19
19
 
20
20
  export { getActiveElement, getActiveElementOrBody };
@@ -6,7 +6,7 @@ const FOCUSABLE_SELECTOR = [
6
6
  '[contenteditable=""]',
7
7
  '[contenteditable="true"]',
8
8
  'a[href]',
9
- '[tabindex]:not([disabled])',
9
+ '[tabindex]:not([disabled])'
10
10
  ].join(', ');
11
11
 
12
12
  export { FOCUSABLE_SELECTOR };
@@ -37,16 +37,16 @@ function readPrintableChar(text, pos, context) {
37
37
  };
38
38
  }
39
39
  function readTag(text, pos, startBracket, context) {
40
- var ref, ref1;
40
+ var _text_slice_match, _text_slice_match1;
41
41
  const releasePreviousModifier = text[pos] === '/' ? '/' : '';
42
42
  pos += releasePreviousModifier.length;
43
43
  const escapedDescriptor = startBracket === '{' && text[pos] === '\\';
44
44
  pos += Number(escapedDescriptor);
45
- const descriptor = escapedDescriptor ? text[pos] : (ref = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || ref === void 0 ? void 0 : ref[0];
45
+ const descriptor = escapedDescriptor ? text[pos] : (_text_slice_match = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || _text_slice_match === void 0 ? void 0 : _text_slice_match[0];
46
46
  assertDescriptor(descriptor, text, pos, context);
47
47
  pos += descriptor.length;
48
- var ref2;
49
- const repeatModifier = (ref2 = (ref1 = text.slice(pos).match(/^>\d+/)) === null || ref1 === void 0 ? void 0 : ref1[0]) !== null && ref2 !== void 0 ? ref2 : '';
48
+ var _text_slice_match_;
49
+ const repeatModifier = (_text_slice_match_ = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === void 0 ? void 0 : _text_slice_match1[0]) !== null && _text_slice_match_ !== void 0 ? _text_slice_match_ : '';
50
50
  pos += repeatModifier.length;
51
51
  const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : '';
52
52
  pos += releaseSelfModifier.length;
@@ -56,7 +56,7 @@ function readTag(text, pos, startBracket, context) {
56
56
  throw new Error(getErrorMessage([
57
57
  !repeatModifier && 'repeat modifier',
58
58
  !releaseSelfModifier && 'release modifier',
59
- `"${expectedEndBracket}"`,
59
+ `"${expectedEndBracket}"`
60
60
  ].filter(Boolean).join(' or '), text[pos], text, context));
61
61
  }
62
62
  pos += endBracket.length;
@@ -4,8 +4,8 @@ function getTreeDiff(a, b) {
4
4
  treeA.push(el);
5
5
  }
6
6
  const treeB = [];
7
- for(let el1 = b; el1; el1 = el1.parentElement){
8
- treeB.push(el1);
7
+ for(let el = b; el; el = el.parentElement){
8
+ treeB.push(el);
9
9
  }
10
10
  let i = 0;
11
11
  for(;; i++){
@@ -16,7 +16,7 @@ function getTreeDiff(a, b) {
16
16
  return [
17
17
  treeA.slice(0, treeA.length - i),
18
18
  treeB.slice(0, treeB.length - i),
19
- treeB.slice(treeB.length - i),
19
+ treeB.slice(treeB.length - i)
20
20
  ];
21
21
  }
22
22
 
@@ -1,5 +1,6 @@
1
- import { getWindowFromNode } from '@testing-library/dom/dist/helpers.js';
1
+ import * as named from '@testing-library/dom/dist/helpers.js';
2
2
 
3
+ const { getWindowFromNode } = named;
3
4
  function getWindow(node) {
4
5
  return getWindowFromNode(node);
5
6
  }
@@ -9,14 +9,14 @@ function isDisabled(element) {
9
9
  'select',
10
10
  'textarea',
11
11
  'optgroup',
12
- 'option',
12
+ 'option'
13
13
  ])) {
14
14
  if (el.hasAttribute('disabled')) {
15
15
  return true;
16
16
  }
17
17
  } else if (isElementType(el, 'fieldset')) {
18
- var ref;
19
- if (el.hasAttribute('disabled') && !((ref = el.querySelector(':scope > legend')) === null || ref === void 0 ? void 0 : ref.contains(element))) {
18
+ var _el_querySelector;
19
+ if (el.hasAttribute('disabled') && !((_el_querySelector = el.querySelector(':scope > legend')) === null || _el_querySelector === void 0 ? void 0 : _el_querySelector.contains(element))) {
20
20
  return true;
21
21
  }
22
22
  } else if (el.tagName.includes('-')) {
@@ -3,7 +3,7 @@ import { getWindow } from './getWindow.js';
3
3
  function isVisible(element) {
4
4
  const window = getWindow(element);
5
5
  for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
6
- const { display , visibility } = window.getComputedStyle(el);
6
+ const { display, visibility } = window.getComputedStyle(el);
7
7
  if (display === 'none') {
8
8
  return false;
9
9
  }