@testing-library/user-event 14.2.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,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
6
|
var __export = (target, all) => {
|
|
24
7
|
for (var name in all)
|
|
25
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -87,7 +70,8 @@ function readBlobText(blob, FileReader) {
|
|
|
87
70
|
|
|
88
71
|
// src/utils/dataTransfer/FileList.ts
|
|
89
72
|
function createFileList(files) {
|
|
90
|
-
const list =
|
|
73
|
+
const list = {
|
|
74
|
+
...files,
|
|
91
75
|
length: files.length,
|
|
92
76
|
item: (index) => list[index],
|
|
93
77
|
[Symbol.iterator]: function* nextFile() {
|
|
@@ -95,7 +79,7 @@ function createFileList(files) {
|
|
|
95
79
|
yield list[i];
|
|
96
80
|
}
|
|
97
81
|
}
|
|
98
|
-
}
|
|
82
|
+
};
|
|
99
83
|
list.constructor = FileList;
|
|
100
84
|
Object.setPrototypeOf(list, FileList.prototype);
|
|
101
85
|
Object.freeze(list);
|
|
@@ -610,17 +594,30 @@ function setFiles(el, files) {
|
|
|
610
594
|
const prototypeDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(el));
|
|
611
595
|
function restore() {
|
|
612
596
|
Object.defineProperties(el, {
|
|
613
|
-
files:
|
|
614
|
-
|
|
615
|
-
|
|
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
|
+
}
|
|
616
609
|
});
|
|
617
610
|
}
|
|
618
611
|
el[fakeFiles] = { restore };
|
|
619
612
|
Object.defineProperties(el, {
|
|
620
|
-
files:
|
|
613
|
+
files: {
|
|
614
|
+
...prototypeDescriptors.files,
|
|
615
|
+
...objectDescriptors.files,
|
|
621
616
|
get: () => files
|
|
622
|
-
}
|
|
623
|
-
value:
|
|
617
|
+
},
|
|
618
|
+
value: {
|
|
619
|
+
...prototypeDescriptors.value,
|
|
620
|
+
...objectDescriptors.value,
|
|
624
621
|
get: () => files.length ? `C:\\fakepath\\${files[0].name}` : "",
|
|
625
622
|
set(v) {
|
|
626
623
|
var _a2;
|
|
@@ -630,15 +627,17 @@ function setFiles(el, files) {
|
|
|
630
627
|
(_a2 = objectDescriptors.value.set) == null ? void 0 : _a2.call(el, v);
|
|
631
628
|
}
|
|
632
629
|
}
|
|
633
|
-
}
|
|
634
|
-
type:
|
|
630
|
+
},
|
|
631
|
+
type: {
|
|
632
|
+
...prototypeDescriptors.type,
|
|
633
|
+
...objectDescriptors.type,
|
|
635
634
|
set(v) {
|
|
636
635
|
if (v !== "file") {
|
|
637
636
|
restore();
|
|
638
637
|
el.type = v;
|
|
639
638
|
}
|
|
640
639
|
}
|
|
641
|
-
}
|
|
640
|
+
}
|
|
642
641
|
});
|
|
643
642
|
}
|
|
644
643
|
|
|
@@ -1116,9 +1115,10 @@ function readNextDescriptor(text, context) {
|
|
|
1116
1115
|
pos += startBracket.length;
|
|
1117
1116
|
const isEscapedChar = new RegExp(`^\\${startBracket}{2}`).test(text);
|
|
1118
1117
|
const type3 = isEscapedChar ? "" : startBracket;
|
|
1119
|
-
return
|
|
1120
|
-
type: type3
|
|
1121
|
-
|
|
1118
|
+
return {
|
|
1119
|
+
type: type3,
|
|
1120
|
+
...type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context)
|
|
1121
|
+
};
|
|
1122
1122
|
}
|
|
1123
1123
|
function readPrintableChar(text, pos, context) {
|
|
1124
1124
|
const descriptor = text[pos];
|
|
@@ -1319,9 +1319,10 @@ var defaultOptionsDirect = {
|
|
|
1319
1319
|
writeToClipboard: false,
|
|
1320
1320
|
advanceTimers: () => Promise.resolve()
|
|
1321
1321
|
};
|
|
1322
|
-
var defaultOptionsSetup =
|
|
1322
|
+
var defaultOptionsSetup = {
|
|
1323
|
+
...defaultOptionsDirect,
|
|
1323
1324
|
writeToClipboard: true
|
|
1324
|
-
}
|
|
1325
|
+
};
|
|
1325
1326
|
|
|
1326
1327
|
// src/utils/pointer/cssPointerEvents.ts
|
|
1327
1328
|
function hasPointerEvents(element) {
|
|
@@ -1440,12 +1441,13 @@ var import_dom2 = require("@testing-library/dom");
|
|
|
1440
1441
|
|
|
1441
1442
|
// src/event/eventMap.ts
|
|
1442
1443
|
var import_event_map = require("@testing-library/dom/dist/event-map.js");
|
|
1443
|
-
var eventMap =
|
|
1444
|
+
var eventMap = {
|
|
1445
|
+
...import_event_map.eventMap,
|
|
1444
1446
|
beforeInput: {
|
|
1445
1447
|
EventType: "InputEvent",
|
|
1446
1448
|
defaultInit: { bubbles: true, cancelable: true, composed: true }
|
|
1447
1449
|
}
|
|
1448
|
-
}
|
|
1450
|
+
};
|
|
1449
1451
|
var eventMapKeys = Object.fromEntries(Object.keys(eventMap).map((k) => [k.toLowerCase(), k]));
|
|
1450
1452
|
|
|
1451
1453
|
// src/event/eventTypes.ts
|
|
@@ -1719,7 +1721,10 @@ function dispatchEvent(config, target, event, preventDefault = false) {
|
|
|
1719
1721
|
// src/event/index.ts
|
|
1720
1722
|
function dispatchUIEvent(config, target, type3, init, preventDefault = false) {
|
|
1721
1723
|
if (isMouseEvent(type3) || isKeyboardEvent(type3)) {
|
|
1722
|
-
init =
|
|
1724
|
+
init = {
|
|
1725
|
+
...init,
|
|
1726
|
+
...getUIEventModifiers(config.keyboardState)
|
|
1727
|
+
};
|
|
1723
1728
|
}
|
|
1724
1729
|
const event = createEvent(type3, target, init);
|
|
1725
1730
|
return dispatchEvent(config, target, event, preventDefault);
|
|
@@ -1753,9 +1758,10 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
1753
1758
|
}
|
|
1754
1759
|
;
|
|
1755
1760
|
intercept[Interceptor] = Interceptor;
|
|
1756
|
-
Object.defineProperty(element, propName,
|
|
1761
|
+
Object.defineProperty(element, propName, {
|
|
1762
|
+
...objectDescriptor != null ? objectDescriptor : prototypeDescriptor,
|
|
1757
1763
|
[target]: intercept
|
|
1758
|
-
})
|
|
1764
|
+
});
|
|
1759
1765
|
}
|
|
1760
1766
|
|
|
1761
1767
|
// src/document/selection.ts
|
|
@@ -1816,10 +1822,14 @@ function getUISelection(element) {
|
|
|
1816
1822
|
anchorOffset: (_a = element.selectionStart) != null ? _a : 0,
|
|
1817
1823
|
focusOffset: (_b = element.selectionEnd) != null ? _b : 0
|
|
1818
1824
|
};
|
|
1819
|
-
return
|
|
1825
|
+
return {
|
|
1826
|
+
...sel,
|
|
1820
1827
|
startOffset: Math.min(sel.anchorOffset, sel.focusOffset),
|
|
1821
1828
|
endOffset: Math.max(sel.anchorOffset, sel.focusOffset)
|
|
1822
|
-
}
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
function setUISelectionClean(element) {
|
|
1832
|
+
element[UISelection] = void 0;
|
|
1823
1833
|
}
|
|
1824
1834
|
|
|
1825
1835
|
// src/document/value.ts
|
|
@@ -1859,6 +1869,9 @@ function setUIValue(element, value) {
|
|
|
1859
1869
|
function getUIValue(element) {
|
|
1860
1870
|
return element[UIValue] === void 0 ? element.value : String(element[UIValue]);
|
|
1861
1871
|
}
|
|
1872
|
+
function setUIValueClean(element) {
|
|
1873
|
+
element[UIValue] = void 0;
|
|
1874
|
+
}
|
|
1862
1875
|
function clearInitialValue(element) {
|
|
1863
1876
|
element[InitialValue] = void 0;
|
|
1864
1877
|
}
|
|
@@ -1866,13 +1879,14 @@ function getInitialValue(element) {
|
|
|
1866
1879
|
return element[InitialValue];
|
|
1867
1880
|
}
|
|
1868
1881
|
function setPreviousValue(element, v) {
|
|
1869
|
-
element[TrackChanges] =
|
|
1882
|
+
element[TrackChanges] = { ...element[TrackChanges], previousValue: v };
|
|
1870
1883
|
}
|
|
1871
1884
|
function startTrackValue(element) {
|
|
1872
|
-
element[TrackChanges] =
|
|
1885
|
+
element[TrackChanges] = {
|
|
1886
|
+
...element[TrackChanges],
|
|
1873
1887
|
nextValue: String(element.value),
|
|
1874
1888
|
tracked: []
|
|
1875
|
-
}
|
|
1889
|
+
};
|
|
1876
1890
|
}
|
|
1877
1891
|
function trackOrSetValue(element, v) {
|
|
1878
1892
|
var _a, _b, _c;
|
|
@@ -1896,6 +1910,19 @@ function endTrackValue(element) {
|
|
|
1896
1910
|
return isJustReactStateUpdate;
|
|
1897
1911
|
}
|
|
1898
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
|
+
|
|
1899
1926
|
// src/document/index.ts
|
|
1900
1927
|
var isPrepared = Symbol("Node prepared with document state workarounds");
|
|
1901
1928
|
function prepareDocument(document) {
|
|
@@ -1934,6 +1961,7 @@ function prepareElement(el) {
|
|
|
1934
1961
|
if ("value" in el) {
|
|
1935
1962
|
prepareValueInterceptor(el);
|
|
1936
1963
|
prepareSelectionInterceptor(el);
|
|
1964
|
+
prepareRangeTextInterceptor(el);
|
|
1937
1965
|
}
|
|
1938
1966
|
el[isPrepared] = isPrepared;
|
|
1939
1967
|
}
|
|
@@ -2049,9 +2077,10 @@ async function keydown(keyDef, getCurrentElement, config) {
|
|
|
2049
2077
|
}
|
|
2050
2078
|
async function keypress(keyDef, getCurrentElement, config) {
|
|
2051
2079
|
const element = getCurrentElement();
|
|
2052
|
-
dispatchUIEvent(config, element, "keypress",
|
|
2080
|
+
dispatchUIEvent(config, element, "keypress", {
|
|
2081
|
+
...getKeyEventProps(keyDef),
|
|
2053
2082
|
charCode: keyDef.key === "Enter" ? 13 : String(keyDef.key).charCodeAt(0)
|
|
2054
|
-
})
|
|
2083
|
+
});
|
|
2055
2084
|
}
|
|
2056
2085
|
async function keyup(keyDef, getCurrentElement, config, unprevented) {
|
|
2057
2086
|
const element = getCurrentElement();
|
|
@@ -2153,7 +2182,9 @@ function firePointerEvent(config, target, type3, {
|
|
|
2153
2182
|
isPrimary,
|
|
2154
2183
|
clickCount
|
|
2155
2184
|
}) {
|
|
2156
|
-
const init =
|
|
2185
|
+
const init = {
|
|
2186
|
+
...coords
|
|
2187
|
+
};
|
|
2157
2188
|
if (type3 === "click" || type3.startsWith("pointer")) {
|
|
2158
2189
|
init.pointerId = pointerId;
|
|
2159
2190
|
init.pointerType = pointerType;
|
|
@@ -2239,10 +2270,11 @@ async function pointerMove(config, { pointerName = "mouse", target, coords, node
|
|
|
2239
2270
|
}
|
|
2240
2271
|
setLevelRef(config, 2 /* Trigger */);
|
|
2241
2272
|
assertPointerEvents(config, target);
|
|
2242
|
-
pointerState.position[pointerName] =
|
|
2273
|
+
pointerState.position[pointerName] = {
|
|
2274
|
+
...pointerState.position[pointerName],
|
|
2243
2275
|
target,
|
|
2244
2276
|
coords
|
|
2245
|
-
}
|
|
2277
|
+
};
|
|
2246
2278
|
if (prevTarget !== target) {
|
|
2247
2279
|
if (!prevTarget || !isDescendantOrSelf(prevTarget, target)) {
|
|
2248
2280
|
fireEnter(target, coords);
|
|
@@ -2328,12 +2360,13 @@ function down(config, pointerName, { keyDef, node, offset, target, coords }, tar
|
|
|
2328
2360
|
const { pointerState } = config;
|
|
2329
2361
|
const { name, pointerType, button } = keyDef;
|
|
2330
2362
|
const pointerId = pointerType === "mouse" ? 1 : getNextPointerId(pointerState);
|
|
2331
|
-
pointerState.position[pointerName] =
|
|
2363
|
+
pointerState.position[pointerName] = {
|
|
2364
|
+
...pointerState.position[pointerName],
|
|
2332
2365
|
pointerId,
|
|
2333
2366
|
pointerType,
|
|
2334
2367
|
target,
|
|
2335
2368
|
coords
|
|
2336
|
-
}
|
|
2369
|
+
};
|
|
2337
2370
|
let isMultiTouch = false;
|
|
2338
2371
|
let isPrimary = true;
|
|
2339
2372
|
if (pointerType !== "mouse") {
|
|
@@ -2410,10 +2443,11 @@ function up(config, pointerName, {
|
|
|
2410
2443
|
pointerState.pressed = pointerState.pressed.filter((p) => p !== pressed);
|
|
2411
2444
|
const { isMultiTouch, isPrimary, pointerId, clickCount } = pressed;
|
|
2412
2445
|
let { unpreventedDefault } = pressed;
|
|
2413
|
-
pointerState.position[pointerName] =
|
|
2446
|
+
pointerState.position[pointerName] = {
|
|
2447
|
+
...pointerState.position[pointerName],
|
|
2414
2448
|
target,
|
|
2415
2449
|
coords
|
|
2416
|
-
}
|
|
2450
|
+
};
|
|
2417
2451
|
if (pointerType !== "mouse" || !pointerState.pressed.filter((p) => p.keyDef.pointerType === pointerType).length) {
|
|
2418
2452
|
fire("pointerup");
|
|
2419
2453
|
}
|
|
@@ -2534,7 +2568,7 @@ async function pointerAction(config, actions) {
|
|
|
2534
2568
|
const pointerName = "pointerName" in action && action.pointerName ? action.pointerName : "keyDef" in action ? action.keyDef.pointerType === "touch" ? action.keyDef.name : action.keyDef.pointerType : "mouse";
|
|
2535
2569
|
const target = (_a = action.target) != null ? _a : getPrevTarget(pointerName, config.pointerState);
|
|
2536
2570
|
const coords = (_b = action.coords) != null ? _b : pointerName in config.pointerState.position ? config.pointerState.position[pointerName].coords : void 0;
|
|
2537
|
-
await ("keyDef" in action ? pointerPress(config,
|
|
2571
|
+
await ("keyDef" in action ? pointerPress(config, { ...action, target, coords }) : pointerMove(config, { ...action, target, coords }));
|
|
2538
2572
|
if (i < actions.length - 1) {
|
|
2539
2573
|
await wait(config);
|
|
2540
2574
|
}
|
|
@@ -2556,7 +2590,10 @@ async function pointer(input2) {
|
|
|
2556
2590
|
if (typeof actionInput === "string") {
|
|
2557
2591
|
actions.push(...parseKeyDef2(pointerMap, actionInput));
|
|
2558
2592
|
} else if ("keys" in actionInput) {
|
|
2559
|
-
actions.push(...parseKeyDef2(pointerMap, actionInput.keys).map((i) =>
|
|
2593
|
+
actions.push(...parseKeyDef2(pointerMap, actionInput.keys).map((i) => ({
|
|
2594
|
+
...actionInput,
|
|
2595
|
+
...i
|
|
2596
|
+
})));
|
|
2560
2597
|
} else {
|
|
2561
2598
|
actions.push(actionInput);
|
|
2562
2599
|
}
|
|
@@ -2877,11 +2914,13 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
|
|
|
2877
2914
|
keyboardState = createKeyboardState(),
|
|
2878
2915
|
pointerState = createPointerState(document)
|
|
2879
2916
|
} = options;
|
|
2880
|
-
return
|
|
2917
|
+
return {
|
|
2918
|
+
...defaults,
|
|
2919
|
+
...options,
|
|
2881
2920
|
document,
|
|
2882
2921
|
keyboardState,
|
|
2883
2922
|
pointerState
|
|
2884
|
-
}
|
|
2923
|
+
};
|
|
2885
2924
|
}
|
|
2886
2925
|
function setupMain(options = {}) {
|
|
2887
2926
|
var _a;
|
|
@@ -2900,7 +2939,10 @@ function setupDirect(options = {}, node) {
|
|
|
2900
2939
|
};
|
|
2901
2940
|
}
|
|
2902
2941
|
function setupSub(options) {
|
|
2903
|
-
return doSetup(
|
|
2942
|
+
return doSetup({
|
|
2943
|
+
...this[Config],
|
|
2944
|
+
...options
|
|
2945
|
+
});
|
|
2904
2946
|
}
|
|
2905
2947
|
function wrapAndBindImpl(instance, impl) {
|
|
2906
2948
|
function method(...args) {
|
|
@@ -2914,16 +2956,18 @@ function wrapAndBindImpl(instance, impl) {
|
|
|
2914
2956
|
return method;
|
|
2915
2957
|
}
|
|
2916
2958
|
function doSetup(config) {
|
|
2917
|
-
const instance =
|
|
2959
|
+
const instance = {
|
|
2918
2960
|
[Config]: config,
|
|
2919
|
-
dispatchUIEvent: bindDispatchUIEvent(config)
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
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
|
+
])),
|
|
2925
2969
|
setup: setupSub.bind(instance)
|
|
2926
|
-
}
|
|
2970
|
+
};
|
|
2927
2971
|
}
|
|
2928
2972
|
function getDocument(options, node, defaults) {
|
|
2929
2973
|
var _a, _b;
|
|
@@ -3004,6 +3048,7 @@ function tab2(options = {}) {
|
|
|
3004
3048
|
}
|
|
3005
3049
|
|
|
3006
3050
|
// src/setup/index.ts
|
|
3007
|
-
var userEvent =
|
|
3051
|
+
var userEvent = {
|
|
3052
|
+
...directApi_exports,
|
|
3008
3053
|
setup: setupMain
|
|
3009
|
-
}
|
|
3054
|
+
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -1837,6 +1836,9 @@ function getUISelection(element) {
|
|
|
1837
1836
|
endOffset: Math.max(sel.anchorOffset, sel.focusOffset)
|
|
1838
1837
|
});
|
|
1839
1838
|
}
|
|
1839
|
+
function setUISelectionClean(element) {
|
|
1840
|
+
element[UISelection] = void 0;
|
|
1841
|
+
}
|
|
1840
1842
|
|
|
1841
1843
|
// src/document/value.ts
|
|
1842
1844
|
var UIValue = Symbol("Displayed value in UI");
|
|
@@ -1875,6 +1877,9 @@ function setUIValue(element, value) {
|
|
|
1875
1877
|
function getUIValue(element) {
|
|
1876
1878
|
return element[UIValue] === void 0 ? element.value : String(element[UIValue]);
|
|
1877
1879
|
}
|
|
1880
|
+
function setUIValueClean(element) {
|
|
1881
|
+
element[UIValue] = void 0;
|
|
1882
|
+
}
|
|
1878
1883
|
function clearInitialValue(element) {
|
|
1879
1884
|
element[InitialValue] = void 0;
|
|
1880
1885
|
}
|
|
@@ -1912,6 +1917,19 @@ function endTrackValue(element) {
|
|
|
1912
1917
|
return isJustReactStateUpdate;
|
|
1913
1918
|
}
|
|
1914
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
|
+
|
|
1915
1933
|
// src/document/index.ts
|
|
1916
1934
|
var isPrepared = Symbol("Node prepared with document state workarounds");
|
|
1917
1935
|
function prepareDocument(document) {
|
|
@@ -1950,6 +1968,7 @@ function prepareElement(el) {
|
|
|
1950
1968
|
if ("value" in el) {
|
|
1951
1969
|
prepareValueInterceptor(el);
|
|
1952
1970
|
prepareSelectionInterceptor(el);
|
|
1971
|
+
prepareRangeTextInterceptor(el);
|
|
1953
1972
|
}
|
|
1954
1973
|
el[isPrepared] = isPrepared;
|
|
1955
1974
|
}
|
|
@@ -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;
|