@testing-library/user-event 14.0.1 → 14.0.4
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.
- package/dist/index.cjs +141 -118
- package/dist/index.mjs +141 -118
- package/dist/types/utils/dataTransfer/Blob.d.ts +3 -1
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
- package/dist/types/utils/dataTransfer/DataTransfer.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/misc/getWindow.d.ts +1 -0
- package/package.json +8 -5
package/dist/index.cjs
CHANGED
|
@@ -72,7 +72,7 @@ function isClickableInput(element) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/utils/dataTransfer/Blob.ts
|
|
75
|
-
function readBlobText(blob) {
|
|
75
|
+
function readBlobText(blob, FileReader) {
|
|
76
76
|
return new Promise((res, rej) => {
|
|
77
77
|
const fr = new FileReader();
|
|
78
78
|
fr.onerror = rej;
|
|
@@ -156,8 +156,8 @@ var DataTransferStub = class {
|
|
|
156
156
|
this.files = createFileList([]);
|
|
157
157
|
}
|
|
158
158
|
getData(format) {
|
|
159
|
-
var
|
|
160
|
-
const match = (
|
|
159
|
+
var _a3;
|
|
160
|
+
const match = (_a3 = this.items.find(getTypeMatcher(format, true))) != null ? _a3 : this.items.find(getTypeMatcher(format, false));
|
|
161
161
|
let text = "";
|
|
162
162
|
match == null ? void 0 : match.getAsString((t) => {
|
|
163
163
|
text = t;
|
|
@@ -195,12 +195,12 @@ var DataTransferStub = class {
|
|
|
195
195
|
setDragImage() {
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
-
function createDataTransfer(files = []) {
|
|
199
|
-
const dt = typeof DataTransfer === "undefined" ? new DataTransferStub() : new DataTransfer();
|
|
198
|
+
function createDataTransfer(window2, files = []) {
|
|
199
|
+
const dt = typeof window2.DataTransfer === "undefined" ? new DataTransferStub() : new window2.DataTransfer();
|
|
200
200
|
Object.defineProperty(dt, "files", { get: () => createFileList(files) });
|
|
201
201
|
return dt;
|
|
202
202
|
}
|
|
203
|
-
function getBlobFromDataTransferItem(item) {
|
|
203
|
+
function getBlobFromDataTransferItem(window2, item) {
|
|
204
204
|
if (item.kind === "file") {
|
|
205
205
|
return item.getAsFile();
|
|
206
206
|
}
|
|
@@ -208,12 +208,21 @@ function getBlobFromDataTransferItem(item) {
|
|
|
208
208
|
item.getAsString((s) => {
|
|
209
209
|
data = s;
|
|
210
210
|
});
|
|
211
|
-
return new Blob([data], { type: item.type });
|
|
211
|
+
return new window2.Blob([data], { type: item.type });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/utils/misc/getWindow.ts
|
|
215
|
+
var import_helpers = require("@testing-library/dom/dist/helpers.js");
|
|
216
|
+
function getWindow(node) {
|
|
217
|
+
return (0, import_helpers.getWindowFromNode)(node);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
// src/utils/dataTransfer/Clipboard.ts
|
|
221
|
+
var Window = Symbol("Window reference");
|
|
222
|
+
var _a;
|
|
215
223
|
var ClipboardItemStub = class {
|
|
216
224
|
constructor(data) {
|
|
225
|
+
this[_a] = window;
|
|
217
226
|
this.data = data;
|
|
218
227
|
}
|
|
219
228
|
get types() {
|
|
@@ -224,14 +233,17 @@ var ClipboardItemStub = class {
|
|
|
224
233
|
if (!data) {
|
|
225
234
|
throw new Error(`${type3} is not one of the available MIME types on this item.`);
|
|
226
235
|
}
|
|
227
|
-
return data instanceof Blob ? data : new Blob([data], { type: type3 });
|
|
236
|
+
return data instanceof this[Window].Blob ? data : new this[Window].Blob([data], { type: type3 });
|
|
228
237
|
}
|
|
229
238
|
};
|
|
239
|
+
_a = Window;
|
|
230
240
|
var ClipboardStubControl = Symbol("Manage ClipboardSub");
|
|
231
|
-
var
|
|
241
|
+
var _a2;
|
|
242
|
+
var ClipboardStub = class extends window.EventTarget {
|
|
232
243
|
constructor() {
|
|
233
244
|
super(...arguments);
|
|
234
245
|
this.items = [];
|
|
246
|
+
this[_a2] = window;
|
|
235
247
|
}
|
|
236
248
|
async read() {
|
|
237
249
|
return Array.from(this.items);
|
|
@@ -241,7 +253,7 @@ var ClipboardStub = class extends EventTarget {
|
|
|
241
253
|
for (const item of this.items) {
|
|
242
254
|
const type3 = item.types.includes("text/plain") ? "text/plain" : item.types.find((t) => t.startsWith("text/"));
|
|
243
255
|
if (type3) {
|
|
244
|
-
text += await item.getType(type3).then((b) => readBlobText(b));
|
|
256
|
+
text += await item.getType(type3).then((b) => readBlobText(b, this[Window].FileReader));
|
|
245
257
|
}
|
|
246
258
|
}
|
|
247
259
|
return text;
|
|
@@ -250,16 +262,22 @@ var ClipboardStub = class extends EventTarget {
|
|
|
250
262
|
this.items = data;
|
|
251
263
|
}
|
|
252
264
|
async writeText(text) {
|
|
253
|
-
this.items = [createClipboardItem(text)];
|
|
265
|
+
this.items = [createClipboardItem(this[Window], text)];
|
|
254
266
|
}
|
|
255
267
|
};
|
|
256
|
-
ClipboardStubControl;
|
|
257
|
-
function createClipboardItem(...blobs) {
|
|
258
|
-
const
|
|
259
|
-
return new constructor(Object.fromEntries(blobs.map((b) => [
|
|
268
|
+
_a2 = Window, ClipboardStubControl;
|
|
269
|
+
function createClipboardItem(window2, ...blobs) {
|
|
270
|
+
const data = Object.fromEntries(blobs.map((b) => [
|
|
260
271
|
typeof b === "string" ? "text/plain" : b.type,
|
|
261
272
|
Promise.resolve(b)
|
|
262
|
-
]))
|
|
273
|
+
]));
|
|
274
|
+
if (typeof window2.ClipboardItem === "undefined") {
|
|
275
|
+
const item = new ClipboardItemStub(data);
|
|
276
|
+
item[Window] = window2;
|
|
277
|
+
return item;
|
|
278
|
+
} else {
|
|
279
|
+
return new window2.ClipboardItem(data);
|
|
280
|
+
}
|
|
263
281
|
}
|
|
264
282
|
function attachClipboardStubToView(window2) {
|
|
265
283
|
if (window2.navigator.clipboard instanceof ClipboardStub) {
|
|
@@ -267,9 +285,11 @@ function attachClipboardStubToView(window2) {
|
|
|
267
285
|
}
|
|
268
286
|
const realClipboard = Object.getOwnPropertyDescriptor(window2.navigator, "clipboard");
|
|
269
287
|
let stub = new ClipboardStub();
|
|
288
|
+
stub[Window] = window2;
|
|
270
289
|
const control = {
|
|
271
290
|
resetClipboardStub: () => {
|
|
272
291
|
stub = new ClipboardStub();
|
|
292
|
+
stub[Window] = window2;
|
|
273
293
|
stub[ClipboardStubControl] = control;
|
|
274
294
|
},
|
|
275
295
|
detachClipboardStub: () => {
|
|
@@ -301,28 +321,28 @@ function detachClipboardStubFromView(window2) {
|
|
|
301
321
|
}
|
|
302
322
|
}
|
|
303
323
|
async function readDataTransferFromClipboard(document2) {
|
|
304
|
-
|
|
305
|
-
const clipboard =
|
|
324
|
+
const window2 = document2.defaultView;
|
|
325
|
+
const clipboard = window2 == null ? void 0 : window2.navigator.clipboard;
|
|
306
326
|
const items = clipboard && await clipboard.read();
|
|
307
327
|
if (!items) {
|
|
308
328
|
throw new Error("The Clipboard API is unavailable.");
|
|
309
329
|
}
|
|
310
|
-
const dt = createDataTransfer();
|
|
330
|
+
const dt = createDataTransfer(window2);
|
|
311
331
|
for (const item of items) {
|
|
312
332
|
for (const type3 of item.types) {
|
|
313
|
-
dt.setData(type3, await item.getType(type3).then((b) => readBlobText(b)));
|
|
333
|
+
dt.setData(type3, await item.getType(type3).then((b) => readBlobText(b, window2.FileReader)));
|
|
314
334
|
}
|
|
315
335
|
}
|
|
316
336
|
return dt;
|
|
317
337
|
}
|
|
318
338
|
async function writeDataTransferToClipboard(document2, clipboardData) {
|
|
319
|
-
|
|
320
|
-
const clipboard =
|
|
339
|
+
const window2 = getWindow(document2);
|
|
340
|
+
const clipboard = window2.navigator.clipboard;
|
|
321
341
|
const items = [];
|
|
322
342
|
for (let i = 0; i < clipboardData.items.length; i++) {
|
|
323
343
|
const dtItem = clipboardData.items[i];
|
|
324
|
-
const blob = getBlobFromDataTransferItem(dtItem);
|
|
325
|
-
items.push(createClipboardItem(blob));
|
|
344
|
+
const blob = getBlobFromDataTransferItem(window2, dtItem);
|
|
345
|
+
items.push(createClipboardItem(window2, blob));
|
|
326
346
|
}
|
|
327
347
|
const written = clipboard && await clipboard.write(items).then(() => true, () => false);
|
|
328
348
|
if (!written) {
|
|
@@ -416,11 +436,11 @@ function getSpaceUntilMaxLength(element) {
|
|
|
416
436
|
return maxLength ? maxLength - value.length : void 0;
|
|
417
437
|
}
|
|
418
438
|
function getSanitizedMaxLength(element) {
|
|
419
|
-
var
|
|
439
|
+
var _a3;
|
|
420
440
|
if (!supportsMaxLength(element)) {
|
|
421
441
|
return void 0;
|
|
422
442
|
}
|
|
423
|
-
const attr = (
|
|
443
|
+
const attr = (_a3 = element.getAttribute("maxlength")) != null ? _a3 : "";
|
|
424
444
|
return /^\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : void 0;
|
|
425
445
|
}
|
|
426
446
|
function supportsMaxLength(element) {
|
|
@@ -557,9 +577,9 @@ function commitInput(config, element, newOffset, inputInit) {
|
|
|
557
577
|
}
|
|
558
578
|
}
|
|
559
579
|
function isValidNumberInput(value) {
|
|
560
|
-
var
|
|
580
|
+
var _a3, _b;
|
|
561
581
|
const valueParts = value.split("e", 2);
|
|
562
|
-
return !(/[^\d.\-e]/.test(value) || Number((
|
|
582
|
+
return !(/[^\d.\-e]/.test(value) || Number((_a3 = value.match(/-/g)) == null ? void 0 : _a3.length) > 2 || Number((_b = value.match(/\./g)) == null ? void 0 : _b.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
|
|
563
583
|
}
|
|
564
584
|
|
|
565
585
|
// src/utils/edit/isEditable.ts
|
|
@@ -588,8 +608,8 @@ function isEditableInput(element) {
|
|
|
588
608
|
// src/utils/edit/setFiles.ts
|
|
589
609
|
var fakeFiles = Symbol("files and value properties are mocked");
|
|
590
610
|
function setFiles(el, files) {
|
|
591
|
-
var
|
|
592
|
-
(
|
|
611
|
+
var _a3;
|
|
612
|
+
(_a3 = el[fakeFiles]) == null ? void 0 : _a3.restore();
|
|
593
613
|
const objectDescriptors = Object.getOwnPropertyDescriptors(el);
|
|
594
614
|
const prototypeDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(el));
|
|
595
615
|
function restore() {
|
|
@@ -607,11 +627,11 @@ function setFiles(el, files) {
|
|
|
607
627
|
value: __spreadProps(__spreadValues(__spreadValues({}, prototypeDescriptors.value), objectDescriptors.value), {
|
|
608
628
|
get: () => files.length ? `C:\\fakepath\\${files[0].name}` : "",
|
|
609
629
|
set(v) {
|
|
610
|
-
var
|
|
630
|
+
var _a4;
|
|
611
631
|
if (v === "") {
|
|
612
632
|
restore();
|
|
613
633
|
} else {
|
|
614
|
-
(
|
|
634
|
+
(_a4 = objectDescriptors.value.set) == null ? void 0 : _a4.call(el, v);
|
|
615
635
|
}
|
|
616
636
|
}
|
|
617
637
|
}),
|
|
@@ -638,7 +658,7 @@ function eventWrapper(cb) {
|
|
|
638
658
|
|
|
639
659
|
// src/utils/misc/isDisabled.ts
|
|
640
660
|
function isDisabled(element) {
|
|
641
|
-
var
|
|
661
|
+
var _a3;
|
|
642
662
|
for (let el = element; el; el = el.parentElement) {
|
|
643
663
|
if (isElementType(el, [
|
|
644
664
|
"button",
|
|
@@ -652,7 +672,7 @@ function isDisabled(element) {
|
|
|
652
672
|
return true;
|
|
653
673
|
}
|
|
654
674
|
} else if (isElementType(el, "fieldset")) {
|
|
655
|
-
if (el.hasAttribute("disabled") && !((
|
|
675
|
+
if (el.hasAttribute("disabled") && !((_a3 = el.querySelector(":scope > legend")) == null ? void 0 : _a3.contains(element))) {
|
|
656
676
|
return true;
|
|
657
677
|
}
|
|
658
678
|
} else if (el.tagName.includes("-")) {
|
|
@@ -785,7 +805,7 @@ function isTextNode(node) {
|
|
|
785
805
|
return node.nodeType === 3;
|
|
786
806
|
}
|
|
787
807
|
function walkNodes(node, direction, callback) {
|
|
788
|
-
var
|
|
808
|
+
var _a3;
|
|
789
809
|
for (; ; ) {
|
|
790
810
|
const sibling = node[`${direction}Sibling`];
|
|
791
811
|
if (sibling) {
|
|
@@ -793,7 +813,7 @@ function walkNodes(node, direction, callback) {
|
|
|
793
813
|
if (callback(node)) {
|
|
794
814
|
return node;
|
|
795
815
|
}
|
|
796
|
-
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== ((
|
|
816
|
+
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== ((_a3 = node.ownerDocument) == null ? void 0 : _a3.body))) {
|
|
797
817
|
node = node.parentNode;
|
|
798
818
|
} else {
|
|
799
819
|
break;
|
|
@@ -809,7 +829,7 @@ function getDescendant(node, direction) {
|
|
|
809
829
|
|
|
810
830
|
// src/utils/focus/selection.ts
|
|
811
831
|
function setSelectionRange(element, anchorOffset, focusOffset) {
|
|
812
|
-
var
|
|
832
|
+
var _a3;
|
|
813
833
|
if (hasOwnSelection(element)) {
|
|
814
834
|
return setSelection({
|
|
815
835
|
focusNode: element,
|
|
@@ -817,7 +837,7 @@ function setSelectionRange(element, anchorOffset, focusOffset) {
|
|
|
817
837
|
focusOffset
|
|
818
838
|
});
|
|
819
839
|
}
|
|
820
|
-
if (isContentEditable(element) && ((
|
|
840
|
+
if (isContentEditable(element) && ((_a3 = element.firstChild) == null ? void 0 : _a3.nodeType) === 3) {
|
|
821
841
|
return setSelection({
|
|
822
842
|
focusNode: element.firstChild,
|
|
823
843
|
anchorOffset,
|
|
@@ -851,7 +871,7 @@ function getElement2(node) {
|
|
|
851
871
|
return node.nodeType === 1 ? node : node.parentElement;
|
|
852
872
|
}
|
|
853
873
|
function updateSelectionOnFocus(element) {
|
|
854
|
-
var
|
|
874
|
+
var _a3;
|
|
855
875
|
const selection = element.ownerDocument.getSelection();
|
|
856
876
|
if (!(selection == null ? void 0 : selection.focusNode)) {
|
|
857
877
|
return;
|
|
@@ -860,7 +880,7 @@ function updateSelectionOnFocus(element) {
|
|
|
860
880
|
const contenteditable = getContentEditable(selection.focusNode);
|
|
861
881
|
if (contenteditable) {
|
|
862
882
|
if (!selection.isCollapsed) {
|
|
863
|
-
const focusNode = ((
|
|
883
|
+
const focusNode = ((_a3 = contenteditable.firstChild) == null ? void 0 : _a3.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
|
|
864
884
|
selection.setBaseAndExtent(focusNode, 0, focusNode, 0);
|
|
865
885
|
}
|
|
866
886
|
} else {
|
|
@@ -869,12 +889,12 @@ function updateSelectionOnFocus(element) {
|
|
|
869
889
|
}
|
|
870
890
|
}
|
|
871
891
|
function getInputRange(focusNode) {
|
|
872
|
-
var
|
|
892
|
+
var _a3;
|
|
873
893
|
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
874
894
|
if (typeAndSelection.type === "input") {
|
|
875
895
|
return typeAndSelection.selection;
|
|
876
896
|
} else if (typeAndSelection.type === "contenteditable") {
|
|
877
|
-
return (
|
|
897
|
+
return (_a3 = typeAndSelection.selection) == null ? void 0 : _a3.getRangeAt(0);
|
|
878
898
|
}
|
|
879
899
|
}
|
|
880
900
|
function setSelection({
|
|
@@ -883,7 +903,7 @@ function setSelection({
|
|
|
883
903
|
anchorNode = focusNode,
|
|
884
904
|
anchorOffset = focusOffset
|
|
885
905
|
}) {
|
|
886
|
-
var
|
|
906
|
+
var _a3, _b;
|
|
887
907
|
const typeAndSelection = getTargetTypeAndSelection(focusNode);
|
|
888
908
|
if (typeAndSelection.type === "input") {
|
|
889
909
|
return setUISelection(focusNode, {
|
|
@@ -891,7 +911,7 @@ function setSelection({
|
|
|
891
911
|
focusOffset
|
|
892
912
|
});
|
|
893
913
|
}
|
|
894
|
-
(_b = (
|
|
914
|
+
(_b = (_a3 = anchorNode.ownerDocument) == null ? void 0 : _a3.getSelection()) == null ? void 0 : _b.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
895
915
|
}
|
|
896
916
|
function moveSelection(node, direction) {
|
|
897
917
|
if (hasOwnSelection(node)) {
|
|
@@ -922,7 +942,7 @@ function moveSelection(node, direction) {
|
|
|
922
942
|
// src/utils/focus/copySelection.ts
|
|
923
943
|
function copySelection(target) {
|
|
924
944
|
const data = hasOwnSelection(target) ? { "text/plain": readSelectedValueFromInput(target) } : { "text/plain": String(target.ownerDocument.getSelection()) };
|
|
925
|
-
const dt = createDataTransfer();
|
|
945
|
+
const dt = createDataTransfer(getWindow(target));
|
|
926
946
|
for (const type3 in data) {
|
|
927
947
|
if (data[type3]) {
|
|
928
948
|
dt.setData(type3, data[type3]);
|
|
@@ -963,9 +983,8 @@ function focus(element) {
|
|
|
963
983
|
}
|
|
964
984
|
|
|
965
985
|
// src/utils/misc/isVisible.ts
|
|
966
|
-
var import_helpers = require("@testing-library/dom/dist/helpers.js");
|
|
967
986
|
function isVisible(element) {
|
|
968
|
-
const window2 = (
|
|
987
|
+
const window2 = getWindow(element);
|
|
969
988
|
for (let el = element; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
970
989
|
const { display, visibility } = window2.getComputedStyle(el);
|
|
971
990
|
if (display === "none") {
|
|
@@ -1031,7 +1050,7 @@ function getTabDestination(activeElement, shift) {
|
|
|
1031
1050
|
|
|
1032
1051
|
// src/utils/focus/selectAll.ts
|
|
1033
1052
|
function selectAll(target) {
|
|
1034
|
-
var
|
|
1053
|
+
var _a3;
|
|
1035
1054
|
if (isElementType(target, "textarea") || isElementType(target, "input") && target.type in editableInputTypes) {
|
|
1036
1055
|
return setSelection({
|
|
1037
1056
|
focusNode: target,
|
|
@@ -1039,7 +1058,7 @@ function selectAll(target) {
|
|
|
1039
1058
|
focusOffset: getUIValue(target).length
|
|
1040
1059
|
});
|
|
1041
1060
|
}
|
|
1042
|
-
const focusNode = (
|
|
1061
|
+
const focusNode = (_a3 = getContentEditable(target)) != null ? _a3 : target.ownerDocument.body;
|
|
1043
1062
|
setSelection({
|
|
1044
1063
|
focusNode,
|
|
1045
1064
|
anchorOffset: 0,
|
|
@@ -1047,11 +1066,11 @@ function selectAll(target) {
|
|
|
1047
1066
|
});
|
|
1048
1067
|
}
|
|
1049
1068
|
function isAllSelected(target) {
|
|
1050
|
-
var
|
|
1069
|
+
var _a3;
|
|
1051
1070
|
if (isElementType(target, "textarea") || isElementType(target, "input") && target.type in editableInputTypes) {
|
|
1052
1071
|
return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;
|
|
1053
1072
|
}
|
|
1054
|
-
const focusNode = (
|
|
1073
|
+
const focusNode = (_a3 = getContentEditable(target)) != null ? _a3 : target.ownerDocument.body;
|
|
1055
1074
|
const selection = target.ownerDocument.getSelection();
|
|
1056
1075
|
return (selection == null ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
1057
1076
|
}
|
|
@@ -1111,12 +1130,12 @@ function readPrintableChar(text, pos, context) {
|
|
|
1111
1130
|
};
|
|
1112
1131
|
}
|
|
1113
1132
|
function readTag(text, pos, startBracket, context) {
|
|
1114
|
-
var
|
|
1133
|
+
var _a3, _b, _c;
|
|
1115
1134
|
const releasePreviousModifier = text[pos] === "/" ? "/" : "";
|
|
1116
1135
|
pos += releasePreviousModifier.length;
|
|
1117
1136
|
const escapedDescriptor = startBracket === "{" && text[pos] === "\\";
|
|
1118
1137
|
pos += Number(escapedDescriptor);
|
|
1119
|
-
const descriptor = escapedDescriptor ? text[pos] : (
|
|
1138
|
+
const descriptor = escapedDescriptor ? text[pos] : (_a3 = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) == null ? void 0 : _a3[0];
|
|
1120
1139
|
assertDescriptor(descriptor, text, pos, context);
|
|
1121
1140
|
pos += descriptor.length;
|
|
1122
1141
|
const repeatModifier = (_c = (_b = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _b[0]) != null ? _c : "";
|
|
@@ -1188,13 +1207,13 @@ function isDescendantOrSelf(potentialDescendant, potentialAncestor) {
|
|
|
1188
1207
|
// src/utils/misc/level.ts
|
|
1189
1208
|
var Level = Symbol("Api level refs");
|
|
1190
1209
|
function setLevelRef(config, level) {
|
|
1191
|
-
var
|
|
1192
|
-
(
|
|
1210
|
+
var _a3;
|
|
1211
|
+
(_a3 = config[Level]) != null ? _a3 : config[Level] = {};
|
|
1193
1212
|
config[Level][level] = {};
|
|
1194
1213
|
}
|
|
1195
1214
|
function getLevelRef(config, level) {
|
|
1196
|
-
var
|
|
1197
|
-
return (
|
|
1215
|
+
var _a3;
|
|
1216
|
+
return (_a3 = config[Level]) == null ? void 0 : _a3[level];
|
|
1198
1217
|
}
|
|
1199
1218
|
|
|
1200
1219
|
// src/utils/misc/wait.ts
|
|
@@ -1202,9 +1221,6 @@ function wait(time) {
|
|
|
1202
1221
|
return new Promise((resolve) => setTimeout(() => resolve(), time));
|
|
1203
1222
|
}
|
|
1204
1223
|
|
|
1205
|
-
// src/utils/pointer/cssPointerEvents.ts
|
|
1206
|
-
var import_helpers2 = require("@testing-library/dom/dist/helpers.js");
|
|
1207
|
-
|
|
1208
1224
|
// src/keyboard/keyMap.ts
|
|
1209
1225
|
var defaultKeyMap = [
|
|
1210
1226
|
..."0123456789".split("").map((c) => ({ code: `Digit${c}`, key: c })),
|
|
@@ -1298,7 +1314,7 @@ var defaultOptionsSetup = __spreadProps(__spreadValues({}, defaultOptionsDirect)
|
|
|
1298
1314
|
|
|
1299
1315
|
// src/utils/pointer/cssPointerEvents.ts
|
|
1300
1316
|
function hasPointerEvents(element) {
|
|
1301
|
-
const window2 = (
|
|
1317
|
+
const window2 = getWindow(element);
|
|
1302
1318
|
for (let el = element; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
1303
1319
|
const pointerEvents = window2.getComputedStyle(el).pointerEvents;
|
|
1304
1320
|
if (pointerEvents && !["inherit", "unset"].includes(pointerEvents)) {
|
|
@@ -1412,9 +1428,9 @@ function assignPositionInit(obj, {
|
|
|
1412
1428
|
screenX,
|
|
1413
1429
|
screenY
|
|
1414
1430
|
}) {
|
|
1415
|
-
var
|
|
1431
|
+
var _a3, _b, _c, _d;
|
|
1416
1432
|
assignProps(obj, {
|
|
1417
|
-
x: (
|
|
1433
|
+
x: (_a3 = x != null ? x : clientX) != null ? _a3 : 0,
|
|
1418
1434
|
y: (_b = y != null ? y : clientY) != null ? _b : 0,
|
|
1419
1435
|
clientX: (_c = x != null ? x : clientX) != null ? _c : 0,
|
|
1420
1436
|
clientY: (_d = y != null ? y : clientY) != null ? _d : 0,
|
|
@@ -1451,7 +1467,7 @@ behavior.click = (event, target, config) => {
|
|
|
1451
1467
|
} else if (isElementType(target, "input", { type: "file" })) {
|
|
1452
1468
|
return () => {
|
|
1453
1469
|
blur(target);
|
|
1454
|
-
target.dispatchEvent(new Event("fileDialog"));
|
|
1470
|
+
target.dispatchEvent(new (getWindow(target)).Event("fileDialog"));
|
|
1455
1471
|
focus(target);
|
|
1456
1472
|
};
|
|
1457
1473
|
}
|
|
@@ -1468,8 +1484,8 @@ behavior.cut = (event, target, config) => {
|
|
|
1468
1484
|
|
|
1469
1485
|
// src/event/behavior/keydown.ts
|
|
1470
1486
|
behavior.keydown = (event, target, config) => {
|
|
1471
|
-
var
|
|
1472
|
-
return (_b = (
|
|
1487
|
+
var _a3, _b;
|
|
1488
|
+
return (_b = (_a3 = keydownBehavior[event.key]) == null ? void 0 : _a3.call(keydownBehavior, event, target, config)) != null ? _b : combinationBehavior(event, target, config);
|
|
1473
1489
|
};
|
|
1474
1490
|
var keydownBehavior = {
|
|
1475
1491
|
ArrowLeft: (event, target) => () => moveSelection(target, -1),
|
|
@@ -1491,8 +1507,8 @@ var keydownBehavior = {
|
|
|
1491
1507
|
End: (event, target) => {
|
|
1492
1508
|
if (isElementType(target, ["input", "textarea"]) || isContentEditable(target)) {
|
|
1493
1509
|
return () => {
|
|
1494
|
-
var
|
|
1495
|
-
const newPos = (_b = (
|
|
1510
|
+
var _a3, _b;
|
|
1511
|
+
const newPos = (_b = (_a3 = getValue(target)) == null ? void 0 : _a3.length) != null ? _b : 0;
|
|
1496
1512
|
setSelectionRange(target, newPos, newPos);
|
|
1497
1513
|
};
|
|
1498
1514
|
}
|
|
@@ -1584,8 +1600,8 @@ var SubmitSingleInputOnEnter = [
|
|
|
1584
1600
|
|
|
1585
1601
|
// src/event/behavior/keyup.ts
|
|
1586
1602
|
behavior.keyup = (event, target, config) => {
|
|
1587
|
-
var
|
|
1588
|
-
return (
|
|
1603
|
+
var _a3;
|
|
1604
|
+
return (_a3 = keyupBehavior[event.key]) == null ? void 0 : _a3.call(keyupBehavior, event, target, config);
|
|
1589
1605
|
};
|
|
1590
1606
|
var keyupBehavior = {
|
|
1591
1607
|
" ": (event, target, config) => {
|
|
@@ -1599,8 +1615,8 @@ var keyupBehavior = {
|
|
|
1599
1615
|
behavior.paste = (event, target, config) => {
|
|
1600
1616
|
if (isEditable(target)) {
|
|
1601
1617
|
return () => {
|
|
1602
|
-
var
|
|
1603
|
-
const insertData = (
|
|
1618
|
+
var _a3;
|
|
1619
|
+
const insertData = (_a3 = event.clipboardData) == null ? void 0 : _a3.getData("text");
|
|
1604
1620
|
if (insertData) {
|
|
1605
1621
|
input(config, target, insertData, "insertFromPaste");
|
|
1606
1622
|
}
|
|
@@ -1616,10 +1632,10 @@ function wrapEvent(cb, _element) {
|
|
|
1616
1632
|
|
|
1617
1633
|
// src/event/dispatchEvent.ts
|
|
1618
1634
|
function dispatchEvent(config, target, event, preventDefault = false) {
|
|
1619
|
-
var
|
|
1635
|
+
var _a3, _b;
|
|
1620
1636
|
const type3 = event.type;
|
|
1621
1637
|
const behaviorImplementation = preventDefault ? () => {
|
|
1622
|
-
} : (_b = (
|
|
1638
|
+
} : (_b = (_a3 = behavior)[type3]) == null ? void 0 : _b.call(_a3, event, target, config);
|
|
1623
1639
|
if (behaviorImplementation) {
|
|
1624
1640
|
event.preventDefault();
|
|
1625
1641
|
let defaultPrevented = false;
|
|
@@ -1697,6 +1713,13 @@ function prepareSelectionInterceptor(element) {
|
|
|
1697
1713
|
this[UISelection] = void 0;
|
|
1698
1714
|
return { realArgs: v };
|
|
1699
1715
|
});
|
|
1716
|
+
prepareInterceptor(element, "select", function interceptorImpl() {
|
|
1717
|
+
this[UISelection] = {
|
|
1718
|
+
anchorOffset: 0,
|
|
1719
|
+
focusOffset: getUIValue(element).length
|
|
1720
|
+
};
|
|
1721
|
+
return { realArgs: [] };
|
|
1722
|
+
});
|
|
1700
1723
|
}
|
|
1701
1724
|
function setUISelection(element, {
|
|
1702
1725
|
focusOffset: focusOffsetParam,
|
|
@@ -1723,9 +1746,9 @@ function setUISelection(element, {
|
|
|
1723
1746
|
}
|
|
1724
1747
|
}
|
|
1725
1748
|
function getUISelection(element) {
|
|
1726
|
-
var
|
|
1749
|
+
var _a3, _b, _c;
|
|
1727
1750
|
const sel = (_c = element[UISelection]) != null ? _c : {
|
|
1728
|
-
anchorOffset: (
|
|
1751
|
+
anchorOffset: (_a3 = element.selectionStart) != null ? _a3 : 0,
|
|
1729
1752
|
focusOffset: (_b = element.selectionEnd) != null ? _b : 0
|
|
1730
1753
|
};
|
|
1731
1754
|
return __spreadProps(__spreadValues({}, sel), {
|
|
@@ -1785,8 +1808,8 @@ function startTrackValue(element) {
|
|
|
1785
1808
|
});
|
|
1786
1809
|
}
|
|
1787
1810
|
function trackOrSetValue(element, v) {
|
|
1788
|
-
var
|
|
1789
|
-
(_b = (
|
|
1811
|
+
var _a3, _b, _c;
|
|
1812
|
+
(_b = (_a3 = element[TrackChanges]) == null ? void 0 : _a3.tracked) == null ? void 0 : _b.push(v);
|
|
1790
1813
|
if (!((_c = element[TrackChanges]) == null ? void 0 : _c.tracked)) {
|
|
1791
1814
|
setCleanValue(element, v);
|
|
1792
1815
|
}
|
|
@@ -1797,10 +1820,10 @@ function setCleanValue(element, v) {
|
|
|
1797
1820
|
setUISelection(element, { focusOffset: v.length });
|
|
1798
1821
|
}
|
|
1799
1822
|
function endTrackValue(element) {
|
|
1800
|
-
var
|
|
1823
|
+
var _a3, _b;
|
|
1801
1824
|
const changes = element[TrackChanges];
|
|
1802
1825
|
element[TrackChanges] = void 0;
|
|
1803
|
-
const isJustReactStateUpdate = ((
|
|
1826
|
+
const isJustReactStateUpdate = ((_a3 = changes == null ? void 0 : changes.tracked) == null ? void 0 : _a3.length) === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === changes.nextValue;
|
|
1804
1827
|
if (((_b = changes == null ? void 0 : changes.tracked) == null ? void 0 : _b.length) && !isJustReactStateUpdate) {
|
|
1805
1828
|
setCleanValue(element, changes.tracked[changes.tracked.length - 1]);
|
|
1806
1829
|
}
|
|
@@ -1873,11 +1896,11 @@ function isModifierLock(key) {
|
|
|
1873
1896
|
return modifierLocks.includes(key);
|
|
1874
1897
|
}
|
|
1875
1898
|
function preKeydownBehavior(config, { key }, element) {
|
|
1876
|
-
var
|
|
1899
|
+
var _a3;
|
|
1877
1900
|
if (isModifierKey(key)) {
|
|
1878
1901
|
config.keyboardState.modifiers[key] = true;
|
|
1879
1902
|
if (key === "AltGraph") {
|
|
1880
|
-
const ctrlKeyDef = (
|
|
1903
|
+
const ctrlKeyDef = (_a3 = config.keyboardMap.find((k) => k.key === "Control")) != null ? _a3 : { key: "Control", code: "Control" };
|
|
1881
1904
|
dispatchUIEvent(config, element, "keydown", getKeyEventProps(ctrlKeyDef));
|
|
1882
1905
|
}
|
|
1883
1906
|
} else if (isModifierLock(key)) {
|
|
@@ -1897,9 +1920,9 @@ function preKeyupBehavior(config, { key }) {
|
|
|
1897
1920
|
}
|
|
1898
1921
|
}
|
|
1899
1922
|
function postKeyupBehavior(config, { key }, element) {
|
|
1900
|
-
var
|
|
1923
|
+
var _a3;
|
|
1901
1924
|
if (key === "AltGraph") {
|
|
1902
|
-
const ctrlKeyDef = (
|
|
1925
|
+
const ctrlKeyDef = (_a3 = config.keyboardMap.find((k) => k.key === "Control")) != null ? _a3 : { key: "Control", code: "Control" };
|
|
1903
1926
|
dispatchUIEvent(config, element, "keyup", getKeyEventProps(ctrlKeyDef));
|
|
1904
1927
|
}
|
|
1905
1928
|
}
|
|
@@ -1937,8 +1960,8 @@ async function keyboardKeyAction(config, { keyDef, releasePrevious, releaseSelf,
|
|
|
1937
1960
|
}
|
|
1938
1961
|
}
|
|
1939
1962
|
function getActive(document2) {
|
|
1940
|
-
var
|
|
1941
|
-
return (
|
|
1963
|
+
var _a3;
|
|
1964
|
+
return (_a3 = getActiveElement(document2)) != null ? _a3 : document2.body;
|
|
1942
1965
|
}
|
|
1943
1966
|
async function releaseAllKeys(config) {
|
|
1944
1967
|
const getCurrentElement = () => getActive(config.document);
|
|
@@ -1972,13 +1995,13 @@ async function keyup(keyDef, getCurrentElement, config, unprevented) {
|
|
|
1972
1995
|
postKeyupBehavior(config, keyDef, element);
|
|
1973
1996
|
}
|
|
1974
1997
|
function hasKeyPress(keyDef, config) {
|
|
1975
|
-
var
|
|
1976
|
-
return (((
|
|
1998
|
+
var _a3;
|
|
1999
|
+
return (((_a3 = keyDef.key) == null ? void 0 : _a3.length) === 1 || keyDef.key === "Enter") && !config.keyboardState.modifiers.Control && !config.keyboardState.modifiers.Alt;
|
|
1977
2000
|
}
|
|
1978
2001
|
|
|
1979
2002
|
// src/keyboard/parseKeyDef.ts
|
|
1980
2003
|
function parseKeyDef(keyboardMap, text) {
|
|
1981
|
-
var
|
|
2004
|
+
var _a3;
|
|
1982
2005
|
const defs = [];
|
|
1983
2006
|
do {
|
|
1984
2007
|
const {
|
|
@@ -1989,15 +2012,15 @@ function parseKeyDef(keyboardMap, text) {
|
|
|
1989
2012
|
releaseSelf = true,
|
|
1990
2013
|
repeat
|
|
1991
2014
|
} = readNextDescriptor(text, "keyboard");
|
|
1992
|
-
const keyDef = (
|
|
1993
|
-
var
|
|
2015
|
+
const keyDef = (_a3 = keyboardMap.find((def) => {
|
|
2016
|
+
var _a4, _b;
|
|
1994
2017
|
if (type3 === "[") {
|
|
1995
|
-
return ((
|
|
2018
|
+
return ((_a4 = def.code) == null ? void 0 : _a4.toLowerCase()) === descriptor.toLowerCase();
|
|
1996
2019
|
} else if (type3 === "{") {
|
|
1997
2020
|
return ((_b = def.key) == null ? void 0 : _b.toLowerCase()) === descriptor.toLowerCase();
|
|
1998
2021
|
}
|
|
1999
2022
|
return def.key === descriptor;
|
|
2000
|
-
})) != null ?
|
|
2023
|
+
})) != null ? _a3 : {
|
|
2001
2024
|
key: "Unknown",
|
|
2002
2025
|
code: "Unknown",
|
|
2003
2026
|
[type3 === "[" ? "code" : "key"]: descriptor
|
|
@@ -2074,8 +2097,8 @@ function firePointerEvent(config, target, type3, {
|
|
|
2074
2097
|
}
|
|
2075
2098
|
init.button = getMouseButton(button != null ? button : 0);
|
|
2076
2099
|
init.buttons = getMouseButtons(...config.pointerState.pressed.filter((p) => p.keyDef.pointerType === pointerType).map((p) => {
|
|
2077
|
-
var
|
|
2078
|
-
return (
|
|
2100
|
+
var _a3;
|
|
2101
|
+
return (_a3 = p.keyDef.button) != null ? _a3 : 0;
|
|
2079
2102
|
}));
|
|
2080
2103
|
if (["mousedown", "mouseup", "click", "dblclick", "contextmenu"].includes(type3)) {
|
|
2081
2104
|
init.detail = clickCount;
|
|
@@ -2233,7 +2256,7 @@ function getNextPointerId(state) {
|
|
|
2233
2256
|
return state.pointerId;
|
|
2234
2257
|
}
|
|
2235
2258
|
function down(config, pointerName, { keyDef, node, offset, target, coords }, targetIsDisabled) {
|
|
2236
|
-
var
|
|
2259
|
+
var _a3, _b, _c;
|
|
2237
2260
|
setLevelRef(config, 2 /* Trigger */);
|
|
2238
2261
|
assertPointerEvents(config, target);
|
|
2239
2262
|
const { pointerState } = config;
|
|
@@ -2256,7 +2279,7 @@ function down(config, pointerName, { keyDef, node, offset, target, coords }, tar
|
|
|
2256
2279
|
}
|
|
2257
2280
|
}
|
|
2258
2281
|
}
|
|
2259
|
-
if (((
|
|
2282
|
+
if (((_a3 = pointerState.activeClickCount) == null ? void 0 : _a3[0]) !== name) {
|
|
2260
2283
|
delete pointerState.activeClickCount;
|
|
2261
2284
|
}
|
|
2262
2285
|
const clickCount = Number((_c = (_b = pointerState.activeClickCount) == null ? void 0 : _b[1]) != null ? _c : 0) + 1;
|
|
@@ -2384,7 +2407,6 @@ function mousedownDefaultBehavior({
|
|
|
2384
2407
|
node,
|
|
2385
2408
|
offset
|
|
2386
2409
|
}) {
|
|
2387
|
-
focus(target);
|
|
2388
2410
|
if (!targetIsDisabled) {
|
|
2389
2411
|
const hasValue = isElementType(target, ["input", "textarea"]);
|
|
2390
2412
|
const text = String(hasValue ? getUIValue(target) : target.textContent);
|
|
@@ -2410,7 +2432,7 @@ function mousedownDefaultBehavior({
|
|
|
2410
2432
|
node,
|
|
2411
2433
|
offset: end
|
|
2412
2434
|
});
|
|
2413
|
-
const range =
|
|
2435
|
+
const range = target.ownerDocument.createRange();
|
|
2414
2436
|
range.setStart(startNode, startOffset);
|
|
2415
2437
|
range.setEnd(endNode, endOffset);
|
|
2416
2438
|
position.selectionRange = range;
|
|
@@ -2419,6 +2441,7 @@ function mousedownDefaultBehavior({
|
|
|
2419
2441
|
selection.addRange(range.cloneRange());
|
|
2420
2442
|
}
|
|
2421
2443
|
}
|
|
2444
|
+
focus(target);
|
|
2422
2445
|
}
|
|
2423
2446
|
function getTextRange(text, pos, clickCount) {
|
|
2424
2447
|
if (clickCount % 3 === 1 || text.length === 0) {
|
|
@@ -2439,11 +2462,11 @@ function getTextRange(text, pos, clickCount) {
|
|
|
2439
2462
|
|
|
2440
2463
|
// src/pointer/pointerAction.ts
|
|
2441
2464
|
async function pointerAction(config, actions) {
|
|
2442
|
-
var
|
|
2465
|
+
var _a3, _b;
|
|
2443
2466
|
for (let i = 0; i < actions.length; i++) {
|
|
2444
2467
|
const action = actions[i];
|
|
2445
2468
|
const pointerName = "pointerName" in action && action.pointerName ? action.pointerName : "keyDef" in action ? action.keyDef.pointerType === "touch" ? action.keyDef.name : action.keyDef.pointerType : "mouse";
|
|
2446
|
-
const target = (
|
|
2469
|
+
const target = (_a3 = action.target) != null ? _a3 : getPrevTarget(pointerName, config.pointerState);
|
|
2447
2470
|
const coords = (_b = action.coords) != null ? _b : pointerName in config.pointerState.position ? config.pointerState.position[pointerName].coords : void 0;
|
|
2448
2471
|
await ("keyDef" in action ? pointerPress(config, __spreadProps(__spreadValues({}, action), { target, coords })) : pointerMove(config, __spreadProps(__spreadValues({}, action), { target, coords })));
|
|
2449
2472
|
if (typeof config.delay === "number") {
|
|
@@ -2557,9 +2580,9 @@ async function tab({
|
|
|
2557
2580
|
|
|
2558
2581
|
// src/clipboard/copy.ts
|
|
2559
2582
|
async function copy() {
|
|
2560
|
-
var
|
|
2583
|
+
var _a3;
|
|
2561
2584
|
const doc = this[Config].document;
|
|
2562
|
-
const target = (
|
|
2585
|
+
const target = (_a3 = doc.activeElement) != null ? _a3 : doc.body;
|
|
2563
2586
|
const clipboardData = copySelection(target);
|
|
2564
2587
|
if (clipboardData.items.length === 0) {
|
|
2565
2588
|
return;
|
|
@@ -2574,9 +2597,9 @@ async function copy() {
|
|
|
2574
2597
|
|
|
2575
2598
|
// src/clipboard/cut.ts
|
|
2576
2599
|
async function cut() {
|
|
2577
|
-
var
|
|
2600
|
+
var _a3;
|
|
2578
2601
|
const doc = this[Config].document;
|
|
2579
|
-
const target = (
|
|
2602
|
+
const target = (_a3 = doc.activeElement) != null ? _a3 : doc.body;
|
|
2580
2603
|
const clipboardData = copySelection(target);
|
|
2581
2604
|
if (clipboardData.items.length === 0) {
|
|
2582
2605
|
return;
|
|
@@ -2591,18 +2614,18 @@ async function cut() {
|
|
|
2591
2614
|
|
|
2592
2615
|
// src/clipboard/paste.ts
|
|
2593
2616
|
async function paste(clipboardData) {
|
|
2594
|
-
var
|
|
2617
|
+
var _a3, _b;
|
|
2595
2618
|
const doc = this[Config].document;
|
|
2596
|
-
const target = (
|
|
2597
|
-
const dataTransfer = (_b = typeof clipboardData === "string" ? getClipboardDataFromString(clipboardData) : clipboardData) != null ? _b : await readDataTransferFromClipboard(doc).catch(() => {
|
|
2619
|
+
const target = (_a3 = doc.activeElement) != null ? _a3 : doc.body;
|
|
2620
|
+
const dataTransfer = (_b = typeof clipboardData === "string" ? getClipboardDataFromString(doc, clipboardData) : clipboardData) != null ? _b : await readDataTransferFromClipboard(doc).catch(() => {
|
|
2598
2621
|
throw new Error("`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.");
|
|
2599
2622
|
});
|
|
2600
2623
|
this.dispatchUIEvent(target, "paste", {
|
|
2601
2624
|
clipboardData: dataTransfer
|
|
2602
2625
|
});
|
|
2603
2626
|
}
|
|
2604
|
-
function getClipboardDataFromString(text) {
|
|
2605
|
-
const dt = createDataTransfer();
|
|
2627
|
+
function getClipboardDataFromString(doc, text) {
|
|
2628
|
+
const dt = createDataTransfer(getWindow(doc));
|
|
2606
2629
|
dt.setData("text", text);
|
|
2607
2630
|
return dt;
|
|
2608
2631
|
}
|
|
@@ -2745,10 +2768,10 @@ async function upload(element, fileOrFiles) {
|
|
|
2745
2768
|
return;
|
|
2746
2769
|
const files = (Array.isArray(fileOrFiles) ? fileOrFiles : [fileOrFiles]).filter((file) => !this[Config].applyAccept || isAcceptableFile(file, input2.accept)).slice(0, input2.multiple ? void 0 : 1);
|
|
2747
2770
|
const fileDialog = () => {
|
|
2748
|
-
var
|
|
2749
|
-
if (files.length === ((
|
|
2750
|
-
var
|
|
2751
|
-
return f === ((
|
|
2771
|
+
var _a3;
|
|
2772
|
+
if (files.length === ((_a3 = input2.files) == null ? void 0 : _a3.length) && files.every((f, i) => {
|
|
2773
|
+
var _a4;
|
|
2774
|
+
return f === ((_a4 = input2.files) == null ? void 0 : _a4.item(i));
|
|
2752
2775
|
})) {
|
|
2753
2776
|
return;
|
|
2754
2777
|
}
|
|
@@ -2795,10 +2818,10 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
|
|
|
2795
2818
|
});
|
|
2796
2819
|
}
|
|
2797
2820
|
function setupMain(options = {}) {
|
|
2798
|
-
var
|
|
2821
|
+
var _a3;
|
|
2799
2822
|
const config = createConfig(options);
|
|
2800
2823
|
prepareDocument(config.document);
|
|
2801
|
-
const view = (
|
|
2824
|
+
const view = (_a3 = config.document.defaultView) != null ? _a3 : window;
|
|
2802
2825
|
attachClipboardStubToView(view);
|
|
2803
2826
|
return doSetup(config);
|
|
2804
2827
|
}
|
|
@@ -2834,8 +2857,8 @@ function doSetup(config) {
|
|
|
2834
2857
|
});
|
|
2835
2858
|
}
|
|
2836
2859
|
function getDocument(options, node) {
|
|
2837
|
-
var
|
|
2838
|
-
return (_b = (
|
|
2860
|
+
var _a3, _b;
|
|
2861
|
+
return (_b = (_a3 = options.document) != null ? _a3 : node && getDocumentFromNode(node)) != null ? _b : document;
|
|
2839
2862
|
}
|
|
2840
2863
|
|
|
2841
2864
|
// src/setup/directApi.ts
|