@testing-library/user-event 14.4.2 → 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 +4 -14
- package/dist/cjs/clipboard/cut.js +4 -14
- package/dist/cjs/clipboard/paste.js +2 -12
- package/dist/cjs/convenience/click.js +1 -4
- package/dist/cjs/convenience/hover.js +2 -12
- package/dist/cjs/document/{selection.js → UI.js} +43 -57
- 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 +83 -0
- 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 +39 -43
- package/dist/cjs/event/behavior/keypress.js +8 -9
- package/dist/cjs/event/behavior/keyup.js +5 -7
- package/dist/cjs/event/behavior/paste.js +5 -11
- package/dist/cjs/event/createEvent.js +2 -9
- package/dist/cjs/event/dispatchEvent.js +20 -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 +48 -46
- 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 +9 -17
- 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 +1 -9
- package/dist/cjs/options.js +0 -28
- package/dist/cjs/pointer/index.js +20 -30
- 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 +65 -37
- package/dist/cjs/system/keyboard.js +7 -9
- package/dist/cjs/system/pointer/index.js +16 -21
- package/dist/cjs/system/pointer/mouse.js +45 -38
- package/dist/cjs/system/pointer/pointer.js +33 -35
- 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 +3 -13
- package/dist/cjs/utils/dataTransfer/Clipboard.js +1 -15
- package/dist/cjs/utils/edit/isEditable.js +6 -10
- package/dist/cjs/utils/edit/maxLength.js +4 -15
- package/dist/cjs/utils/edit/{buildTimeValue.js → timeValue.js} +6 -0
- package/dist/cjs/utils/focus/cursor.js +0 -16
- package/dist/cjs/utils/focus/selection.js +1 -271
- package/dist/cjs/utils/index.js +7 -32
- package/dist/cjs/utils/misc/level.js +4 -9
- package/dist/cjs/utils/pointer/cssPointerEvents.js +9 -22
- package/dist/esm/clipboard/copy.js +4 -14
- package/dist/esm/clipboard/cut.js +4 -14
- package/dist/esm/clipboard/paste.js +2 -12
- package/dist/esm/convenience/click.js +1 -4
- package/dist/esm/convenience/hover.js +2 -12
- package/dist/esm/document/{selection.js → UI.js} +35 -56
- 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 +81 -1
- package/dist/esm/document/prepareDocument.js +63 -0
- package/dist/esm/document/{value.js → trackValue.js} +3 -61
- 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 +32 -36
- package/dist/esm/event/behavior/keypress.js +8 -9
- package/dist/esm/event/behavior/keyup.js +5 -7
- package/dist/esm/event/behavior/paste.js +5 -11
- package/dist/esm/event/createEvent.js +2 -9
- package/dist/esm/event/dispatchEvent.js +19 -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 +35 -33
- 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 +8 -16
- package/dist/esm/{utils/focus → event/selection}/selectAll.js +12 -21
- 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 +1 -9
- package/dist/esm/options.js +1 -26
- package/dist/esm/pointer/index.js +20 -30
- 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 +59 -32
- package/dist/esm/system/keyboard.js +7 -9
- package/dist/esm/system/pointer/index.js +17 -21
- package/dist/esm/system/pointer/mouse.js +42 -35
- package/dist/esm/system/pointer/pointer.js +32 -34
- 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 +5 -14
- package/dist/esm/utility/upload.js +3 -13
- package/dist/esm/utils/dataTransfer/Clipboard.js +1 -15
- package/dist/esm/utils/edit/isEditable.js +4 -8
- package/dist/esm/utils/edit/maxLength.js +3 -15
- package/dist/esm/utils/edit/{buildTimeValue.js → timeValue.js} +6 -1
- package/dist/esm/utils/focus/cursor.js +0 -16
- package/dist/esm/utils/focus/selection.js +3 -265
- package/dist/esm/utils/index.js +4 -11
- package/dist/esm/utils/misc/level.js +4 -9
- package/dist/esm/utils/pointer/cssPointerEvents.js +9 -22
- 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 +3 -2
- package/dist/cjs/document/setRangeText.js +0 -21
- package/dist/cjs/document/value.js +0 -127
- 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 -29
- package/dist/cjs/utils/focus/selectAll.js +0 -56
- package/dist/cjs/utils/misc/eventWrapper.js +0 -15
- package/dist/esm/document/setRangeText.js +0 -17
- 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 -25
- 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,25 +1,15 @@
|
|
|
1
|
-
import '../setup/index.js';
|
|
2
1
|
import '../utils/click/isClickableInput.js';
|
|
3
2
|
import { writeDataTransferToClipboard } from '../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../event/eventMap.js';
|
|
5
|
-
import '../event/behavior/click.js';
|
|
6
|
-
import '../event/behavior/cut.js';
|
|
7
|
-
import '../event/behavior/keydown.js';
|
|
8
|
-
import '../event/behavior/keypress.js';
|
|
9
|
-
import '../event/behavior/keyup.js';
|
|
10
|
-
import '../event/behavior/paste.js';
|
|
11
|
-
import '@testing-library/dom';
|
|
12
|
-
import '../utils/edit/maxLength.js';
|
|
13
3
|
import '../utils/edit/isEditable.js';
|
|
4
|
+
import '../utils/edit/maxLength.js';
|
|
14
5
|
import '@testing-library/dom/dist/helpers.js';
|
|
15
|
-
import { copySelection } from '../utils/focus/copySelection.js';
|
|
16
6
|
import '../utils/keyDef/readNextDescriptor.js';
|
|
17
7
|
import '../utils/misc/level.js';
|
|
18
8
|
import '../options.js';
|
|
19
|
-
import {
|
|
9
|
+
import { copySelection } from '../document/copySelection.js';
|
|
20
10
|
|
|
21
11
|
async function cut() {
|
|
22
|
-
const doc = this
|
|
12
|
+
const doc = this.config.document;
|
|
23
13
|
var _activeElement;
|
|
24
14
|
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body;
|
|
25
15
|
const clipboardData = copySelection(target);
|
|
@@ -28,7 +18,7 @@ async function cut() {
|
|
|
28
18
|
}
|
|
29
19
|
if (this.dispatchUIEvent(target, 'cut', {
|
|
30
20
|
clipboardData
|
|
31
|
-
}) && this
|
|
21
|
+
}) && this.config.writeToClipboard) {
|
|
32
22
|
await writeDataTransferToClipboard(target.ownerDocument, clipboardData);
|
|
33
23
|
}
|
|
34
24
|
return clipboardData;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import '../setup/index.js';
|
|
2
1
|
import '../utils/click/isClickableInput.js';
|
|
3
2
|
import { createDataTransfer } from '../utils/dataTransfer/DataTransfer.js';
|
|
4
3
|
import { readDataTransferFromClipboard } from '../utils/dataTransfer/Clipboard.js';
|
|
5
|
-
import '../event/eventMap.js';
|
|
6
|
-
import '../event/behavior/click.js';
|
|
7
|
-
import '../event/behavior/cut.js';
|
|
8
|
-
import '../event/behavior/keydown.js';
|
|
9
|
-
import '../event/behavior/keypress.js';
|
|
10
|
-
import '../event/behavior/keyup.js';
|
|
11
|
-
import '../event/behavior/paste.js';
|
|
12
|
-
import '@testing-library/dom';
|
|
13
|
-
import '../utils/edit/maxLength.js';
|
|
14
4
|
import '../utils/edit/isEditable.js';
|
|
5
|
+
import '../utils/edit/maxLength.js';
|
|
15
6
|
import { getWindow } from '../utils/misc/getWindow.js';
|
|
16
7
|
import '../utils/keyDef/readNextDescriptor.js';
|
|
17
8
|
import '../utils/misc/level.js';
|
|
18
9
|
import '../options.js';
|
|
19
|
-
import { Config } from '../setup/config.js';
|
|
20
10
|
|
|
21
11
|
async function paste(clipboardData) {
|
|
22
|
-
const doc = this
|
|
12
|
+
const doc = this.config.document;
|
|
23
13
|
var _activeElement;
|
|
24
14
|
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body;
|
|
25
15
|
var ref;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import '../setup/index.js';
|
|
2
1
|
import '../utils/click/isClickableInput.js';
|
|
3
2
|
import '../utils/dataTransfer/Clipboard.js';
|
|
4
|
-
import '../event/eventMap.js';
|
|
5
|
-
import '../event/behavior/click.js';
|
|
6
|
-
import '../event/behavior/cut.js';
|
|
7
|
-
import '../event/behavior/keydown.js';
|
|
8
|
-
import '../event/behavior/keypress.js';
|
|
9
|
-
import '../event/behavior/keyup.js';
|
|
10
|
-
import '../event/behavior/paste.js';
|
|
11
|
-
import '@testing-library/dom';
|
|
12
|
-
import '../utils/edit/maxLength.js';
|
|
13
3
|
import '../utils/edit/isEditable.js';
|
|
4
|
+
import '../utils/edit/maxLength.js';
|
|
14
5
|
import '@testing-library/dom/dist/helpers.js';
|
|
15
6
|
import '../utils/keyDef/readNextDescriptor.js';
|
|
16
7
|
import '../utils/misc/level.js';
|
|
17
8
|
import { assertPointerEvents } from '../utils/pointer/cssPointerEvents.js';
|
|
18
|
-
import { Config } from '../setup/config.js';
|
|
19
9
|
|
|
20
10
|
async function hover(element) {
|
|
21
11
|
return this.pointer({
|
|
@@ -23,7 +13,7 @@ async function hover(element) {
|
|
|
23
13
|
});
|
|
24
14
|
}
|
|
25
15
|
async function unhover(element) {
|
|
26
|
-
assertPointerEvents(this
|
|
16
|
+
assertPointerEvents(this, this.system.pointer.getMouseTarget(this));
|
|
27
17
|
return this.pointer({
|
|
28
18
|
target: element.ownerDocument.body
|
|
29
19
|
});
|
|
@@ -1,59 +1,37 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
const UIValue = Symbol('Displayed value in UI');
|
|
20
2
|
const UISelection = Symbol('Displayed selection in UI');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
};
|
|
3
|
+
const InitialValue = Symbol('Initial value to compare on blur');
|
|
4
|
+
function isUIValue(value) {
|
|
5
|
+
return typeof value === 'object' && UIValue in value;
|
|
6
|
+
}
|
|
7
|
+
function isUISelectionStart(start) {
|
|
8
|
+
return !!start && typeof start === 'object' && UISelection in start;
|
|
9
|
+
}
|
|
10
|
+
function setUIValue(element, value) {
|
|
11
|
+
if (element[InitialValue] === undefined) {
|
|
12
|
+
element[InitialValue] = element.value;
|
|
13
|
+
}
|
|
14
|
+
element[UIValue] = value;
|
|
15
|
+
// eslint-disable-next-line no-new-wrappers
|
|
16
|
+
element.value = Object.assign(new String(value), {
|
|
17
|
+
[UIValue]: true
|
|
55
18
|
});
|
|
56
19
|
}
|
|
20
|
+
function getUIValue(element) {
|
|
21
|
+
return element[UIValue] === undefined ? element.value : String(element[UIValue]);
|
|
22
|
+
}
|
|
23
|
+
/** Flag the IDL value as clean. This does not change the value.*/ function setUIValueClean(element) {
|
|
24
|
+
element[UIValue] = undefined;
|
|
25
|
+
}
|
|
26
|
+
function clearInitialValue(element) {
|
|
27
|
+
element[InitialValue] = undefined;
|
|
28
|
+
}
|
|
29
|
+
function getInitialValue(element) {
|
|
30
|
+
return element[InitialValue];
|
|
31
|
+
}
|
|
32
|
+
function setUISelectionRaw(element, selection) {
|
|
33
|
+
element[UISelection] = selection;
|
|
34
|
+
}
|
|
57
35
|
function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
|
|
58
36
|
const valueLength = getUIValue(element).length;
|
|
59
37
|
const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
|
|
@@ -69,8 +47,9 @@ function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset:
|
|
|
69
47
|
return;
|
|
70
48
|
}
|
|
71
49
|
// eslint-disable-next-line no-new-wrappers
|
|
72
|
-
const startObj = new Number(startOffset)
|
|
73
|
-
|
|
50
|
+
const startObj = Object.assign(new Number(startOffset), {
|
|
51
|
+
[UISelection]: true
|
|
52
|
+
});
|
|
74
53
|
try {
|
|
75
54
|
element.setSelectionRange(startObj, endOffset);
|
|
76
55
|
} catch {
|
|
@@ -97,4 +76,4 @@ function hasUISelection(element) {
|
|
|
97
76
|
element[UISelection] = undefined;
|
|
98
77
|
}
|
|
99
78
|
|
|
100
|
-
export { getUISelection, hasUISelection,
|
|
79
|
+
export { clearInitialValue, getInitialValue, getUISelection, getUIValue, hasUISelection, isUISelectionStart, isUIValue, setUISelection, setUISelectionClean, setUISelectionRaw, setUIValue, setUIValueClean };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../utils/click/isClickableInput.js';
|
|
2
|
+
import { createDataTransfer } from '../utils/dataTransfer/DataTransfer.js';
|
|
3
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
4
|
+
import '../utils/edit/isEditable.js';
|
|
5
|
+
import '../utils/edit/maxLength.js';
|
|
6
|
+
import { getWindow } from '../utils/misc/getWindow.js';
|
|
7
|
+
import { hasOwnSelection } from '../utils/focus/selection.js';
|
|
8
|
+
import '../utils/keyDef/readNextDescriptor.js';
|
|
9
|
+
import '../utils/misc/level.js';
|
|
10
|
+
import '../options.js';
|
|
11
|
+
import { getUISelection, getUIValue } from './UI.js';
|
|
12
|
+
|
|
13
|
+
function copySelection(target) {
|
|
14
|
+
const data = hasOwnSelection(target) ? {
|
|
15
|
+
'text/plain': readSelectedValueFromInput(target)
|
|
16
|
+
} : {
|
|
17
|
+
'text/plain': String(target.ownerDocument.getSelection())
|
|
18
|
+
};
|
|
19
|
+
const dt = createDataTransfer(getWindow(target));
|
|
20
|
+
for(const type in data){
|
|
21
|
+
if (data[type]) {
|
|
22
|
+
dt.setData(type, data[type]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return dt;
|
|
26
|
+
}
|
|
27
|
+
function readSelectedValueFromInput(target) {
|
|
28
|
+
const sel = getUISelection(target);
|
|
29
|
+
const val = getUIValue(target);
|
|
30
|
+
return val.substring(sel.startOffset, sel.endOffset);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { copySelection };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import '../utils/click/isClickableInput.js';
|
|
2
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
+
import { isContentEditable } from '../utils/edit/isContentEditable.js';
|
|
4
|
+
import '../utils/edit/isEditable.js';
|
|
5
|
+
import '../utils/edit/maxLength.js';
|
|
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 { getUIValue } from './UI.js';
|
|
11
|
+
|
|
12
|
+
function getValueOrTextContent(element) {
|
|
13
|
+
// istanbul ignore if
|
|
14
|
+
if (!element) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (isContentEditable(element)) {
|
|
18
|
+
return element.textContent;
|
|
19
|
+
}
|
|
20
|
+
return getUIValue(element);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { getValueOrTextContent };
|
|
@@ -1,66 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '../utils/edit/isEditable.js';
|
|
6
|
-
import '@testing-library/dom';
|
|
7
|
-
import { isElementType } from '../utils/misc/isElementType.js';
|
|
8
|
-
import '@testing-library/dom/dist/helpers.js';
|
|
9
|
-
import '../utils/keyDef/readNextDescriptor.js';
|
|
10
|
-
import '../utils/misc/level.js';
|
|
11
|
-
import '../options.js';
|
|
12
|
-
import { prepareSelectionInterceptor } from './selection.js';
|
|
13
|
-
export { getUISelection, setUISelection } from './selection.js';
|
|
14
|
-
import { prepareRangeTextInterceptor } from './setRangeText.js';
|
|
15
|
-
import { getInitialValue, clearInitialValue, prepareValueInterceptor } from './value.js';
|
|
16
|
-
export { clearInitialValue, commitValueAfterInput, getUIValue, setUIValue } from './value.js';
|
|
17
|
-
|
|
18
|
-
const isPrepared = Symbol('Node prepared with document state workarounds');
|
|
19
|
-
function prepareDocument(document) {
|
|
20
|
-
if (document[isPrepared]) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
document.addEventListener('focus', (e)=>{
|
|
24
|
-
const el = e.target;
|
|
25
|
-
prepareElement(el);
|
|
26
|
-
}, {
|
|
27
|
-
capture: true,
|
|
28
|
-
passive: true
|
|
29
|
-
});
|
|
30
|
-
// Our test environment defaults to `document.body` as `activeElement`.
|
|
31
|
-
// In other environments this might be `null` when preparing.
|
|
32
|
-
// istanbul ignore else
|
|
33
|
-
if (document.activeElement) {
|
|
34
|
-
prepareElement(document.activeElement);
|
|
35
|
-
}
|
|
36
|
-
document.addEventListener('blur', (e)=>{
|
|
37
|
-
const el = e.target;
|
|
38
|
-
const initialValue = getInitialValue(el);
|
|
39
|
-
if (initialValue !== undefined) {
|
|
40
|
-
if (el.value !== initialValue) {
|
|
41
|
-
dispatchUIEvent({}, el, 'change');
|
|
42
|
-
}
|
|
43
|
-
clearInitialValue(el);
|
|
44
|
-
}
|
|
45
|
-
}, {
|
|
46
|
-
capture: true,
|
|
47
|
-
passive: true
|
|
48
|
-
});
|
|
49
|
-
document[isPrepared] = isPrepared;
|
|
50
|
-
}
|
|
51
|
-
function prepareElement(el) {
|
|
52
|
-
if (el[isPrepared]) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (isElementType(el, [
|
|
56
|
-
'input',
|
|
57
|
-
'textarea'
|
|
58
|
-
])) {
|
|
59
|
-
prepareValueInterceptor(el);
|
|
60
|
-
prepareSelectionInterceptor(el);
|
|
61
|
-
prepareRangeTextInterceptor(el);
|
|
62
|
-
}
|
|
63
|
-
el[isPrepared] = isPrepared;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { prepareDocument };
|
|
1
|
+
export { clearInitialValue, getUISelection, getUIValue, setUISelection, setUIValue } from './UI.js';
|
|
2
|
+
export { getValueOrTextContent } from './getValueOrTextContent.js';
|
|
3
|
+
export { copySelection } from './copySelection.js';
|
|
4
|
+
export { commitValueAfterInput } from './trackValue.js';
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import '../utils/click/isClickableInput.js';
|
|
2
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
3
|
+
import '../utils/edit/isEditable.js';
|
|
4
|
+
import '../utils/edit/maxLength.js';
|
|
5
|
+
import { isElementType } from '../utils/misc/isElementType.js';
|
|
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 { startTrackValue, trackOrSetValue } from './trackValue.js';
|
|
11
|
+
import { setUISelectionClean, setUISelectionRaw, getUIValue, setUIValueClean, isUIValue, isUISelectionStart } from './UI.js';
|
|
12
|
+
|
|
1
13
|
const Interceptor = Symbol('Interceptor for programmatical calls');
|
|
2
14
|
function prepareInterceptor(element, propName, interceptorImpl) {
|
|
3
15
|
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
|
|
@@ -22,5 +34,73 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
22
34
|
[target]: intercept
|
|
23
35
|
});
|
|
24
36
|
}
|
|
37
|
+
function prepareValueInterceptor(element) {
|
|
38
|
+
prepareInterceptor(element, 'value', function interceptorImpl(v) {
|
|
39
|
+
const isUI = isUIValue(v);
|
|
40
|
+
if (isUI) {
|
|
41
|
+
startTrackValue(this);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
applyNative: !!isUI,
|
|
45
|
+
realArgs: sanitizeValue(this, v),
|
|
46
|
+
then: isUI ? undefined : ()=>trackOrSetValue(this, String(v))
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function sanitizeValue(element, v) {
|
|
51
|
+
// Workaround for JSDOM
|
|
52
|
+
if (isElementType(element, 'input', {
|
|
53
|
+
type: 'number'
|
|
54
|
+
}) && String(v) !== '' && !Number.isNaN(Number(v))) {
|
|
55
|
+
// Setting value to "1." results in `null` in JSDOM
|
|
56
|
+
return String(Number(v));
|
|
57
|
+
}
|
|
58
|
+
return String(v);
|
|
59
|
+
}
|
|
60
|
+
function prepareSelectionInterceptor(element) {
|
|
61
|
+
prepareInterceptor(element, 'setSelectionRange', function interceptorImpl(start, ...others) {
|
|
62
|
+
const isUI = isUISelectionStart(start);
|
|
63
|
+
return {
|
|
64
|
+
applyNative: !!isUI,
|
|
65
|
+
realArgs: [
|
|
66
|
+
Number(start),
|
|
67
|
+
...others
|
|
68
|
+
],
|
|
69
|
+
then: ()=>isUI ? undefined : setUISelectionClean(element)
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
prepareInterceptor(element, 'selectionStart', function interceptorImpl(v) {
|
|
73
|
+
return {
|
|
74
|
+
realArgs: v,
|
|
75
|
+
then: ()=>setUISelectionClean(element)
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
prepareInterceptor(element, 'selectionEnd', function interceptorImpl(v) {
|
|
79
|
+
return {
|
|
80
|
+
realArgs: v,
|
|
81
|
+
then: ()=>setUISelectionClean(element)
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
prepareInterceptor(element, 'select', function interceptorImpl() {
|
|
85
|
+
return {
|
|
86
|
+
realArgs: [],
|
|
87
|
+
then: ()=>setUISelectionRaw(element, {
|
|
88
|
+
anchorOffset: 0,
|
|
89
|
+
focusOffset: getUIValue(element).length
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function prepareRangeTextInterceptor(element) {
|
|
95
|
+
prepareInterceptor(element, 'setRangeText', function interceptorImpl(...realArgs) {
|
|
96
|
+
return {
|
|
97
|
+
realArgs,
|
|
98
|
+
then: ()=>{
|
|
99
|
+
setUIValueClean(element);
|
|
100
|
+
setUISelectionClean(element);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
25
105
|
|
|
26
|
-
export { prepareInterceptor };
|
|
106
|
+
export { prepareInterceptor, prepareRangeTextInterceptor, prepareSelectionInterceptor, prepareValueInterceptor };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { dispatchDOMEvent } from '../event/dispatchEvent.js';
|
|
2
|
+
import '../utils/click/isClickableInput.js';
|
|
3
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
4
|
+
import '../utils/edit/isEditable.js';
|
|
5
|
+
import '../utils/edit/maxLength.js';
|
|
6
|
+
import { isElementType } from '../utils/misc/isElementType.js';
|
|
7
|
+
import '@testing-library/dom/dist/helpers.js';
|
|
8
|
+
import '../utils/keyDef/readNextDescriptor.js';
|
|
9
|
+
import '../utils/misc/level.js';
|
|
10
|
+
import '../options.js';
|
|
11
|
+
import { getInitialValue, clearInitialValue } from './UI.js';
|
|
12
|
+
import '@testing-library/dom';
|
|
13
|
+
import { prepareValueInterceptor, prepareSelectionInterceptor, prepareRangeTextInterceptor } from './interceptor.js';
|
|
14
|
+
|
|
15
|
+
const isPrepared = Symbol('Node prepared with document state workarounds');
|
|
16
|
+
function prepareDocument(document) {
|
|
17
|
+
if (document[isPrepared]) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
document.addEventListener('focus', (e)=>{
|
|
21
|
+
const el = e.target;
|
|
22
|
+
prepareElement(el);
|
|
23
|
+
}, {
|
|
24
|
+
capture: true,
|
|
25
|
+
passive: true
|
|
26
|
+
});
|
|
27
|
+
// Our test environment defaults to `document.body` as `activeElement`.
|
|
28
|
+
// In other environments this might be `null` when preparing.
|
|
29
|
+
// istanbul ignore else
|
|
30
|
+
if (document.activeElement) {
|
|
31
|
+
prepareElement(document.activeElement);
|
|
32
|
+
}
|
|
33
|
+
document.addEventListener('blur', (e)=>{
|
|
34
|
+
const el = e.target;
|
|
35
|
+
const initialValue = getInitialValue(el);
|
|
36
|
+
if (initialValue !== undefined) {
|
|
37
|
+
if (el.value !== initialValue) {
|
|
38
|
+
dispatchDOMEvent(el, 'change');
|
|
39
|
+
}
|
|
40
|
+
clearInitialValue(el);
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
capture: true,
|
|
44
|
+
passive: true
|
|
45
|
+
});
|
|
46
|
+
document[isPrepared] = isPrepared;
|
|
47
|
+
}
|
|
48
|
+
function prepareElement(el) {
|
|
49
|
+
if (el[isPrepared]) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (isElementType(el, [
|
|
53
|
+
'input',
|
|
54
|
+
'textarea'
|
|
55
|
+
])) {
|
|
56
|
+
prepareValueInterceptor(el);
|
|
57
|
+
prepareSelectionInterceptor(el);
|
|
58
|
+
prepareRangeTextInterceptor(el);
|
|
59
|
+
}
|
|
60
|
+
el[isPrepared] = isPrepared;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { prepareDocument };
|
|
@@ -1,72 +1,14 @@
|
|
|
1
1
|
import '../utils/click/isClickableInput.js';
|
|
2
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
3
|
import '../utils/edit/isEditable.js';
|
|
15
|
-
import
|
|
4
|
+
import '../utils/edit/maxLength.js';
|
|
16
5
|
import { getWindow } from '../utils/misc/getWindow.js';
|
|
17
6
|
import '../utils/keyDef/readNextDescriptor.js';
|
|
18
7
|
import '../utils/misc/level.js';
|
|
19
8
|
import '../options.js';
|
|
9
|
+
import { setUIValueClean, setUISelection, hasUISelection } from './UI.js';
|
|
20
10
|
|
|
21
|
-
const UIValue = Symbol('Displayed value in UI');
|
|
22
|
-
const InitialValue = Symbol('Initial value to compare on blur');
|
|
23
11
|
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
12
|
// When the input event happens in the browser, React executes all event handlers
|
|
71
13
|
// and if they change state of a controlled value, nothing happens.
|
|
72
14
|
// But when we trigger the event handlers in test environment with React@17,
|
|
@@ -114,4 +56,4 @@ function commitValueAfterInput(element, cursorOffset) {
|
|
|
114
56
|
}
|
|
115
57
|
}
|
|
116
58
|
|
|
117
|
-
export {
|
|
59
|
+
export { commitValueAfterInput, startTrackValue, trackOrSetValue };
|
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
import '../../utils/click/isClickableInput.js';
|
|
2
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../eventMap.js';
|
|
4
|
-
import { dispatchEvent } from '../dispatchEvent.js';
|
|
5
|
-
import '../../utils/edit/maxLength.js';
|
|
6
3
|
import '../../utils/edit/isEditable.js';
|
|
7
|
-
import
|
|
8
|
-
import { getWindow } from '../../utils/misc/getWindow.js';
|
|
4
|
+
import '../../utils/edit/maxLength.js';
|
|
9
5
|
import { isElementType } from '../../utils/misc/isElementType.js';
|
|
10
|
-
import {
|
|
6
|
+
import { getWindow } from '../../utils/misc/getWindow.js';
|
|
11
7
|
import { isFocusable } from '../../utils/focus/isFocusable.js';
|
|
12
8
|
import '../../utils/keyDef/readNextDescriptor.js';
|
|
13
9
|
import { cloneEvent } from '../../utils/misc/cloneEvent.js';
|
|
14
|
-
import '@testing-library/dom';
|
|
15
10
|
import '../../utils/misc/level.js';
|
|
16
11
|
import '../../options.js';
|
|
12
|
+
import { focusElement, blurElement } from '../focus.js';
|
|
17
13
|
import { behavior } from './registry.js';
|
|
18
14
|
|
|
19
|
-
behavior.click = (event, target,
|
|
15
|
+
behavior.click = (event, target, instance)=>{
|
|
20
16
|
const context = target.closest('button,input,label,select,textarea');
|
|
21
17
|
const control = context && isElementType(context, 'label') && context.control;
|
|
22
18
|
if (control) {
|
|
23
19
|
return ()=>{
|
|
24
20
|
if (isFocusable(control)) {
|
|
25
|
-
|
|
21
|
+
focusElement(control);
|
|
26
22
|
}
|
|
27
|
-
dispatchEvent(
|
|
23
|
+
instance.dispatchEvent(control, cloneEvent(event));
|
|
28
24
|
};
|
|
29
25
|
} else if (isElementType(target, 'input', {
|
|
30
26
|
type: 'file'
|
|
31
27
|
})) {
|
|
32
28
|
return ()=>{
|
|
33
29
|
// blur fires when the file selector pops up
|
|
34
|
-
|
|
30
|
+
blurElement(target);
|
|
35
31
|
target.dispatchEvent(new (getWindow(target)).Event('fileDialog'));
|
|
36
32
|
// focus fires after the file selector has been closed
|
|
37
|
-
|
|
33
|
+
focusElement(target);
|
|
38
34
|
};
|
|
39
35
|
}
|
|
40
36
|
};
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import '../../utils/click/isClickableInput.js';
|
|
2
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
3
|
-
import '../eventMap.js';
|
|
4
|
-
import './click.js';
|
|
5
|
-
import './keydown.js';
|
|
6
|
-
import './keypress.js';
|
|
7
|
-
import './keyup.js';
|
|
8
|
-
import './paste.js';
|
|
9
|
-
import { behavior } from './registry.js';
|
|
10
|
-
import '@testing-library/dom';
|
|
11
|
-
import { input } from '../../utils/edit/input.js';
|
|
12
3
|
import { isEditable } from '../../utils/edit/isEditable.js';
|
|
4
|
+
import '../../utils/edit/maxLength.js';
|
|
13
5
|
import '@testing-library/dom/dist/helpers.js';
|
|
14
6
|
import '../../utils/keyDef/readNextDescriptor.js';
|
|
15
7
|
import '../../utils/misc/level.js';
|
|
16
8
|
import '../../options.js';
|
|
9
|
+
import { input } from '../input.js';
|
|
10
|
+
import { behavior } from './registry.js';
|
|
17
11
|
|
|
18
|
-
behavior.cut = (event, target,
|
|
12
|
+
behavior.cut = (event, target, instance)=>{
|
|
19
13
|
return ()=>{
|
|
20
14
|
if (isEditable(target)) {
|
|
21
|
-
input(
|
|
15
|
+
input(instance, target, '', 'deleteByCut');
|
|
22
16
|
}
|
|
23
17
|
};
|
|
24
18
|
};
|