@testing-library/user-event 14.4.0 → 14.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/clipboard/copy.js +6 -15
- package/dist/cjs/clipboard/cut.js +6 -15
- package/dist/cjs/clipboard/paste.js +6 -14
- package/dist/cjs/convenience/click.js +1 -4
- package/dist/cjs/convenience/hover.js +2 -12
- package/dist/cjs/document/UI.js +94 -0
- package/dist/cjs/document/copySelection.js +37 -0
- package/dist/cjs/document/getValueOrTextContent.js +27 -0
- package/dist/cjs/document/index.js +13 -68
- package/dist/cjs/document/interceptor.js +87 -4
- package/dist/cjs/document/prepareDocument.js +67 -0
- package/dist/cjs/document/trackValue.js +65 -0
- package/dist/cjs/event/behavior/click.js +8 -12
- package/dist/cjs/event/behavior/cut.js +5 -11
- package/dist/cjs/event/behavior/keydown.js +43 -43
- package/dist/cjs/event/behavior/keypress.js +9 -10
- package/dist/cjs/event/behavior/keyup.js +6 -7
- package/dist/cjs/event/behavior/paste.js +7 -12
- package/dist/cjs/event/createEvent.js +37 -28
- package/dist/cjs/event/dispatchEvent.js +21 -2
- package/dist/cjs/event/focus.js +44 -0
- package/dist/cjs/event/index.js +24 -17
- package/dist/cjs/{utils/edit → event}/input.js +50 -47
- package/dist/cjs/{utils/edit/walkRadio.js → event/radio.js} +13 -7
- package/dist/cjs/event/selection/getInputRange.js +20 -0
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +40 -0
- package/dist/cjs/event/selection/index.js +26 -0
- package/dist/cjs/event/selection/modifySelection.js +30 -0
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +49 -0
- package/dist/cjs/event/selection/moveSelection.js +47 -0
- package/dist/cjs/{utils/focus → event/selection}/resolveCaretPosition.js +11 -19
- package/dist/cjs/event/selection/selectAll.js +47 -0
- package/dist/cjs/event/selection/setSelection.js +30 -0
- package/dist/cjs/event/selection/setSelectionPerMouse.js +90 -0
- package/dist/cjs/event/selection/setSelectionRange.js +40 -0
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +45 -0
- package/dist/cjs/keyboard/index.js +13 -23
- package/dist/cjs/keyboard/parseKeyDef.js +8 -13
- package/dist/cjs/options.js +0 -28
- package/dist/cjs/pointer/index.js +28 -34
- package/dist/cjs/pointer/parseKeyDef.js +1 -9
- package/dist/cjs/setup/directApi.js +6 -6
- package/dist/cjs/setup/index.js +0 -2
- package/dist/cjs/setup/setup.js +69 -38
- package/dist/cjs/system/index.js +4 -2
- package/dist/cjs/system/keyboard.js +32 -32
- package/dist/cjs/system/pointer/buttons.js +3 -1
- package/dist/cjs/system/pointer/device.js +3 -1
- package/dist/cjs/system/pointer/index.js +82 -79
- package/dist/cjs/system/pointer/mouse.js +97 -81
- package/dist/cjs/system/pointer/pointer.js +45 -46
- package/dist/cjs/system/pointer/shared.js +10 -0
- package/dist/cjs/utility/clear.js +10 -11
- package/dist/cjs/utility/selectOptions.js +17 -19
- package/dist/cjs/utility/type.js +6 -15
- package/dist/cjs/utility/upload.js +9 -15
- package/dist/cjs/utils/dataTransfer/Clipboard.js +11 -21
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +22 -19
- package/dist/cjs/utils/edit/isEditable.js +6 -10
- package/dist/cjs/utils/edit/maxLength.js +6 -16
- package/dist/cjs/utils/edit/setFiles.js +4 -2
- package/dist/cjs/utils/edit/{buildTimeValue.js → timeValue.js} +6 -0
- package/dist/cjs/utils/focus/cursor.js +2 -17
- package/dist/cjs/utils/focus/getActiveElement.js +3 -2
- package/dist/cjs/utils/focus/selection.js +1 -266
- package/dist/cjs/utils/index.js +7 -32
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -3
- package/dist/cjs/utils/misc/isDisabled.js +2 -1
- package/dist/cjs/utils/misc/isVisible.js +1 -1
- package/dist/cjs/utils/misc/level.js +4 -6
- package/dist/cjs/utils/pointer/cssPointerEvents.js +26 -32
- package/dist/esm/clipboard/copy.js +6 -15
- package/dist/esm/clipboard/cut.js +6 -15
- package/dist/esm/clipboard/paste.js +6 -14
- package/dist/esm/convenience/click.js +1 -4
- package/dist/esm/convenience/hover.js +2 -12
- package/dist/esm/document/UI.js +79 -0
- package/dist/esm/document/copySelection.js +33 -0
- package/dist/esm/document/getValueOrTextContent.js +23 -0
- package/dist/esm/document/index.js +4 -66
- package/dist/esm/document/interceptor.js +85 -5
- package/dist/esm/document/prepareDocument.js +63 -0
- package/dist/esm/document/trackValue.js +59 -0
- package/dist/esm/event/behavior/click.js +8 -12
- package/dist/esm/event/behavior/cut.js +5 -11
- package/dist/esm/event/behavior/keydown.js +36 -36
- package/dist/esm/event/behavior/keypress.js +9 -10
- package/dist/esm/event/behavior/keyup.js +6 -7
- package/dist/esm/event/behavior/paste.js +7 -12
- package/dist/esm/event/createEvent.js +37 -28
- package/dist/esm/event/dispatchEvent.js +20 -3
- package/dist/esm/event/focus.js +39 -0
- package/dist/esm/event/index.js +14 -19
- package/dist/esm/{utils/edit → event}/input.js +37 -34
- package/dist/esm/{utils/edit/walkRadio.js → event/radio.js} +13 -7
- package/dist/esm/event/selection/getInputRange.js +16 -0
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +36 -0
- package/dist/esm/event/selection/index.js +9 -0
- package/dist/esm/event/selection/modifySelection.js +26 -0
- package/dist/esm/event/selection/modifySelectionPerMouse.js +45 -0
- package/dist/esm/event/selection/moveSelection.js +43 -0
- package/dist/esm/{utils/focus → event/selection}/resolveCaretPosition.js +11 -19
- package/dist/esm/event/selection/selectAll.js +42 -0
- package/dist/esm/event/selection/setSelection.js +26 -0
- package/dist/esm/event/selection/setSelectionPerMouse.js +86 -0
- package/dist/esm/event/selection/setSelectionRange.js +36 -0
- package/dist/esm/event/selection/updateSelectionOnFocus.js +41 -0
- package/dist/esm/keyboard/index.js +13 -23
- package/dist/esm/keyboard/parseKeyDef.js +8 -13
- package/dist/esm/options.js +1 -26
- package/dist/esm/pointer/index.js +28 -34
- package/dist/esm/pointer/parseKeyDef.js +1 -9
- package/dist/esm/setup/directApi.js +6 -6
- package/dist/esm/setup/index.js +0 -1
- package/dist/esm/setup/setup.js +63 -33
- package/dist/esm/system/index.js +4 -2
- package/dist/esm/system/keyboard.js +32 -32
- package/dist/esm/system/pointer/buttons.js +3 -1
- package/dist/esm/system/pointer/device.js +3 -1
- package/dist/esm/system/pointer/index.js +83 -79
- package/dist/esm/system/pointer/mouse.js +95 -79
- package/dist/esm/system/pointer/pointer.js +44 -45
- package/dist/esm/system/pointer/shared.js +6 -0
- package/dist/esm/utility/clear.js +10 -11
- package/dist/esm/utility/selectOptions.js +17 -19
- package/dist/esm/utility/type.js +6 -15
- package/dist/esm/utility/upload.js +9 -15
- package/dist/esm/utils/dataTransfer/Clipboard.js +11 -21
- package/dist/esm/utils/dataTransfer/DataTransfer.js +22 -19
- package/dist/esm/utils/edit/isEditable.js +4 -8
- package/dist/esm/utils/edit/maxLength.js +5 -16
- package/dist/esm/utils/edit/setFiles.js +4 -2
- package/dist/esm/utils/edit/{buildTimeValue.js → timeValue.js} +6 -1
- package/dist/esm/utils/focus/cursor.js +2 -17
- package/dist/esm/utils/focus/getActiveElement.js +3 -2
- package/dist/esm/utils/focus/selection.js +3 -260
- package/dist/esm/utils/index.js +4 -11
- package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -3
- package/dist/esm/utils/misc/isDisabled.js +2 -1
- package/dist/esm/utils/misc/isVisible.js +1 -1
- package/dist/esm/utils/misc/level.js +4 -6
- package/dist/esm/utils/pointer/cssPointerEvents.js +26 -32
- package/dist/types/clipboard/copy.d.ts +1 -1
- package/dist/types/clipboard/cut.d.ts +1 -1
- package/dist/types/clipboard/paste.d.ts +1 -1
- package/dist/types/convenience/click.d.ts +1 -1
- package/dist/types/convenience/hover.d.ts +1 -1
- package/dist/types/document/UI.d.ts +42 -0
- package/dist/types/{utils/focus → document}/copySelection.d.ts +0 -0
- package/dist/types/document/getValueOrTextContent.d.ts +1 -0
- package/dist/types/document/index.d.ts +5 -10
- package/dist/types/document/interceptor.d.ts +3 -0
- package/dist/types/document/prepareDocument.d.ts +8 -0
- package/dist/types/document/trackValue.d.ts +17 -0
- package/dist/types/event/behavior/registry.d.ts +2 -2
- package/dist/types/event/dispatchEvent.d.ts +5 -2
- package/dist/types/event/focus.d.ts +5 -0
- package/dist/types/event/index.d.ts +6 -4
- package/dist/types/event/input.d.ts +2 -0
- package/dist/types/event/radio.d.ts +4 -0
- package/dist/types/event/selection/getInputRange.d.ts +5 -0
- package/dist/types/event/selection/getTargetTypeAndSelection.d.ts +10 -0
- package/dist/types/event/selection/index.d.ts +15 -0
- package/dist/types/event/selection/modifySelection.d.ts +8 -0
- package/dist/types/event/selection/modifySelectionPerMouse.d.ts +7 -0
- package/dist/types/event/selection/moveSelection.d.ts +4 -0
- package/dist/types/{utils/focus → event/selection}/resolveCaretPosition.d.ts +0 -0
- package/dist/types/{utils/focus → event/selection}/selectAll.d.ts +0 -0
- package/dist/types/event/selection/setSelection.d.ts +10 -0
- package/dist/types/event/selection/setSelectionPerMouse.d.ts +8 -0
- package/dist/types/event/selection/setSelectionRange.d.ts +6 -0
- package/dist/types/event/selection/updateSelectionOnFocus.d.ts +5 -0
- package/dist/types/keyboard/index.d.ts +2 -2
- package/dist/types/options.d.ts +0 -8
- package/dist/types/pointer/index.d.ts +3 -3
- package/dist/types/setup/directApi.d.ts +1 -1
- package/dist/types/setup/index.d.ts +2 -15
- package/dist/types/setup/setup.d.ts +25 -7
- package/dist/types/system/keyboard.d.ts +3 -3
- package/dist/types/system/pointer/buttons.d.ts +1 -1
- package/dist/types/system/pointer/index.d.ts +7 -25
- package/dist/types/system/pointer/mouse.d.ts +5 -5
- package/dist/types/system/pointer/pointer.d.ts +7 -7
- package/dist/types/system/pointer/shared.d.ts +20 -0
- package/dist/types/utility/clear.d.ts +1 -1
- package/dist/types/utility/selectOptions.d.ts +1 -1
- package/dist/types/utility/type.d.ts +3 -3
- package/dist/types/utility/upload.d.ts +1 -1
- package/dist/types/utils/click/isClickableInput.d.ts +2 -2
- package/dist/types/utils/edit/isEditable.d.ts +5 -6
- package/dist/types/utils/edit/maxLength.d.ts +14 -1
- package/dist/types/utils/edit/{isValidDateOrTimeValue.d.ts → timeValue.d.ts} +1 -0
- package/dist/types/utils/focus/selection.d.ts +4 -69
- package/dist/types/utils/index.d.ts +2 -9
- package/dist/types/utils/misc/level.d.ts +4 -13
- package/dist/types/utils/misc/wait.d.ts +2 -2
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +4 -4
- package/package.json +29 -4
- package/dist/cjs/document/selection.js +0 -107
- package/dist/cjs/document/setRangeText.js +0 -21
- package/dist/cjs/document/value.js +0 -125
- package/dist/cjs/setup/config.js +0 -7
- package/dist/cjs/utils/edit/getValue.js +0 -35
- package/dist/cjs/utils/edit/isValidDateOrTimeValue.js +0 -11
- package/dist/cjs/utils/focus/blur.js +0 -16
- package/dist/cjs/utils/focus/copySelection.js +0 -46
- package/dist/cjs/utils/focus/focus.js +0 -26
- package/dist/cjs/utils/focus/selectAll.js +0 -54
- package/dist/cjs/utils/misc/eventWrapper.js +0 -15
- package/dist/esm/document/selection.js +0 -99
- package/dist/esm/document/setRangeText.js +0 -17
- package/dist/esm/document/value.js +0 -115
- package/dist/esm/setup/config.js +0 -3
- package/dist/esm/utils/edit/getValue.js +0 -31
- package/dist/esm/utils/edit/isValidDateOrTimeValue.js +0 -7
- package/dist/esm/utils/focus/blur.js +0 -12
- package/dist/esm/utils/focus/copySelection.js +0 -42
- package/dist/esm/utils/focus/focus.js +0 -22
- package/dist/esm/utils/focus/selectAll.js +0 -49
- package/dist/esm/utils/misc/eventWrapper.js +0 -11
- package/dist/types/document/selection.d.ts +0 -29
- package/dist/types/document/setRangeText.d.ts +0 -1
- package/dist/types/document/value.d.ts +0 -26
- package/dist/types/setup/config.d.ts +0 -6
- package/dist/types/utils/edit/buildTimeValue.d.ts +0 -1
- package/dist/types/utils/edit/getValue.d.ts +0 -1
- package/dist/types/utils/edit/input.d.ts +0 -2
- package/dist/types/utils/edit/walkRadio.d.ts +0 -4
- package/dist/types/utils/focus/blur.d.ts +0 -2
- package/dist/types/utils/focus/focus.d.ts +0 -5
- package/dist/types/utils/misc/eventWrapper.d.ts +0 -1
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var eventWrapper = require('../misc/eventWrapper.js');
|
|
6
|
-
var getActiveElement = require('./getActiveElement.js');
|
|
7
|
-
var isFocusable = require('./isFocusable.js');
|
|
8
|
-
|
|
9
|
-
function blur(element) {
|
|
10
|
-
if (!isFocusable.isFocusable(element)) return;
|
|
11
|
-
const wasActive = getActiveElement.getActiveElement(element.ownerDocument) === element;
|
|
12
|
-
if (!wasActive) return;
|
|
13
|
-
eventWrapper.eventWrapper(()=>element.blur());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.blur = blur;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('../click/isClickableInput.js');
|
|
6
|
-
var DataTransfer = require('../dataTransfer/DataTransfer.js');
|
|
7
|
-
require('../dataTransfer/Clipboard.js');
|
|
8
|
-
require('../edit/maxLength.js');
|
|
9
|
-
require('../edit/isEditable.js');
|
|
10
|
-
require('@testing-library/dom');
|
|
11
|
-
var selection = require('./selection.js');
|
|
12
|
-
var getWindow = require('../misc/getWindow.js');
|
|
13
|
-
require('../keyDef/readNextDescriptor.js');
|
|
14
|
-
require('../misc/level.js');
|
|
15
|
-
require('../../options.js');
|
|
16
|
-
require('../../event/eventMap.js');
|
|
17
|
-
require('../../event/behavior/click.js');
|
|
18
|
-
require('../../event/behavior/cut.js');
|
|
19
|
-
require('../../event/behavior/keydown.js');
|
|
20
|
-
require('../../event/behavior/keypress.js');
|
|
21
|
-
require('../../event/behavior/keyup.js');
|
|
22
|
-
require('../../event/behavior/paste.js');
|
|
23
|
-
var selection$1 = require('../../document/selection.js');
|
|
24
|
-
var value = require('../../document/value.js');
|
|
25
|
-
|
|
26
|
-
function copySelection(target) {
|
|
27
|
-
const data = selection.hasOwnSelection(target) ? {
|
|
28
|
-
'text/plain': readSelectedValueFromInput(target)
|
|
29
|
-
} : {
|
|
30
|
-
'text/plain': String(target.ownerDocument.getSelection())
|
|
31
|
-
};
|
|
32
|
-
const dt = DataTransfer.createDataTransfer(getWindow.getWindow(target));
|
|
33
|
-
for(const type in data){
|
|
34
|
-
if (data[type]) {
|
|
35
|
-
dt.setData(type, data[type]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return dt;
|
|
39
|
-
}
|
|
40
|
-
function readSelectedValueFromInput(target) {
|
|
41
|
-
const sel = selection$1.getUISelection(target);
|
|
42
|
-
const val = value.getUIValue(target);
|
|
43
|
-
return val.substring(sel.startOffset, sel.endOffset);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.copySelection = copySelection;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var eventWrapper = require('../misc/eventWrapper.js');
|
|
6
|
-
var findClosest = require('../misc/findClosest.js');
|
|
7
|
-
var getActiveElement = require('./getActiveElement.js');
|
|
8
|
-
var isFocusable = require('./isFocusable.js');
|
|
9
|
-
var selection = require('./selection.js');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Focus closest focusable element.
|
|
13
|
-
*/ function focus(element) {
|
|
14
|
-
const target = findClosest.findClosest(element, isFocusable.isFocusable);
|
|
15
|
-
const activeElement = getActiveElement.getActiveElement(element.ownerDocument);
|
|
16
|
-
if ((target ?? element.ownerDocument.body) === activeElement) {
|
|
17
|
-
return;
|
|
18
|
-
} else if (target) {
|
|
19
|
-
eventWrapper.eventWrapper(()=>target.focus());
|
|
20
|
-
} else {
|
|
21
|
-
eventWrapper.eventWrapper(()=>activeElement?.blur());
|
|
22
|
-
}
|
|
23
|
-
selection.updateSelectionOnFocus(target ?? element.ownerDocument.body);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
exports.focus = focus;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
require('../click/isClickableInput.js');
|
|
6
|
-
require('../dataTransfer/Clipboard.js');
|
|
7
|
-
var isContentEditable = require('../edit/isContentEditable.js');
|
|
8
|
-
require('../edit/maxLength.js');
|
|
9
|
-
var isEditable = require('../edit/isEditable.js');
|
|
10
|
-
require('@testing-library/dom');
|
|
11
|
-
var isElementType = require('../misc/isElementType.js');
|
|
12
|
-
var selection = require('./selection.js');
|
|
13
|
-
require('@testing-library/dom/dist/helpers.js');
|
|
14
|
-
require('../keyDef/readNextDescriptor.js');
|
|
15
|
-
require('../misc/level.js');
|
|
16
|
-
require('../../options.js');
|
|
17
|
-
require('../../event/eventMap.js');
|
|
18
|
-
require('../../event/behavior/click.js');
|
|
19
|
-
require('../../event/behavior/cut.js');
|
|
20
|
-
require('../../event/behavior/keydown.js');
|
|
21
|
-
require('../../event/behavior/keypress.js');
|
|
22
|
-
require('../../event/behavior/keyup.js');
|
|
23
|
-
require('../../event/behavior/paste.js');
|
|
24
|
-
var selection$1 = require('../../document/selection.js');
|
|
25
|
-
var value = require('../../document/value.js');
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Expand a selection like the browser does when pressing Ctrl+A.
|
|
29
|
-
*/ function selectAll(target) {
|
|
30
|
-
if (isElementType.isElementType(target, 'textarea') || isElementType.isElementType(target, 'input') && target.type in isEditable.editableInputTypes) {
|
|
31
|
-
return selection.setSelection({
|
|
32
|
-
focusNode: target,
|
|
33
|
-
anchorOffset: 0,
|
|
34
|
-
focusOffset: value.getUIValue(target).length
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const focusNode = isContentEditable.getContentEditable(target) ?? target.ownerDocument.body;
|
|
38
|
-
selection.setSelection({
|
|
39
|
-
focusNode,
|
|
40
|
-
anchorOffset: 0,
|
|
41
|
-
focusOffset: focusNode.childNodes.length
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function isAllSelected(target) {
|
|
45
|
-
if (isElementType.isElementType(target, 'textarea') || isElementType.isElementType(target, 'input') && target.type in isEditable.editableInputTypes) {
|
|
46
|
-
return selection$1.getUISelection(target).startOffset === 0 && selection$1.getUISelection(target).endOffset === value.getUIValue(target).length;
|
|
47
|
-
}
|
|
48
|
-
const focusNode = isContentEditable.getContentEditable(target) ?? target.ownerDocument.body;
|
|
49
|
-
const selection = target.ownerDocument.getSelection();
|
|
50
|
-
return selection?.anchorNode === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
exports.isAllSelected = isAllSelected;
|
|
54
|
-
exports.selectAll = selectAll;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dom = require('@testing-library/dom');
|
|
6
|
-
|
|
7
|
-
function eventWrapper(cb) {
|
|
8
|
-
let result;
|
|
9
|
-
dom.getConfig().eventWrapper(()=>{
|
|
10
|
-
result = cb();
|
|
11
|
-
});
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports.eventWrapper = eventWrapper;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import '../utils/click/isClickableInput.js';
|
|
2
|
-
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../utils/edit/maxLength.js';
|
|
4
|
-
import '../utils/edit/isEditable.js';
|
|
5
|
-
import '@testing-library/dom';
|
|
6
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
7
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
8
|
-
import '../utils/misc/level.js';
|
|
9
|
-
import '../options.js';
|
|
10
|
-
import '../event/eventMap.js';
|
|
11
|
-
import '../event/behavior/click.js';
|
|
12
|
-
import '../event/behavior/cut.js';
|
|
13
|
-
import '../event/behavior/keydown.js';
|
|
14
|
-
import '../event/behavior/keypress.js';
|
|
15
|
-
import '../event/behavior/keyup.js';
|
|
16
|
-
import '../event/behavior/paste.js';
|
|
17
|
-
import { prepareInterceptor } from './interceptor.js';
|
|
18
|
-
import { getUIValue } from './value.js';
|
|
19
|
-
|
|
20
|
-
const UISelection = Symbol('Displayed selection in UI');
|
|
21
|
-
function prepareSelectionInterceptor(element) {
|
|
22
|
-
prepareInterceptor(element, 'setSelectionRange', function interceptorImpl(start, ...others) {
|
|
23
|
-
const isUI = start && typeof start === 'object' && start[UISelection];
|
|
24
|
-
if (!isUI) {
|
|
25
|
-
this[UISelection] = undefined;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
applyNative: !!isUI,
|
|
29
|
-
realArgs: [
|
|
30
|
-
Number(start),
|
|
31
|
-
...others
|
|
32
|
-
]
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
prepareInterceptor(element, 'selectionStart', function interceptorImpl(v) {
|
|
36
|
-
this[UISelection] = undefined;
|
|
37
|
-
return {
|
|
38
|
-
realArgs: v
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
prepareInterceptor(element, 'selectionEnd', function interceptorImpl(v) {
|
|
42
|
-
this[UISelection] = undefined;
|
|
43
|
-
return {
|
|
44
|
-
realArgs: v
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
prepareInterceptor(element, 'select', function interceptorImpl() {
|
|
48
|
-
this[UISelection] = {
|
|
49
|
-
anchorOffset: 0,
|
|
50
|
-
focusOffset: getUIValue(element).length
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
realArgs: []
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
|
|
58
|
-
const valueLength = getUIValue(element).length;
|
|
59
|
-
const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
|
|
60
|
-
const anchorOffset = mode === 'replace' || element[UISelection] === undefined ? sanitizeOffset(anchorOffsetParam) : element[UISelection].anchorOffset;
|
|
61
|
-
const focusOffset = sanitizeOffset(focusOffsetParam);
|
|
62
|
-
const startOffset = Math.min(anchorOffset, focusOffset);
|
|
63
|
-
const endOffset = Math.max(anchorOffset, focusOffset);
|
|
64
|
-
element[UISelection] = {
|
|
65
|
-
anchorOffset,
|
|
66
|
-
focusOffset
|
|
67
|
-
};
|
|
68
|
-
if (element.selectionStart === startOffset && element.selectionEnd === endOffset) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
// eslint-disable-next-line no-new-wrappers
|
|
72
|
-
const startObj = new Number(startOffset);
|
|
73
|
-
startObj[UISelection] = UISelection;
|
|
74
|
-
try {
|
|
75
|
-
element.setSelectionRange(startObj, endOffset);
|
|
76
|
-
} catch {
|
|
77
|
-
// DOMException for invalid state is expected when calling this
|
|
78
|
-
// on an element without support for setSelectionRange
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function getUISelection(element) {
|
|
82
|
-
const sel = element[UISelection] ?? {
|
|
83
|
-
anchorOffset: element.selectionStart ?? 0,
|
|
84
|
-
focusOffset: element.selectionEnd ?? 0
|
|
85
|
-
};
|
|
86
|
-
return {
|
|
87
|
-
...sel,
|
|
88
|
-
startOffset: Math.min(sel.anchorOffset, sel.focusOffset),
|
|
89
|
-
endOffset: Math.max(sel.anchorOffset, sel.focusOffset)
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function hasUISelection(element) {
|
|
93
|
-
return !!element[UISelection];
|
|
94
|
-
}
|
|
95
|
-
/** Flag the IDL selection as clean. This does not change the selection. */ function setUISelectionClean(element) {
|
|
96
|
-
element[UISelection] = undefined;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { getUISelection, hasUISelection, prepareSelectionInterceptor, setUISelection, setUISelectionClean };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { prepareInterceptor } from './interceptor.js';
|
|
2
|
-
import { setUISelectionClean } from './selection.js';
|
|
3
|
-
import { setUIValueClean } from './value.js';
|
|
4
|
-
|
|
5
|
-
function prepareRangeTextInterceptor(element) {
|
|
6
|
-
prepareInterceptor(element, 'setRangeText', function interceptorImpl(...realArgs) {
|
|
7
|
-
return {
|
|
8
|
-
realArgs,
|
|
9
|
-
then: ()=>{
|
|
10
|
-
setUIValueClean(element);
|
|
11
|
-
setUISelectionClean(element);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { prepareRangeTextInterceptor };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import '../utils/click/isClickableInput.js';
|
|
2
|
-
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../event/eventMap.js';
|
|
4
|
-
import '../event/behavior/click.js';
|
|
5
|
-
import '../event/behavior/cut.js';
|
|
6
|
-
import '../event/behavior/keydown.js';
|
|
7
|
-
import '../event/behavior/keypress.js';
|
|
8
|
-
import '../event/behavior/keyup.js';
|
|
9
|
-
import '../event/behavior/paste.js';
|
|
10
|
-
import '@testing-library/dom';
|
|
11
|
-
import { hasUISelection, setUISelection } from './selection.js';
|
|
12
|
-
import { prepareInterceptor } from './interceptor.js';
|
|
13
|
-
import '../utils/edit/maxLength.js';
|
|
14
|
-
import '../utils/edit/isEditable.js';
|
|
15
|
-
import { isElementType } from '../utils/misc/isElementType.js';
|
|
16
|
-
import { getWindow } from '../utils/misc/getWindow.js';
|
|
17
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
18
|
-
import '../utils/misc/level.js';
|
|
19
|
-
import '../options.js';
|
|
20
|
-
|
|
21
|
-
const UIValue = Symbol('Displayed value in UI');
|
|
22
|
-
const InitialValue = Symbol('Initial value to compare on blur');
|
|
23
|
-
const TrackChanges = Symbol('Track programmatic changes for React workaround');
|
|
24
|
-
function valueInterceptor(v) {
|
|
25
|
-
const isUI = typeof v === 'object' && v[UIValue];
|
|
26
|
-
if (isUI) {
|
|
27
|
-
this[UIValue] = String(v);
|
|
28
|
-
startTrackValue(this);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
applyNative: !!isUI,
|
|
32
|
-
realArgs: sanitizeValue(this, v),
|
|
33
|
-
then: isUI ? undefined : ()=>trackOrSetValue(this, String(v))
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function sanitizeValue(element, v) {
|
|
37
|
-
// Workaround for JSDOM
|
|
38
|
-
if (isElementType(element, 'input', {
|
|
39
|
-
type: 'number'
|
|
40
|
-
}) && String(v) !== '' && !Number.isNaN(Number(v))) {
|
|
41
|
-
// Setting value to "1." results in `null` in JSDOM
|
|
42
|
-
return String(Number(v));
|
|
43
|
-
}
|
|
44
|
-
return String(v);
|
|
45
|
-
}
|
|
46
|
-
function prepareValueInterceptor(element) {
|
|
47
|
-
prepareInterceptor(element, 'value', valueInterceptor);
|
|
48
|
-
}
|
|
49
|
-
function setUIValue(element, value) {
|
|
50
|
-
if (element[InitialValue] === undefined) {
|
|
51
|
-
element[InitialValue] = element.value;
|
|
52
|
-
}
|
|
53
|
-
element.value = {
|
|
54
|
-
[UIValue]: UIValue,
|
|
55
|
-
toString: ()=>value
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function getUIValue(element) {
|
|
59
|
-
return element[UIValue] === undefined ? element.value : String(element[UIValue]);
|
|
60
|
-
}
|
|
61
|
-
/** Flag the IDL value as clean. This does not change the value.*/ function setUIValueClean(element) {
|
|
62
|
-
element[UIValue] = undefined;
|
|
63
|
-
}
|
|
64
|
-
function clearInitialValue(element) {
|
|
65
|
-
element[InitialValue] = undefined;
|
|
66
|
-
}
|
|
67
|
-
function getInitialValue(element) {
|
|
68
|
-
return element[InitialValue];
|
|
69
|
-
}
|
|
70
|
-
// When the input event happens in the browser, React executes all event handlers
|
|
71
|
-
// and if they change state of a controlled value, nothing happens.
|
|
72
|
-
// But when we trigger the event handlers in test environment with React@17,
|
|
73
|
-
// the changes are rolled back before the state update is applied.
|
|
74
|
-
// This results in a reset cursor.
|
|
75
|
-
// There might be a better way to work around if we figure out
|
|
76
|
-
// why the batched update is executed differently in our test environment.
|
|
77
|
-
function isReact17Element(element) {
|
|
78
|
-
return Object.getOwnPropertyNames(element).some((k)=>k.startsWith('__react')) && getWindow(element).REACT_VERSION === 17;
|
|
79
|
-
}
|
|
80
|
-
function startTrackValue(element) {
|
|
81
|
-
if (!isReact17Element(element)) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
element[TrackChanges] = {
|
|
85
|
-
previousValue: String(element.value),
|
|
86
|
-
tracked: []
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function trackOrSetValue(element, v) {
|
|
90
|
-
element[TrackChanges]?.tracked?.push(v);
|
|
91
|
-
if (!element[TrackChanges]) {
|
|
92
|
-
setUIValueClean(element);
|
|
93
|
-
setUISelection(element, {
|
|
94
|
-
focusOffset: v.length
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function commitValueAfterInput(element, cursorOffset) {
|
|
99
|
-
const changes = element[TrackChanges];
|
|
100
|
-
element[TrackChanges] = undefined;
|
|
101
|
-
if (!changes?.tracked?.length) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
105
|
-
if (!isJustReactStateUpdate) {
|
|
106
|
-
setUIValueClean(element);
|
|
107
|
-
}
|
|
108
|
-
if (hasUISelection(element)) {
|
|
109
|
-
setUISelection(element, {
|
|
110
|
-
focusOffset: isJustReactStateUpdate ? cursorOffset : element.value.length
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { clearInitialValue, commitValueAfterInput, getInitialValue, getUIValue, prepareValueInterceptor, setUIValue, setUIValueClean };
|
package/dist/esm/setup/config.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import '../click/isClickableInput.js';
|
|
2
|
-
import '../dataTransfer/Clipboard.js';
|
|
3
|
-
import './maxLength.js';
|
|
4
|
-
import { isContentEditable } from './isContentEditable.js';
|
|
5
|
-
import './isEditable.js';
|
|
6
|
-
import '@testing-library/dom';
|
|
7
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
8
|
-
import '../keyDef/readNextDescriptor.js';
|
|
9
|
-
import '../misc/level.js';
|
|
10
|
-
import '../../options.js';
|
|
11
|
-
import '../../event/eventMap.js';
|
|
12
|
-
import '../../event/behavior/click.js';
|
|
13
|
-
import '../../event/behavior/cut.js';
|
|
14
|
-
import '../../event/behavior/keydown.js';
|
|
15
|
-
import '../../event/behavior/keypress.js';
|
|
16
|
-
import '../../event/behavior/keyup.js';
|
|
17
|
-
import '../../event/behavior/paste.js';
|
|
18
|
-
import { getUIValue } from '../../document/value.js';
|
|
19
|
-
|
|
20
|
-
function getValue(element) {
|
|
21
|
-
// istanbul ignore if
|
|
22
|
-
if (!element) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
if (isContentEditable(element)) {
|
|
26
|
-
return element.textContent;
|
|
27
|
-
}
|
|
28
|
-
return getUIValue(element);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { getValue };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { eventWrapper } from '../misc/eventWrapper.js';
|
|
2
|
-
import { getActiveElement } from './getActiveElement.js';
|
|
3
|
-
import { isFocusable } from './isFocusable.js';
|
|
4
|
-
|
|
5
|
-
function blur(element) {
|
|
6
|
-
if (!isFocusable(element)) return;
|
|
7
|
-
const wasActive = getActiveElement(element.ownerDocument) === element;
|
|
8
|
-
if (!wasActive) return;
|
|
9
|
-
eventWrapper(()=>element.blur());
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { blur };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import '../click/isClickableInput.js';
|
|
2
|
-
import { createDataTransfer } from '../dataTransfer/DataTransfer.js';
|
|
3
|
-
import '../dataTransfer/Clipboard.js';
|
|
4
|
-
import '../edit/maxLength.js';
|
|
5
|
-
import '../edit/isEditable.js';
|
|
6
|
-
import '@testing-library/dom';
|
|
7
|
-
import { hasOwnSelection } from './selection.js';
|
|
8
|
-
import { getWindow } from '../misc/getWindow.js';
|
|
9
|
-
import '../keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../misc/level.js';
|
|
11
|
-
import '../../options.js';
|
|
12
|
-
import '../../event/eventMap.js';
|
|
13
|
-
import '../../event/behavior/click.js';
|
|
14
|
-
import '../../event/behavior/cut.js';
|
|
15
|
-
import '../../event/behavior/keydown.js';
|
|
16
|
-
import '../../event/behavior/keypress.js';
|
|
17
|
-
import '../../event/behavior/keyup.js';
|
|
18
|
-
import '../../event/behavior/paste.js';
|
|
19
|
-
import { getUISelection } from '../../document/selection.js';
|
|
20
|
-
import { getUIValue } from '../../document/value.js';
|
|
21
|
-
|
|
22
|
-
function copySelection(target) {
|
|
23
|
-
const data = hasOwnSelection(target) ? {
|
|
24
|
-
'text/plain': readSelectedValueFromInput(target)
|
|
25
|
-
} : {
|
|
26
|
-
'text/plain': String(target.ownerDocument.getSelection())
|
|
27
|
-
};
|
|
28
|
-
const dt = createDataTransfer(getWindow(target));
|
|
29
|
-
for(const type in data){
|
|
30
|
-
if (data[type]) {
|
|
31
|
-
dt.setData(type, data[type]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return dt;
|
|
35
|
-
}
|
|
36
|
-
function readSelectedValueFromInput(target) {
|
|
37
|
-
const sel = getUISelection(target);
|
|
38
|
-
const val = getUIValue(target);
|
|
39
|
-
return val.substring(sel.startOffset, sel.endOffset);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { copySelection };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { eventWrapper } from '../misc/eventWrapper.js';
|
|
2
|
-
import { findClosest } from '../misc/findClosest.js';
|
|
3
|
-
import { getActiveElement } from './getActiveElement.js';
|
|
4
|
-
import { isFocusable } from './isFocusable.js';
|
|
5
|
-
import { updateSelectionOnFocus } from './selection.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Focus closest focusable element.
|
|
9
|
-
*/ function focus(element) {
|
|
10
|
-
const target = findClosest(element, isFocusable);
|
|
11
|
-
const activeElement = getActiveElement(element.ownerDocument);
|
|
12
|
-
if ((target ?? element.ownerDocument.body) === activeElement) {
|
|
13
|
-
return;
|
|
14
|
-
} else if (target) {
|
|
15
|
-
eventWrapper(()=>target.focus());
|
|
16
|
-
} else {
|
|
17
|
-
eventWrapper(()=>activeElement?.blur());
|
|
18
|
-
}
|
|
19
|
-
updateSelectionOnFocus(target ?? element.ownerDocument.body);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { focus };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import '../click/isClickableInput.js';
|
|
2
|
-
import '../dataTransfer/Clipboard.js';
|
|
3
|
-
import { getContentEditable } from '../edit/isContentEditable.js';
|
|
4
|
-
import '../edit/maxLength.js';
|
|
5
|
-
import { editableInputTypes } from '../edit/isEditable.js';
|
|
6
|
-
import '@testing-library/dom';
|
|
7
|
-
import { isElementType } from '../misc/isElementType.js';
|
|
8
|
-
import { setSelection } from './selection.js';
|
|
9
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
10
|
-
import '../keyDef/readNextDescriptor.js';
|
|
11
|
-
import '../misc/level.js';
|
|
12
|
-
import '../../options.js';
|
|
13
|
-
import '../../event/eventMap.js';
|
|
14
|
-
import '../../event/behavior/click.js';
|
|
15
|
-
import '../../event/behavior/cut.js';
|
|
16
|
-
import '../../event/behavior/keydown.js';
|
|
17
|
-
import '../../event/behavior/keypress.js';
|
|
18
|
-
import '../../event/behavior/keyup.js';
|
|
19
|
-
import '../../event/behavior/paste.js';
|
|
20
|
-
import { getUISelection } from '../../document/selection.js';
|
|
21
|
-
import { getUIValue } from '../../document/value.js';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Expand a selection like the browser does when pressing Ctrl+A.
|
|
25
|
-
*/ function selectAll(target) {
|
|
26
|
-
if (isElementType(target, 'textarea') || isElementType(target, 'input') && target.type in editableInputTypes) {
|
|
27
|
-
return setSelection({
|
|
28
|
-
focusNode: target,
|
|
29
|
-
anchorOffset: 0,
|
|
30
|
-
focusOffset: getUIValue(target).length
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const focusNode = getContentEditable(target) ?? target.ownerDocument.body;
|
|
34
|
-
setSelection({
|
|
35
|
-
focusNode,
|
|
36
|
-
anchorOffset: 0,
|
|
37
|
-
focusOffset: focusNode.childNodes.length
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function isAllSelected(target) {
|
|
41
|
-
if (isElementType(target, 'textarea') || isElementType(target, 'input') && target.type in editableInputTypes) {
|
|
42
|
-
return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;
|
|
43
|
-
}
|
|
44
|
-
const focusNode = getContentEditable(target) ?? target.ownerDocument.body;
|
|
45
|
-
const selection = target.ownerDocument.getSelection();
|
|
46
|
-
return selection?.anchorNode === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { isAllSelected, selectAll };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare const UISelection: unique symbol;
|
|
2
|
-
export interface UISelectionRange {
|
|
3
|
-
startOffset: number;
|
|
4
|
-
endOffset: number;
|
|
5
|
-
}
|
|
6
|
-
export interface UISelection {
|
|
7
|
-
anchorOffset: number;
|
|
8
|
-
focusOffset: number;
|
|
9
|
-
}
|
|
10
|
-
declare global {
|
|
11
|
-
interface Element {
|
|
12
|
-
[UISelection]?: UISelection;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare function prepareSelectionInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
16
|
-
export declare function setUISelection(element: HTMLInputElement | HTMLTextAreaElement, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam, }: {
|
|
17
|
-
anchorOffset?: number;
|
|
18
|
-
focusOffset: number;
|
|
19
|
-
}, mode?: 'replace' | 'modify'): void;
|
|
20
|
-
export declare function getUISelection(element: HTMLInputElement | HTMLTextAreaElement): {
|
|
21
|
-
startOffset: number;
|
|
22
|
-
endOffset: number;
|
|
23
|
-
anchorOffset: number;
|
|
24
|
-
focusOffset: number;
|
|
25
|
-
};
|
|
26
|
-
export declare function hasUISelection(element: HTMLInputElement | HTMLTextAreaElement): boolean;
|
|
27
|
-
/** Flag the IDL selection as clean. This does not change the selection. */
|
|
28
|
-
export declare function setUISelectionClean(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
29
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function prepareRangeTextInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
declare const UIValue: unique symbol;
|
|
2
|
-
declare const InitialValue: unique symbol;
|
|
3
|
-
declare const TrackChanges: unique symbol;
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
REACT_VERSION?: number;
|
|
7
|
-
}
|
|
8
|
-
interface Element {
|
|
9
|
-
[UIValue]?: string;
|
|
10
|
-
[InitialValue]?: string;
|
|
11
|
-
[TrackChanges]?: {
|
|
12
|
-
previousValue?: string;
|
|
13
|
-
tracked?: string[];
|
|
14
|
-
nextValue?: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export declare function prepareValueInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
19
|
-
export declare function setUIValue(element: HTMLInputElement | HTMLTextAreaElement, value: string): void;
|
|
20
|
-
export declare function getUIValue(element: HTMLInputElement | HTMLTextAreaElement): string;
|
|
21
|
-
/** Flag the IDL value as clean. This does not change the value.*/
|
|
22
|
-
export declare function setUIValueClean(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
23
|
-
export declare function clearInitialValue(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
24
|
-
export declare function getInitialValue(element: HTMLInputElement | HTMLTextAreaElement): string | undefined;
|
|
25
|
-
export declare function commitValueAfterInput(element: HTMLInputElement | HTMLTextAreaElement, cursorOffset: number): void;
|
|
26
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function buildTimeValue(value: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getValue<T extends Element | null>(element: T): T extends HTMLInputElement | HTMLTextAreaElement ? string : string | null;
|