@testing-library/user-event 14.1.1 → 14.2.2
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
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
6
|
var __export = (target, all) => {
|
|
23
7
|
for (var name in all)
|
|
24
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -86,7 +70,8 @@ function readBlobText(blob, FileReader) {
|
|
|
86
70
|
|
|
87
71
|
// src/utils/dataTransfer/FileList.ts
|
|
88
72
|
function createFileList(files) {
|
|
89
|
-
const list =
|
|
73
|
+
const list = {
|
|
74
|
+
...files,
|
|
90
75
|
length: files.length,
|
|
91
76
|
item: (index) => list[index],
|
|
92
77
|
[Symbol.iterator]: function* nextFile() {
|
|
@@ -94,7 +79,7 @@ function createFileList(files) {
|
|
|
94
79
|
yield list[i];
|
|
95
80
|
}
|
|
96
81
|
}
|
|
97
|
-
}
|
|
82
|
+
};
|
|
98
83
|
list.constructor = FileList;
|
|
99
84
|
Object.setPrototypeOf(list, FileList.prototype);
|
|
100
85
|
Object.freeze(list);
|
|
@@ -243,9 +228,8 @@ function createClipboardItem(window, ...blobs) {
|
|
|
243
228
|
}(dataMap);
|
|
244
229
|
}
|
|
245
230
|
var ClipboardStubControl = Symbol("Manage ClipboardSub");
|
|
246
|
-
function createClipboardStub(window) {
|
|
247
|
-
|
|
248
|
-
return new (_a = class extends window.EventTarget {
|
|
231
|
+
function createClipboardStub(window, control) {
|
|
232
|
+
return Object.assign(new class Clipboard extends window.EventTarget {
|
|
249
233
|
constructor() {
|
|
250
234
|
super(...arguments);
|
|
251
235
|
this.items = [];
|
|
@@ -269,7 +253,9 @@ function createClipboardStub(window) {
|
|
|
269
253
|
async writeText(text) {
|
|
270
254
|
this.items = [createClipboardItem(window, text)];
|
|
271
255
|
}
|
|
272
|
-
},
|
|
256
|
+
}(), {
|
|
257
|
+
[ClipboardStubControl]: control
|
|
258
|
+
});
|
|
273
259
|
}
|
|
274
260
|
function isClipboardStub(clipboard) {
|
|
275
261
|
return !!(clipboard == null ? void 0 : clipboard[ClipboardStubControl]);
|
|
@@ -279,11 +265,10 @@ function attachClipboardStubToView(window) {
|
|
|
279
265
|
return window.navigator.clipboard[ClipboardStubControl];
|
|
280
266
|
}
|
|
281
267
|
const realClipboard = Object.getOwnPropertyDescriptor(window.navigator, "clipboard");
|
|
282
|
-
let stub
|
|
268
|
+
let stub;
|
|
283
269
|
const control = {
|
|
284
270
|
resetClipboardStub: () => {
|
|
285
|
-
stub = createClipboardStub(window);
|
|
286
|
-
stub[ClipboardStubControl] = control;
|
|
271
|
+
stub = createClipboardStub(window, control);
|
|
287
272
|
},
|
|
288
273
|
detachClipboardStub: () => {
|
|
289
274
|
if (realClipboard) {
|
|
@@ -296,7 +281,7 @@ function attachClipboardStubToView(window) {
|
|
|
296
281
|
}
|
|
297
282
|
}
|
|
298
283
|
};
|
|
299
|
-
stub
|
|
284
|
+
stub = createClipboardStub(window, control);
|
|
300
285
|
Object.defineProperty(window.navigator, "clipboard", {
|
|
301
286
|
get: () => stub,
|
|
302
287
|
configurable: true
|
|
@@ -609,17 +594,30 @@ function setFiles(el, files) {
|
|
|
609
594
|
const prototypeDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(el));
|
|
610
595
|
function restore() {
|
|
611
596
|
Object.defineProperties(el, {
|
|
612
|
-
files:
|
|
613
|
-
|
|
614
|
-
|
|
597
|
+
files: {
|
|
598
|
+
...prototypeDescriptors.files,
|
|
599
|
+
...objectDescriptors.files
|
|
600
|
+
},
|
|
601
|
+
value: {
|
|
602
|
+
...prototypeDescriptors.value,
|
|
603
|
+
...objectDescriptors.value
|
|
604
|
+
},
|
|
605
|
+
type: {
|
|
606
|
+
...prototypeDescriptors.type,
|
|
607
|
+
...objectDescriptors.type
|
|
608
|
+
}
|
|
615
609
|
});
|
|
616
610
|
}
|
|
617
611
|
el[fakeFiles] = { restore };
|
|
618
612
|
Object.defineProperties(el, {
|
|
619
|
-
files:
|
|
613
|
+
files: {
|
|
614
|
+
...prototypeDescriptors.files,
|
|
615
|
+
...objectDescriptors.files,
|
|
620
616
|
get: () => files
|
|
621
|
-
}
|
|
622
|
-
value:
|
|
617
|
+
},
|
|
618
|
+
value: {
|
|
619
|
+
...prototypeDescriptors.value,
|
|
620
|
+
...objectDescriptors.value,
|
|
623
621
|
get: () => files.length ? `C:\\fakepath\\${files[0].name}` : "",
|
|
624
622
|
set(v) {
|
|
625
623
|
var _a2;
|
|
@@ -629,15 +627,17 @@ function setFiles(el, files) {
|
|
|
629
627
|
(_a2 = objectDescriptors.value.set) == null ? void 0 : _a2.call(el, v);
|
|
630
628
|
}
|
|
631
629
|
}
|
|
632
|
-
}
|
|
633
|
-
type:
|
|
630
|
+
},
|
|
631
|
+
type: {
|
|
632
|
+
...prototypeDescriptors.type,
|
|
633
|
+
...objectDescriptors.type,
|
|
634
634
|
set(v) {
|
|
635
635
|
if (v !== "file") {
|
|
636
636
|
restore();
|
|
637
637
|
el.type = v;
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
}
|
|
640
|
+
}
|
|
641
641
|
});
|
|
642
642
|
}
|
|
643
643
|
|
|
@@ -917,7 +917,7 @@ function moveSelection(node, direction) {
|
|
|
917
917
|
});
|
|
918
918
|
} else {
|
|
919
919
|
const selection = node.ownerDocument.getSelection();
|
|
920
|
-
if (!selection) {
|
|
920
|
+
if (!(selection == null ? void 0 : selection.focusNode)) {
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
923
|
if (selection.isCollapsed) {
|
|
@@ -996,8 +996,8 @@ function isVisible(element) {
|
|
|
996
996
|
function getTabDestination(activeElement, shift) {
|
|
997
997
|
const document = activeElement.ownerDocument;
|
|
998
998
|
const focusableElements = document.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
999
|
-
const enabledElements = Array.from(focusableElements).filter((el) => el === activeElement || el.getAttribute("tabindex")
|
|
1000
|
-
if (activeElement.getAttribute("tabindex")
|
|
999
|
+
const enabledElements = Array.from(focusableElements).filter((el) => el === activeElement || !(Number(el.getAttribute("tabindex")) < 0 || isDisabled(el)));
|
|
1000
|
+
if (Number(activeElement.getAttribute("tabindex")) >= 0) {
|
|
1001
1001
|
enabledElements.sort((a, b) => {
|
|
1002
1002
|
const i = Number(a.getAttribute("tabindex"));
|
|
1003
1003
|
const j = Number(b.getAttribute("tabindex"));
|
|
@@ -1037,10 +1037,17 @@ function getTabDestination(activeElement, shift) {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
prunedElements.push(el);
|
|
1039
1039
|
});
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1040
|
+
for (let index = prunedElements.findIndex((el) => el === activeElement); ; ) {
|
|
1041
|
+
index += shift ? -1 : 1;
|
|
1042
|
+
if (index === prunedElements.length) {
|
|
1043
|
+
index = 0;
|
|
1044
|
+
} else if (index === -1) {
|
|
1045
|
+
index = prunedElements.length - 1;
|
|
1046
|
+
}
|
|
1047
|
+
if (prunedElements[index] === activeElement || prunedElements[index] === document.body || isVisible(prunedElements[index])) {
|
|
1048
|
+
return prunedElements[index];
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1044
1051
|
}
|
|
1045
1052
|
|
|
1046
1053
|
// src/utils/focus/selectAll.ts
|
|
@@ -1108,9 +1115,10 @@ function readNextDescriptor(text, context) {
|
|
|
1108
1115
|
pos += startBracket.length;
|
|
1109
1116
|
const isEscapedChar = new RegExp(`^\\${startBracket}{2}`).test(text);
|
|
1110
1117
|
const type3 = isEscapedChar ? "" : startBracket;
|
|
1111
|
-
return
|
|
1112
|
-
type: type3
|
|
1113
|
-
|
|
1118
|
+
return {
|
|
1119
|
+
type: type3,
|
|
1120
|
+
...type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context)
|
|
1121
|
+
};
|
|
1114
1122
|
}
|
|
1115
1123
|
function readPrintableChar(text, pos, context) {
|
|
1116
1124
|
const descriptor = text[pos];
|
|
@@ -1311,20 +1319,26 @@ var defaultOptionsDirect = {
|
|
|
1311
1319
|
writeToClipboard: false,
|
|
1312
1320
|
advanceTimers: () => Promise.resolve()
|
|
1313
1321
|
};
|
|
1314
|
-
var defaultOptionsSetup =
|
|
1322
|
+
var defaultOptionsSetup = {
|
|
1323
|
+
...defaultOptionsDirect,
|
|
1315
1324
|
writeToClipboard: true
|
|
1316
|
-
}
|
|
1325
|
+
};
|
|
1317
1326
|
|
|
1318
1327
|
// src/utils/pointer/cssPointerEvents.ts
|
|
1319
1328
|
function hasPointerEvents(element) {
|
|
1329
|
+
var _a;
|
|
1330
|
+
return ((_a = closestPointerEventsDeclaration(element)) == null ? void 0 : _a.pointerEvents) !== "none";
|
|
1331
|
+
}
|
|
1332
|
+
function closestPointerEventsDeclaration(element) {
|
|
1320
1333
|
const window = getWindow(element);
|
|
1321
|
-
for (let el = element; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
1334
|
+
for (let el = element, tree = []; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
1335
|
+
tree.push(el);
|
|
1322
1336
|
const pointerEvents = window.getComputedStyle(el).pointerEvents;
|
|
1323
1337
|
if (pointerEvents && !["inherit", "unset"].includes(pointerEvents)) {
|
|
1324
|
-
return pointerEvents
|
|
1338
|
+
return { pointerEvents, tree };
|
|
1325
1339
|
}
|
|
1326
1340
|
}
|
|
1327
|
-
return
|
|
1341
|
+
return void 0;
|
|
1328
1342
|
}
|
|
1329
1343
|
var PointerEventsCheck = Symbol("Last check for pointer-events");
|
|
1330
1344
|
function assertPointerEvents(config, element) {
|
|
@@ -1333,15 +1347,59 @@ function assertPointerEvents(config, element) {
|
|
|
1333
1347
|
if (!needsCheck) {
|
|
1334
1348
|
return;
|
|
1335
1349
|
}
|
|
1336
|
-
const
|
|
1350
|
+
const declaration = closestPointerEventsDeclaration(element);
|
|
1337
1351
|
element[PointerEventsCheck] = {
|
|
1338
1352
|
[1 /* Call */]: getLevelRef(config, 1 /* Call */),
|
|
1339
1353
|
[2 /* Trigger */]: getLevelRef(config, 2 /* Trigger */),
|
|
1340
|
-
result
|
|
1354
|
+
result: (declaration == null ? void 0 : declaration.pointerEvents) !== "none"
|
|
1341
1355
|
};
|
|
1342
|
-
if (
|
|
1343
|
-
throw new Error(
|
|
1356
|
+
if ((declaration == null ? void 0 : declaration.pointerEvents) === "none") {
|
|
1357
|
+
throw new Error([
|
|
1358
|
+
`Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
|
|
1359
|
+
"",
|
|
1360
|
+
printTree(declaration.tree)
|
|
1361
|
+
].join("\n"));
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
function printTree(tree) {
|
|
1365
|
+
return tree.reverse().map((el, i) => [
|
|
1366
|
+
"".padEnd(i),
|
|
1367
|
+
el.tagName,
|
|
1368
|
+
el.id && `#${el.id}`,
|
|
1369
|
+
el.hasAttribute("data-testid") && `(testId=${el.getAttribute("data-testid")})`,
|
|
1370
|
+
getLabelDescr(el),
|
|
1371
|
+
tree.length > 1 && i === 0 && " <-- This element declared `pointer-events: none`",
|
|
1372
|
+
tree.length > 1 && i === tree.length - 1 && " <-- Asserted pointer events here"
|
|
1373
|
+
].filter(Boolean).join("")).join("\n");
|
|
1374
|
+
}
|
|
1375
|
+
function getLabelDescr(element) {
|
|
1376
|
+
var _a, _b, _c, _d;
|
|
1377
|
+
let label;
|
|
1378
|
+
if (element.hasAttribute("aria-label")) {
|
|
1379
|
+
label = element.getAttribute("aria-label");
|
|
1380
|
+
} else if (element.hasAttribute("aria-labelledby")) {
|
|
1381
|
+
label = (_b = (_a = element.ownerDocument.getElementById(element.getAttribute("aria-labelledby"))) == null ? void 0 : _a.textContent) == null ? void 0 : _b.trim();
|
|
1382
|
+
} else if (isElementType(element, [
|
|
1383
|
+
"button",
|
|
1384
|
+
"input",
|
|
1385
|
+
"meter",
|
|
1386
|
+
"output",
|
|
1387
|
+
"progress",
|
|
1388
|
+
"select",
|
|
1389
|
+
"textarea"
|
|
1390
|
+
]) && ((_c = element.labels) == null ? void 0 : _c.length)) {
|
|
1391
|
+
label = Array.from(element.labels).map((el) => {
|
|
1392
|
+
var _a2;
|
|
1393
|
+
return (_a2 = el.textContent) == null ? void 0 : _a2.trim();
|
|
1394
|
+
}).join("|");
|
|
1395
|
+
} else if (isElementType(element, "button")) {
|
|
1396
|
+
label = (_d = element.textContent) == null ? void 0 : _d.trim();
|
|
1397
|
+
}
|
|
1398
|
+
label = label == null ? void 0 : label.replace(/\n/g, " ");
|
|
1399
|
+
if (Number(label == null ? void 0 : label.length) > 30) {
|
|
1400
|
+
label = `${label == null ? void 0 : label.substring(0, 29)}\u2026`;
|
|
1344
1401
|
}
|
|
1402
|
+
return label ? `(label=${label})` : "";
|
|
1345
1403
|
}
|
|
1346
1404
|
function hasBitFlag(conf, flag) {
|
|
1347
1405
|
return (conf & flag) > 0;
|
|
@@ -1383,12 +1441,13 @@ var import_dom2 = require("@testing-library/dom");
|
|
|
1383
1441
|
|
|
1384
1442
|
// src/event/eventMap.ts
|
|
1385
1443
|
var import_event_map = require("@testing-library/dom/dist/event-map.js");
|
|
1386
|
-
var eventMap =
|
|
1444
|
+
var eventMap = {
|
|
1445
|
+
...import_event_map.eventMap,
|
|
1387
1446
|
beforeInput: {
|
|
1388
1447
|
EventType: "InputEvent",
|
|
1389
1448
|
defaultInit: { bubbles: true, cancelable: true, composed: true }
|
|
1390
1449
|
}
|
|
1391
|
-
}
|
|
1450
|
+
};
|
|
1392
1451
|
var eventMapKeys = Object.fromEntries(Object.keys(eventMap).map((k) => [k.toLowerCase(), k]));
|
|
1393
1452
|
|
|
1394
1453
|
// src/event/eventTypes.ts
|
|
@@ -1662,7 +1721,10 @@ function dispatchEvent(config, target, event, preventDefault = false) {
|
|
|
1662
1721
|
// src/event/index.ts
|
|
1663
1722
|
function dispatchUIEvent(config, target, type3, init, preventDefault = false) {
|
|
1664
1723
|
if (isMouseEvent(type3) || isKeyboardEvent(type3)) {
|
|
1665
|
-
init =
|
|
1724
|
+
init = {
|
|
1725
|
+
...init,
|
|
1726
|
+
...getUIEventModifiers(config.keyboardState)
|
|
1727
|
+
};
|
|
1666
1728
|
}
|
|
1667
1729
|
const event = createEvent(type3, target, init);
|
|
1668
1730
|
return dispatchEvent(config, target, event, preventDefault);
|
|
@@ -1696,9 +1758,10 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
1696
1758
|
}
|
|
1697
1759
|
;
|
|
1698
1760
|
intercept[Interceptor] = Interceptor;
|
|
1699
|
-
Object.defineProperty(element, propName,
|
|
1761
|
+
Object.defineProperty(element, propName, {
|
|
1762
|
+
...objectDescriptor != null ? objectDescriptor : prototypeDescriptor,
|
|
1700
1763
|
[target]: intercept
|
|
1701
|
-
})
|
|
1764
|
+
});
|
|
1702
1765
|
}
|
|
1703
1766
|
|
|
1704
1767
|
// src/document/selection.ts
|
|
@@ -1759,10 +1822,14 @@ function getUISelection(element) {
|
|
|
1759
1822
|
anchorOffset: (_a = element.selectionStart) != null ? _a : 0,
|
|
1760
1823
|
focusOffset: (_b = element.selectionEnd) != null ? _b : 0
|
|
1761
1824
|
};
|
|
1762
|
-
return
|
|
1825
|
+
return {
|
|
1826
|
+
...sel,
|
|
1763
1827
|
startOffset: Math.min(sel.anchorOffset, sel.focusOffset),
|
|
1764
1828
|
endOffset: Math.max(sel.anchorOffset, sel.focusOffset)
|
|
1765
|
-
}
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
function setUISelectionClean(element) {
|
|
1832
|
+
element[UISelection] = void 0;
|
|
1766
1833
|
}
|
|
1767
1834
|
|
|
1768
1835
|
// src/document/value.ts
|
|
@@ -1802,6 +1869,9 @@ function setUIValue(element, value) {
|
|
|
1802
1869
|
function getUIValue(element) {
|
|
1803
1870
|
return element[UIValue] === void 0 ? element.value : String(element[UIValue]);
|
|
1804
1871
|
}
|
|
1872
|
+
function setUIValueClean(element) {
|
|
1873
|
+
element[UIValue] = void 0;
|
|
1874
|
+
}
|
|
1805
1875
|
function clearInitialValue(element) {
|
|
1806
1876
|
element[InitialValue] = void 0;
|
|
1807
1877
|
}
|
|
@@ -1809,13 +1879,14 @@ function getInitialValue(element) {
|
|
|
1809
1879
|
return element[InitialValue];
|
|
1810
1880
|
}
|
|
1811
1881
|
function setPreviousValue(element, v) {
|
|
1812
|
-
element[TrackChanges] =
|
|
1882
|
+
element[TrackChanges] = { ...element[TrackChanges], previousValue: v };
|
|
1813
1883
|
}
|
|
1814
1884
|
function startTrackValue(element) {
|
|
1815
|
-
element[TrackChanges] =
|
|
1885
|
+
element[TrackChanges] = {
|
|
1886
|
+
...element[TrackChanges],
|
|
1816
1887
|
nextValue: String(element.value),
|
|
1817
1888
|
tracked: []
|
|
1818
|
-
}
|
|
1889
|
+
};
|
|
1819
1890
|
}
|
|
1820
1891
|
function trackOrSetValue(element, v) {
|
|
1821
1892
|
var _a, _b, _c;
|
|
@@ -1839,6 +1910,19 @@ function endTrackValue(element) {
|
|
|
1839
1910
|
return isJustReactStateUpdate;
|
|
1840
1911
|
}
|
|
1841
1912
|
|
|
1913
|
+
// src/document/setRangeText.ts
|
|
1914
|
+
function prepareRangeTextInterceptor(element) {
|
|
1915
|
+
prepareInterceptor(element, "setRangeText", function interceptorImpl(...realArgs) {
|
|
1916
|
+
return {
|
|
1917
|
+
realArgs,
|
|
1918
|
+
then: () => {
|
|
1919
|
+
setUIValueClean(element);
|
|
1920
|
+
setUISelectionClean(element);
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1842
1926
|
// src/document/index.ts
|
|
1843
1927
|
var isPrepared = Symbol("Node prepared with document state workarounds");
|
|
1844
1928
|
function prepareDocument(document) {
|
|
@@ -1877,6 +1961,7 @@ function prepareElement(el) {
|
|
|
1877
1961
|
if ("value" in el) {
|
|
1878
1962
|
prepareValueInterceptor(el);
|
|
1879
1963
|
prepareSelectionInterceptor(el);
|
|
1964
|
+
prepareRangeTextInterceptor(el);
|
|
1880
1965
|
}
|
|
1881
1966
|
el[isPrepared] = isPrepared;
|
|
1882
1967
|
}
|
|
@@ -1992,9 +2077,10 @@ async function keydown(keyDef, getCurrentElement, config) {
|
|
|
1992
2077
|
}
|
|
1993
2078
|
async function keypress(keyDef, getCurrentElement, config) {
|
|
1994
2079
|
const element = getCurrentElement();
|
|
1995
|
-
dispatchUIEvent(config, element, "keypress",
|
|
2080
|
+
dispatchUIEvent(config, element, "keypress", {
|
|
2081
|
+
...getKeyEventProps(keyDef),
|
|
1996
2082
|
charCode: keyDef.key === "Enter" ? 13 : String(keyDef.key).charCodeAt(0)
|
|
1997
|
-
})
|
|
2083
|
+
});
|
|
1998
2084
|
}
|
|
1999
2085
|
async function keyup(keyDef, getCurrentElement, config, unprevented) {
|
|
2000
2086
|
const element = getCurrentElement();
|
|
@@ -2096,7 +2182,9 @@ function firePointerEvent(config, target, type3, {
|
|
|
2096
2182
|
isPrimary,
|
|
2097
2183
|
clickCount
|
|
2098
2184
|
}) {
|
|
2099
|
-
const init =
|
|
2185
|
+
const init = {
|
|
2186
|
+
...coords
|
|
2187
|
+
};
|
|
2100
2188
|
if (type3 === "click" || type3.startsWith("pointer")) {
|
|
2101
2189
|
init.pointerId = pointerId;
|
|
2102
2190
|
init.pointerType = pointerType;
|
|
@@ -2182,10 +2270,11 @@ async function pointerMove(config, { pointerName = "mouse", target, coords, node
|
|
|
2182
2270
|
}
|
|
2183
2271
|
setLevelRef(config, 2 /* Trigger */);
|
|
2184
2272
|
assertPointerEvents(config, target);
|
|
2185
|
-
pointerState.position[pointerName] =
|
|
2273
|
+
pointerState.position[pointerName] = {
|
|
2274
|
+
...pointerState.position[pointerName],
|
|
2186
2275
|
target,
|
|
2187
2276
|
coords
|
|
2188
|
-
}
|
|
2277
|
+
};
|
|
2189
2278
|
if (prevTarget !== target) {
|
|
2190
2279
|
if (!prevTarget || !isDescendantOrSelf(prevTarget, target)) {
|
|
2191
2280
|
fireEnter(target, coords);
|
|
@@ -2271,12 +2360,13 @@ function down(config, pointerName, { keyDef, node, offset, target, coords }, tar
|
|
|
2271
2360
|
const { pointerState } = config;
|
|
2272
2361
|
const { name, pointerType, button } = keyDef;
|
|
2273
2362
|
const pointerId = pointerType === "mouse" ? 1 : getNextPointerId(pointerState);
|
|
2274
|
-
pointerState.position[pointerName] =
|
|
2363
|
+
pointerState.position[pointerName] = {
|
|
2364
|
+
...pointerState.position[pointerName],
|
|
2275
2365
|
pointerId,
|
|
2276
2366
|
pointerType,
|
|
2277
2367
|
target,
|
|
2278
2368
|
coords
|
|
2279
|
-
}
|
|
2369
|
+
};
|
|
2280
2370
|
let isMultiTouch = false;
|
|
2281
2371
|
let isPrimary = true;
|
|
2282
2372
|
if (pointerType !== "mouse") {
|
|
@@ -2353,10 +2443,11 @@ function up(config, pointerName, {
|
|
|
2353
2443
|
pointerState.pressed = pointerState.pressed.filter((p) => p !== pressed);
|
|
2354
2444
|
const { isMultiTouch, isPrimary, pointerId, clickCount } = pressed;
|
|
2355
2445
|
let { unpreventedDefault } = pressed;
|
|
2356
|
-
pointerState.position[pointerName] =
|
|
2446
|
+
pointerState.position[pointerName] = {
|
|
2447
|
+
...pointerState.position[pointerName],
|
|
2357
2448
|
target,
|
|
2358
2449
|
coords
|
|
2359
|
-
}
|
|
2450
|
+
};
|
|
2360
2451
|
if (pointerType !== "mouse" || !pointerState.pressed.filter((p) => p.keyDef.pointerType === pointerType).length) {
|
|
2361
2452
|
fire("pointerup");
|
|
2362
2453
|
}
|
|
@@ -2477,7 +2568,7 @@ async function pointerAction(config, actions) {
|
|
|
2477
2568
|
const pointerName = "pointerName" in action && action.pointerName ? action.pointerName : "keyDef" in action ? action.keyDef.pointerType === "touch" ? action.keyDef.name : action.keyDef.pointerType : "mouse";
|
|
2478
2569
|
const target = (_a = action.target) != null ? _a : getPrevTarget(pointerName, config.pointerState);
|
|
2479
2570
|
const coords = (_b = action.coords) != null ? _b : pointerName in config.pointerState.position ? config.pointerState.position[pointerName].coords : void 0;
|
|
2480
|
-
await ("keyDef" in action ? pointerPress(config,
|
|
2571
|
+
await ("keyDef" in action ? pointerPress(config, { ...action, target, coords }) : pointerMove(config, { ...action, target, coords }));
|
|
2481
2572
|
if (i < actions.length - 1) {
|
|
2482
2573
|
await wait(config);
|
|
2483
2574
|
}
|
|
@@ -2499,7 +2590,10 @@ async function pointer(input2) {
|
|
|
2499
2590
|
if (typeof actionInput === "string") {
|
|
2500
2591
|
actions.push(...parseKeyDef2(pointerMap, actionInput));
|
|
2501
2592
|
} else if ("keys" in actionInput) {
|
|
2502
|
-
actions.push(...parseKeyDef2(pointerMap, actionInput.keys).map((i) =>
|
|
2593
|
+
actions.push(...parseKeyDef2(pointerMap, actionInput.keys).map((i) => ({
|
|
2594
|
+
...actionInput,
|
|
2595
|
+
...i
|
|
2596
|
+
})));
|
|
2503
2597
|
} else {
|
|
2504
2598
|
actions.push(actionInput);
|
|
2505
2599
|
}
|
|
@@ -2713,6 +2807,7 @@ async function selectOptionsBase(newValue, select, values) {
|
|
|
2713
2807
|
if (withPointerEvents) {
|
|
2714
2808
|
this.dispatchUIEvent(option, "click");
|
|
2715
2809
|
}
|
|
2810
|
+
await wait(this[Config]);
|
|
2716
2811
|
}
|
|
2717
2812
|
} else if (selectedOptions.length === 1) {
|
|
2718
2813
|
const withPointerEvents = this[Config].pointerEventsCheck === 0 ? true : hasPointerEvents(select);
|
|
@@ -2731,6 +2826,7 @@ async function selectOptionsBase(newValue, select, values) {
|
|
|
2731
2826
|
this.dispatchUIEvent(select, "mouseup");
|
|
2732
2827
|
this.dispatchUIEvent(select, "click");
|
|
2733
2828
|
}
|
|
2829
|
+
await wait(this[Config]);
|
|
2734
2830
|
} else {
|
|
2735
2831
|
throw (0, import_dom4.getConfig)().getElementError(`Cannot select multiple options on a non-multiple select`, select);
|
|
2736
2832
|
}
|
|
@@ -2818,11 +2914,13 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
|
|
|
2818
2914
|
keyboardState = createKeyboardState(),
|
|
2819
2915
|
pointerState = createPointerState(document)
|
|
2820
2916
|
} = options;
|
|
2821
|
-
return
|
|
2917
|
+
return {
|
|
2918
|
+
...defaults,
|
|
2919
|
+
...options,
|
|
2822
2920
|
document,
|
|
2823
2921
|
keyboardState,
|
|
2824
2922
|
pointerState
|
|
2825
|
-
}
|
|
2923
|
+
};
|
|
2826
2924
|
}
|
|
2827
2925
|
function setupMain(options = {}) {
|
|
2828
2926
|
var _a;
|
|
@@ -2841,27 +2939,35 @@ function setupDirect(options = {}, node) {
|
|
|
2841
2939
|
};
|
|
2842
2940
|
}
|
|
2843
2941
|
function setupSub(options) {
|
|
2844
|
-
return doSetup(
|
|
2942
|
+
return doSetup({
|
|
2943
|
+
...this[Config],
|
|
2944
|
+
...options
|
|
2945
|
+
});
|
|
2845
2946
|
}
|
|
2846
2947
|
function wrapAndBindImpl(instance, impl) {
|
|
2847
2948
|
function method(...args) {
|
|
2848
2949
|
setLevelRef(instance[Config], 1 /* Call */);
|
|
2849
|
-
return wrapAsync(() => impl.apply(instance, args))
|
|
2950
|
+
return wrapAsync(() => impl.apply(instance, args).then(async (ret) => {
|
|
2951
|
+
await wait(instance[Config]);
|
|
2952
|
+
return ret;
|
|
2953
|
+
}));
|
|
2850
2954
|
}
|
|
2851
2955
|
Object.defineProperty(method, "name", { get: () => impl.name });
|
|
2852
2956
|
return method;
|
|
2853
2957
|
}
|
|
2854
2958
|
function doSetup(config) {
|
|
2855
|
-
const instance =
|
|
2959
|
+
const instance = {
|
|
2856
2960
|
[Config]: config,
|
|
2857
|
-
dispatchUIEvent: bindDispatchUIEvent(config)
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2961
|
+
dispatchUIEvent: bindDispatchUIEvent(config),
|
|
2962
|
+
...api_exports
|
|
2963
|
+
};
|
|
2964
|
+
return {
|
|
2965
|
+
...Object.fromEntries(Object.entries(api_exports).map(([name, api]) => [
|
|
2966
|
+
name,
|
|
2967
|
+
wrapAndBindImpl(instance, api)
|
|
2968
|
+
])),
|
|
2863
2969
|
setup: setupSub.bind(instance)
|
|
2864
|
-
}
|
|
2970
|
+
};
|
|
2865
2971
|
}
|
|
2866
2972
|
function getDocument(options, node, defaults) {
|
|
2867
2973
|
var _a, _b;
|
|
@@ -2942,6 +3048,7 @@ function tab2(options = {}) {
|
|
|
2942
3048
|
}
|
|
2943
3049
|
|
|
2944
3050
|
// src/setup/index.ts
|
|
2945
|
-
var userEvent =
|
|
3051
|
+
var userEvent = {
|
|
3052
|
+
...directApi_exports,
|
|
2946
3053
|
setup: setupMain
|
|
2947
|
-
}
|
|
3054
|
+
};
|
package/dist/index.mjs
CHANGED
|
@@ -247,9 +247,8 @@ function createClipboardItem(window, ...blobs) {
|
|
|
247
247
|
}(dataMap);
|
|
248
248
|
}
|
|
249
249
|
var ClipboardStubControl = Symbol("Manage ClipboardSub");
|
|
250
|
-
function createClipboardStub(window) {
|
|
251
|
-
|
|
252
|
-
return new (_a = class extends window.EventTarget {
|
|
250
|
+
function createClipboardStub(window, control) {
|
|
251
|
+
return Object.assign(new class Clipboard extends window.EventTarget {
|
|
253
252
|
constructor() {
|
|
254
253
|
super(...arguments);
|
|
255
254
|
this.items = [];
|
|
@@ -281,7 +280,9 @@ function createClipboardStub(window) {
|
|
|
281
280
|
this.items = [createClipboardItem(window, text)];
|
|
282
281
|
});
|
|
283
282
|
}
|
|
284
|
-
},
|
|
283
|
+
}(), {
|
|
284
|
+
[ClipboardStubControl]: control
|
|
285
|
+
});
|
|
285
286
|
}
|
|
286
287
|
function isClipboardStub(clipboard) {
|
|
287
288
|
return !!(clipboard == null ? void 0 : clipboard[ClipboardStubControl]);
|
|
@@ -291,11 +292,10 @@ function attachClipboardStubToView(window) {
|
|
|
291
292
|
return window.navigator.clipboard[ClipboardStubControl];
|
|
292
293
|
}
|
|
293
294
|
const realClipboard = Object.getOwnPropertyDescriptor(window.navigator, "clipboard");
|
|
294
|
-
let stub
|
|
295
|
+
let stub;
|
|
295
296
|
const control = {
|
|
296
297
|
resetClipboardStub: () => {
|
|
297
|
-
stub = createClipboardStub(window);
|
|
298
|
-
stub[ClipboardStubControl] = control;
|
|
298
|
+
stub = createClipboardStub(window, control);
|
|
299
299
|
},
|
|
300
300
|
detachClipboardStub: () => {
|
|
301
301
|
if (realClipboard) {
|
|
@@ -308,7 +308,7 @@ function attachClipboardStubToView(window) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
stub
|
|
311
|
+
stub = createClipboardStub(window, control);
|
|
312
312
|
Object.defineProperty(window.navigator, "clipboard", {
|
|
313
313
|
get: () => stub,
|
|
314
314
|
configurable: true
|
|
@@ -933,7 +933,7 @@ function moveSelection(node, direction) {
|
|
|
933
933
|
});
|
|
934
934
|
} else {
|
|
935
935
|
const selection = node.ownerDocument.getSelection();
|
|
936
|
-
if (!selection) {
|
|
936
|
+
if (!(selection == null ? void 0 : selection.focusNode)) {
|
|
937
937
|
return;
|
|
938
938
|
}
|
|
939
939
|
if (selection.isCollapsed) {
|
|
@@ -1012,8 +1012,8 @@ function isVisible(element) {
|
|
|
1012
1012
|
function getTabDestination(activeElement, shift) {
|
|
1013
1013
|
const document = activeElement.ownerDocument;
|
|
1014
1014
|
const focusableElements = document.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
1015
|
-
const enabledElements = Array.from(focusableElements).filter((el) => el === activeElement || el.getAttribute("tabindex")
|
|
1016
|
-
if (activeElement.getAttribute("tabindex")
|
|
1015
|
+
const enabledElements = Array.from(focusableElements).filter((el) => el === activeElement || !(Number(el.getAttribute("tabindex")) < 0 || isDisabled(el)));
|
|
1016
|
+
if (Number(activeElement.getAttribute("tabindex")) >= 0) {
|
|
1017
1017
|
enabledElements.sort((a, b) => {
|
|
1018
1018
|
const i = Number(a.getAttribute("tabindex"));
|
|
1019
1019
|
const j = Number(b.getAttribute("tabindex"));
|
|
@@ -1053,10 +1053,17 @@ function getTabDestination(activeElement, shift) {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
prunedElements.push(el);
|
|
1055
1055
|
});
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1056
|
+
for (let index = prunedElements.findIndex((el) => el === activeElement); ; ) {
|
|
1057
|
+
index += shift ? -1 : 1;
|
|
1058
|
+
if (index === prunedElements.length) {
|
|
1059
|
+
index = 0;
|
|
1060
|
+
} else if (index === -1) {
|
|
1061
|
+
index = prunedElements.length - 1;
|
|
1062
|
+
}
|
|
1063
|
+
if (prunedElements[index] === activeElement || prunedElements[index] === document.body || isVisible(prunedElements[index])) {
|
|
1064
|
+
return prunedElements[index];
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1060
1067
|
}
|
|
1061
1068
|
|
|
1062
1069
|
// src/utils/focus/selectAll.ts
|
|
@@ -1333,14 +1340,19 @@ var defaultOptionsSetup = __spreadProps(__spreadValues({}, defaultOptionsDirect)
|
|
|
1333
1340
|
|
|
1334
1341
|
// src/utils/pointer/cssPointerEvents.ts
|
|
1335
1342
|
function hasPointerEvents(element) {
|
|
1343
|
+
var _a;
|
|
1344
|
+
return ((_a = closestPointerEventsDeclaration(element)) == null ? void 0 : _a.pointerEvents) !== "none";
|
|
1345
|
+
}
|
|
1346
|
+
function closestPointerEventsDeclaration(element) {
|
|
1336
1347
|
const window = getWindow(element);
|
|
1337
|
-
for (let el = element; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
1348
|
+
for (let el = element, tree = []; el == null ? void 0 : el.ownerDocument; el = el.parentElement) {
|
|
1349
|
+
tree.push(el);
|
|
1338
1350
|
const pointerEvents = window.getComputedStyle(el).pointerEvents;
|
|
1339
1351
|
if (pointerEvents && !["inherit", "unset"].includes(pointerEvents)) {
|
|
1340
|
-
return pointerEvents
|
|
1352
|
+
return { pointerEvents, tree };
|
|
1341
1353
|
}
|
|
1342
1354
|
}
|
|
1343
|
-
return
|
|
1355
|
+
return void 0;
|
|
1344
1356
|
}
|
|
1345
1357
|
var PointerEventsCheck = Symbol("Last check for pointer-events");
|
|
1346
1358
|
function assertPointerEvents(config, element) {
|
|
@@ -1349,15 +1361,59 @@ function assertPointerEvents(config, element) {
|
|
|
1349
1361
|
if (!needsCheck) {
|
|
1350
1362
|
return;
|
|
1351
1363
|
}
|
|
1352
|
-
const
|
|
1364
|
+
const declaration = closestPointerEventsDeclaration(element);
|
|
1353
1365
|
element[PointerEventsCheck] = {
|
|
1354
1366
|
[1 /* Call */]: getLevelRef(config, 1 /* Call */),
|
|
1355
1367
|
[2 /* Trigger */]: getLevelRef(config, 2 /* Trigger */),
|
|
1356
|
-
result
|
|
1368
|
+
result: (declaration == null ? void 0 : declaration.pointerEvents) !== "none"
|
|
1357
1369
|
};
|
|
1358
|
-
if (
|
|
1359
|
-
throw new Error(
|
|
1360
|
-
|
|
1370
|
+
if ((declaration == null ? void 0 : declaration.pointerEvents) === "none") {
|
|
1371
|
+
throw new Error([
|
|
1372
|
+
`Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? "inherits" : "has"} \`pointer-events: none\`:`,
|
|
1373
|
+
"",
|
|
1374
|
+
printTree(declaration.tree)
|
|
1375
|
+
].join("\n"));
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
function printTree(tree) {
|
|
1379
|
+
return tree.reverse().map((el, i) => [
|
|
1380
|
+
"".padEnd(i),
|
|
1381
|
+
el.tagName,
|
|
1382
|
+
el.id && `#${el.id}`,
|
|
1383
|
+
el.hasAttribute("data-testid") && `(testId=${el.getAttribute("data-testid")})`,
|
|
1384
|
+
getLabelDescr(el),
|
|
1385
|
+
tree.length > 1 && i === 0 && " <-- This element declared `pointer-events: none`",
|
|
1386
|
+
tree.length > 1 && i === tree.length - 1 && " <-- Asserted pointer events here"
|
|
1387
|
+
].filter(Boolean).join("")).join("\n");
|
|
1388
|
+
}
|
|
1389
|
+
function getLabelDescr(element) {
|
|
1390
|
+
var _a, _b, _c, _d;
|
|
1391
|
+
let label;
|
|
1392
|
+
if (element.hasAttribute("aria-label")) {
|
|
1393
|
+
label = element.getAttribute("aria-label");
|
|
1394
|
+
} else if (element.hasAttribute("aria-labelledby")) {
|
|
1395
|
+
label = (_b = (_a = element.ownerDocument.getElementById(element.getAttribute("aria-labelledby"))) == null ? void 0 : _a.textContent) == null ? void 0 : _b.trim();
|
|
1396
|
+
} else if (isElementType(element, [
|
|
1397
|
+
"button",
|
|
1398
|
+
"input",
|
|
1399
|
+
"meter",
|
|
1400
|
+
"output",
|
|
1401
|
+
"progress",
|
|
1402
|
+
"select",
|
|
1403
|
+
"textarea"
|
|
1404
|
+
]) && ((_c = element.labels) == null ? void 0 : _c.length)) {
|
|
1405
|
+
label = Array.from(element.labels).map((el) => {
|
|
1406
|
+
var _a2;
|
|
1407
|
+
return (_a2 = el.textContent) == null ? void 0 : _a2.trim();
|
|
1408
|
+
}).join("|");
|
|
1409
|
+
} else if (isElementType(element, "button")) {
|
|
1410
|
+
label = (_d = element.textContent) == null ? void 0 : _d.trim();
|
|
1411
|
+
}
|
|
1412
|
+
label = label == null ? void 0 : label.replace(/\n/g, " ");
|
|
1413
|
+
if (Number(label == null ? void 0 : label.length) > 30) {
|
|
1414
|
+
label = `${label == null ? void 0 : label.substring(0, 29)}\u2026`;
|
|
1415
|
+
}
|
|
1416
|
+
return label ? `(label=${label})` : "";
|
|
1361
1417
|
}
|
|
1362
1418
|
function hasBitFlag(conf, flag) {
|
|
1363
1419
|
return (conf & flag) > 0;
|
|
@@ -1780,6 +1836,9 @@ function getUISelection(element) {
|
|
|
1780
1836
|
endOffset: Math.max(sel.anchorOffset, sel.focusOffset)
|
|
1781
1837
|
});
|
|
1782
1838
|
}
|
|
1839
|
+
function setUISelectionClean(element) {
|
|
1840
|
+
element[UISelection] = void 0;
|
|
1841
|
+
}
|
|
1783
1842
|
|
|
1784
1843
|
// src/document/value.ts
|
|
1785
1844
|
var UIValue = Symbol("Displayed value in UI");
|
|
@@ -1818,6 +1877,9 @@ function setUIValue(element, value) {
|
|
|
1818
1877
|
function getUIValue(element) {
|
|
1819
1878
|
return element[UIValue] === void 0 ? element.value : String(element[UIValue]);
|
|
1820
1879
|
}
|
|
1880
|
+
function setUIValueClean(element) {
|
|
1881
|
+
element[UIValue] = void 0;
|
|
1882
|
+
}
|
|
1821
1883
|
function clearInitialValue(element) {
|
|
1822
1884
|
element[InitialValue] = void 0;
|
|
1823
1885
|
}
|
|
@@ -1855,6 +1917,19 @@ function endTrackValue(element) {
|
|
|
1855
1917
|
return isJustReactStateUpdate;
|
|
1856
1918
|
}
|
|
1857
1919
|
|
|
1920
|
+
// src/document/setRangeText.ts
|
|
1921
|
+
function prepareRangeTextInterceptor(element) {
|
|
1922
|
+
prepareInterceptor(element, "setRangeText", function interceptorImpl(...realArgs) {
|
|
1923
|
+
return {
|
|
1924
|
+
realArgs,
|
|
1925
|
+
then: () => {
|
|
1926
|
+
setUIValueClean(element);
|
|
1927
|
+
setUISelectionClean(element);
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1858
1933
|
// src/document/index.ts
|
|
1859
1934
|
var isPrepared = Symbol("Node prepared with document state workarounds");
|
|
1860
1935
|
function prepareDocument(document) {
|
|
@@ -1893,6 +1968,7 @@ function prepareElement(el) {
|
|
|
1893
1968
|
if ("value" in el) {
|
|
1894
1969
|
prepareValueInterceptor(el);
|
|
1895
1970
|
prepareSelectionInterceptor(el);
|
|
1971
|
+
prepareRangeTextInterceptor(el);
|
|
1896
1972
|
}
|
|
1897
1973
|
el[isPrepared] = isPrepared;
|
|
1898
1974
|
}
|
|
@@ -2776,6 +2852,7 @@ function selectOptionsBase(newValue, select, values) {
|
|
|
2776
2852
|
if (withPointerEvents) {
|
|
2777
2853
|
this.dispatchUIEvent(option, "click");
|
|
2778
2854
|
}
|
|
2855
|
+
yield wait(this[Config]);
|
|
2779
2856
|
}
|
|
2780
2857
|
} else if (selectedOptions.length === 1) {
|
|
2781
2858
|
const withPointerEvents = this[Config].pointerEventsCheck === 0 ? true : hasPointerEvents(select);
|
|
@@ -2794,6 +2871,7 @@ function selectOptionsBase(newValue, select, values) {
|
|
|
2794
2871
|
this.dispatchUIEvent(select, "mouseup");
|
|
2795
2872
|
this.dispatchUIEvent(select, "click");
|
|
2796
2873
|
}
|
|
2874
|
+
yield wait(this[Config]);
|
|
2797
2875
|
} else {
|
|
2798
2876
|
throw getConfig3().getElementError(`Cannot select multiple options on a non-multiple select`, select);
|
|
2799
2877
|
}
|
|
@@ -2914,7 +2992,10 @@ function setupSub(options) {
|
|
|
2914
2992
|
function wrapAndBindImpl(instance, impl) {
|
|
2915
2993
|
function method(...args) {
|
|
2916
2994
|
setLevelRef(instance[Config], 1 /* Call */);
|
|
2917
|
-
return wrapAsync(() => impl.apply(instance, args))
|
|
2995
|
+
return wrapAsync(() => impl.apply(instance, args).then((ret) => __async(this, null, function* () {
|
|
2996
|
+
yield wait(instance[Config]);
|
|
2997
|
+
return ret;
|
|
2998
|
+
})));
|
|
2918
2999
|
}
|
|
2919
3000
|
Object.defineProperty(method, "name", { get: () => impl.name });
|
|
2920
3001
|
return method;
|
|
@@ -23,4 +23,6 @@ export declare function getUISelection(element: HTMLInputElement | HTMLTextAreaE
|
|
|
23
23
|
anchorOffset: number;
|
|
24
24
|
focusOffset: number;
|
|
25
25
|
};
|
|
26
|
+
/** Flag the IDL selection as clean. This does not change the selection. */
|
|
27
|
+
export declare function setUISelectionClean(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
26
28
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prepareRangeTextInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
@@ -15,6 +15,8 @@ declare global {
|
|
|
15
15
|
export declare function prepareValueInterceptor(element: HTMLInputElement): void;
|
|
16
16
|
export declare function setUIValue(element: HTMLInputElement | HTMLTextAreaElement, value: string): void;
|
|
17
17
|
export declare function getUIValue(element: HTMLInputElement | HTMLTextAreaElement): string;
|
|
18
|
+
/** Flag the IDL value as clean. This does not change the value.*/
|
|
19
|
+
export declare function setUIValueClean(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
18
20
|
export declare function clearInitialValue(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
19
21
|
export declare function getInitialValue(element: HTMLInputElement | HTMLTextAreaElement): string | undefined;
|
|
20
22
|
export declare function startTrackValue(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare function createClipboardItem(window: Window & typeof globalThis, ...blobs: Array<Blob | string>): ClipboardItem;
|
|
2
|
-
|
|
2
|
+
declare type ClipboardStubControlInstance = {
|
|
3
3
|
resetClipboardStub: () => void;
|
|
4
4
|
detachClipboardStub: () => void;
|
|
5
5
|
};
|
|
6
|
+
export declare function attachClipboardStubToView(window: Window & typeof globalThis): ClipboardStubControlInstance;
|
|
6
7
|
export declare function resetClipboardStubOnView(window: Window & typeof globalThis): void;
|
|
7
8
|
export declare function detachClipboardStubFromView(window: Window & typeof globalThis): void;
|
|
8
9
|
export declare function readDataTransferFromClipboard(document: Document): Promise<DataTransfer>;
|
|
9
10
|
export declare function writeDataTransferToClipboard(document: Document, clipboardData: DataTransfer): Promise<void>;
|
|
11
|
+
export {};
|