@testing-library/user-event 14.4.3 → 14.5.0
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/_interop/dtl.js +30 -0
- package/dist/cjs/_interop/dtlEventMap.js +30 -0
- package/dist/cjs/_interop/dtlHelpers.js +30 -0
- package/dist/cjs/clipboard/copy.js +2 -2
- package/dist/cjs/clipboard/cut.js +2 -2
- package/dist/cjs/clipboard/paste.js +4 -4
- package/dist/cjs/convenience/tab.js +1 -1
- package/dist/cjs/document/UI.js +5 -5
- package/dist/cjs/document/interceptor.js +6 -4
- package/dist/cjs/document/trackValue.js +4 -4
- package/dist/cjs/event/behavior/keydown.js +6 -6
- package/dist/cjs/event/behavior/keypress.js +4 -3
- package/dist/cjs/event/behavior/keyup.js +2 -2
- package/dist/cjs/event/behavior/paste.js +2 -2
- package/dist/cjs/event/createEvent.js +41 -41
- package/dist/cjs/event/dispatchEvent.js +2 -2
- package/dist/cjs/event/eventMap.js +2 -2
- package/dist/cjs/event/focus.js +2 -2
- package/dist/cjs/event/input.js +4 -4
- package/dist/cjs/event/selection/getInputRange.js +2 -2
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +3 -2
- package/dist/cjs/event/selection/modifySelection.js +3 -3
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +4 -3
- package/dist/cjs/event/selection/moveSelection.js +6 -5
- package/dist/cjs/event/selection/resolveCaretPosition.js +1 -1
- package/dist/cjs/event/selection/selectAll.js +6 -5
- package/dist/cjs/event/selection/setSelection.js +3 -3
- package/dist/cjs/event/selection/setSelectionPerMouse.js +8 -7
- package/dist/cjs/event/selection/setSelectionRange.js +2 -2
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +4 -3
- package/dist/cjs/event/wrapEvent.js +3 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/keyboard/index.js +2 -2
- package/dist/cjs/keyboard/parseKeyDef.js +8 -8
- package/dist/cjs/pointer/index.js +11 -11
- package/dist/cjs/pointer/keyMap.js +1 -1
- package/dist/cjs/pointer/parseKeyDef.js +1 -1
- package/dist/cjs/setup/api.js +19 -17
- package/dist/cjs/setup/directApi.js +3 -3
- package/dist/cjs/setup/setup.js +10 -10
- package/dist/cjs/setup/wrapAsync.js +3 -2
- package/dist/cjs/system/index.js +15 -2
- package/dist/cjs/system/keyboard.js +27 -12
- package/dist/cjs/system/pointer/buttons.js +14 -1
- package/dist/cjs/system/pointer/device.js +14 -1
- package/dist/cjs/system/pointer/index.js +46 -26
- package/dist/cjs/system/pointer/mouse.js +33 -19
- package/dist/cjs/system/pointer/pointer.js +24 -8
- package/dist/cjs/system/pointer/shared.js +2 -2
- package/dist/cjs/utility/selectOptions.js +12 -11
- package/dist/cjs/utility/type.js +1 -1
- package/dist/cjs/utility/upload.js +6 -5
- package/dist/cjs/utils/dataTransfer/Clipboard.js +25 -9
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +25 -9
- package/dist/cjs/utils/edit/maxLength.js +2 -2
- package/dist/cjs/utils/edit/setFiles.js +4 -4
- package/dist/cjs/utils/focus/cursor.js +2 -2
- package/dist/cjs/utils/focus/getActiveElement.js +4 -3
- package/dist/cjs/utils/focus/selector.js +1 -1
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/cjs/utils/misc/getTreeDiff.js +3 -3
- package/dist/cjs/utils/misc/getWindow.js +3 -2
- package/dist/cjs/utils/misc/isDisabled.js +3 -3
- package/dist/cjs/utils/misc/isVisible.js +3 -2
- package/dist/cjs/utils/misc/wait.js +1 -1
- package/dist/cjs/utils/pointer/cssPointerEvents.js +23 -19
- package/dist/esm/_interop/dtl.js +6 -0
- package/dist/esm/_interop/dtlEventMap.js +6 -0
- package/dist/esm/_interop/dtlHelpers.js +6 -0
- package/dist/esm/clipboard/copy.js +2 -2
- package/dist/esm/clipboard/cut.js +2 -2
- package/dist/esm/clipboard/paste.js +4 -4
- package/dist/esm/convenience/tab.js +1 -1
- package/dist/esm/document/UI.js +5 -5
- package/dist/esm/document/interceptor.js +6 -4
- package/dist/esm/document/trackValue.js +4 -4
- package/dist/esm/event/behavior/keydown.js +6 -6
- package/dist/esm/event/behavior/keypress.js +4 -3
- package/dist/esm/event/behavior/keyup.js +2 -2
- package/dist/esm/event/behavior/paste.js +2 -2
- package/dist/esm/event/createEvent.js +41 -41
- package/dist/esm/event/dispatchEvent.js +2 -2
- package/dist/esm/event/eventMap.js +2 -2
- package/dist/esm/event/focus.js +2 -2
- package/dist/esm/event/input.js +4 -4
- package/dist/esm/event/selection/getInputRange.js +2 -2
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +3 -2
- package/dist/esm/event/selection/modifySelection.js +3 -3
- package/dist/esm/event/selection/modifySelectionPerMouse.js +4 -3
- package/dist/esm/event/selection/moveSelection.js +6 -5
- package/dist/esm/event/selection/resolveCaretPosition.js +1 -1
- package/dist/esm/event/selection/selectAll.js +6 -5
- package/dist/esm/event/selection/setSelection.js +3 -3
- package/dist/esm/event/selection/setSelectionPerMouse.js +8 -7
- package/dist/esm/event/selection/setSelectionRange.js +2 -2
- package/dist/esm/event/selection/updateSelectionOnFocus.js +4 -3
- package/dist/esm/event/wrapEvent.js +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/keyboard/index.js +2 -2
- package/dist/esm/keyboard/parseKeyDef.js +8 -8
- package/dist/esm/pointer/index.js +11 -11
- package/dist/esm/pointer/keyMap.js +1 -1
- package/dist/esm/pointer/parseKeyDef.js +1 -1
- package/dist/esm/setup/api.js +33 -12
- package/dist/esm/setup/directApi.js +3 -3
- package/dist/esm/setup/setup.js +11 -11
- package/dist/esm/setup/wrapAsync.js +2 -1
- package/dist/esm/system/index.js +15 -2
- package/dist/esm/system/keyboard.js +27 -12
- package/dist/esm/system/pointer/buttons.js +14 -1
- package/dist/esm/system/pointer/device.js +14 -1
- package/dist/esm/system/pointer/index.js +46 -26
- package/dist/esm/system/pointer/mouse.js +33 -19
- package/dist/esm/system/pointer/pointer.js +24 -8
- package/dist/esm/system/pointer/shared.js +2 -2
- package/dist/esm/utility/selectOptions.js +8 -7
- package/dist/esm/utility/type.js +1 -1
- package/dist/esm/utility/upload.js +6 -5
- package/dist/esm/utils/dataTransfer/Clipboard.js +25 -9
- package/dist/esm/utils/dataTransfer/DataTransfer.js +25 -9
- package/dist/esm/utils/edit/maxLength.js +2 -2
- package/dist/esm/utils/edit/setFiles.js +4 -4
- package/dist/esm/utils/focus/cursor.js +2 -2
- package/dist/esm/utils/focus/getActiveElement.js +4 -3
- package/dist/esm/utils/focus/selector.js +1 -1
- package/dist/esm/utils/keyDef/readNextDescriptor.js +5 -5
- package/dist/esm/utils/misc/getTreeDiff.js +3 -3
- package/dist/esm/utils/misc/getWindow.js +2 -1
- package/dist/esm/utils/misc/isDisabled.js +3 -3
- package/dist/esm/utils/misc/isVisible.js +3 -2
- package/dist/esm/utils/misc/wait.js +1 -1
- package/dist/esm/utils/pointer/cssPointerEvents.js +23 -19
- package/dist/types/_interop/dtl.d.ts +3 -0
- package/dist/types/_interop/dtlEventMap.d.ts +3 -0
- package/dist/types/_interop/dtlHelpers.d.ts +3 -0
- 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/convenience/tab.d.ts +1 -1
- package/dist/types/document/UI.d.ts +3 -3
- package/dist/types/document/interceptor.d.ts +3 -3
- package/dist/types/event/behavior/registry.d.ts +1 -1
- package/dist/types/event/createEvent.d.ts +1 -1
- package/dist/types/event/dispatchEvent.d.ts +1 -1
- package/dist/types/event/eventMap.d.ts +8 -0
- package/dist/types/event/input.d.ts +1 -1
- package/dist/types/event/radio.d.ts +1 -1
- package/dist/types/event/selection/index.d.ts +2 -2
- package/dist/types/event/selection/modifySelectionPerMouse.d.ts +1 -1
- package/dist/types/event/selection/setSelectionPerMouse.d.ts +1 -1
- package/dist/types/event/types.d.ts +3 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/keyboard/index.d.ts +1 -1
- package/dist/types/options.d.ts +2 -2
- package/dist/types/pointer/index.d.ts +7 -7
- package/dist/types/setup/api.d.ts +23 -5
- package/dist/types/setup/directApi.d.ts +5 -5
- package/dist/types/setup/setup.d.ts +5 -5
- package/dist/types/system/keyboard.d.ts +2 -2
- package/dist/types/system/pointer/buttons.d.ts +2 -2
- package/dist/types/system/pointer/device.d.ts +1 -1
- package/dist/types/system/pointer/mouse.d.ts +2 -2
- package/dist/types/system/pointer/pointer.d.ts +2 -2
- 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 +2 -2
- package/dist/types/utility/upload.d.ts +1 -1
- package/dist/types/utils/click/isClickableInput.d.ts +1 -1
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +1 -1
- package/dist/types/utils/edit/isEditable.d.ts +2 -2
- package/dist/types/utils/edit/maxLength.d.ts +1 -1
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +1 -1
- package/dist/types/utils/misc/isElementType.d.ts +1 -1
- package/dist/types/utils/misc/level.d.ts +2 -2
- package/dist/types/utils/misc/wait.d.ts +1 -1
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +1 -1
- package/package.json +22 -11
- /package/dist/cjs/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/cjs/{utils/misc → _interop}/dom-helpers.d.js +0 -0
- /package/dist/esm/{event → _interop}/dom-events.d.js +0 -0
- /package/dist/esm/{utils/misc → _interop}/dom-helpers.d.js +0 -0
|
@@ -41,16 +41,16 @@ function readPrintableChar(text, pos, context) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function readTag(text, pos, startBracket, context) {
|
|
44
|
-
var
|
|
44
|
+
var _text_slice_match, _text_slice_match1;
|
|
45
45
|
const releasePreviousModifier = text[pos] === '/' ? '/' : '';
|
|
46
46
|
pos += releasePreviousModifier.length;
|
|
47
47
|
const escapedDescriptor = startBracket === '{' && text[pos] === '\\';
|
|
48
48
|
pos += Number(escapedDescriptor);
|
|
49
|
-
const descriptor = escapedDescriptor ? text[pos] : (
|
|
49
|
+
const descriptor = escapedDescriptor ? text[pos] : (_text_slice_match = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || _text_slice_match === void 0 ? void 0 : _text_slice_match[0];
|
|
50
50
|
assertDescriptor(descriptor, text, pos, context);
|
|
51
51
|
pos += descriptor.length;
|
|
52
|
-
var
|
|
53
|
-
const repeatModifier = (
|
|
52
|
+
var _text_slice_match_;
|
|
53
|
+
const repeatModifier = (_text_slice_match_ = (_text_slice_match1 = text.slice(pos).match(/^>\d+/)) === null || _text_slice_match1 === void 0 ? void 0 : _text_slice_match1[0]) !== null && _text_slice_match_ !== void 0 ? _text_slice_match_ : '';
|
|
54
54
|
pos += repeatModifier.length;
|
|
55
55
|
const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : '';
|
|
56
56
|
pos += releaseSelfModifier.length;
|
|
@@ -60,7 +60,7 @@ function readTag(text, pos, startBracket, context) {
|
|
|
60
60
|
throw new Error(getErrorMessage([
|
|
61
61
|
!repeatModifier && 'repeat modifier',
|
|
62
62
|
!releaseSelfModifier && 'release modifier',
|
|
63
|
-
`"${expectedEndBracket}"
|
|
63
|
+
`"${expectedEndBracket}"`
|
|
64
64
|
].filter(Boolean).join(' or '), text[pos], text, context));
|
|
65
65
|
}
|
|
66
66
|
pos += endBracket.length;
|
|
@@ -8,8 +8,8 @@ function getTreeDiff(a, b) {
|
|
|
8
8
|
treeA.push(el);
|
|
9
9
|
}
|
|
10
10
|
const treeB = [];
|
|
11
|
-
for(let
|
|
12
|
-
treeB.push(
|
|
11
|
+
for(let el = b; el; el = el.parentElement){
|
|
12
|
+
treeB.push(el);
|
|
13
13
|
}
|
|
14
14
|
let i = 0;
|
|
15
15
|
for(;; i++){
|
|
@@ -20,7 +20,7 @@ function getTreeDiff(a, b) {
|
|
|
20
20
|
return [
|
|
21
21
|
treeA.slice(0, treeA.length - i),
|
|
22
22
|
treeB.slice(0, treeB.length - i),
|
|
23
|
-
treeB.slice(treeB.length - i)
|
|
23
|
+
treeB.slice(treeB.length - i)
|
|
24
24
|
];
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var dtlHelpers = require('../../_interop/dtlHelpers.js');
|
|
6
6
|
|
|
7
|
+
const { getWindowFromNode } = dtlHelpers;
|
|
7
8
|
function getWindow(node) {
|
|
8
|
-
return
|
|
9
|
+
return getWindowFromNode(node);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
exports.getWindow = getWindow;
|
|
@@ -13,14 +13,14 @@ function isDisabled(element) {
|
|
|
13
13
|
'select',
|
|
14
14
|
'textarea',
|
|
15
15
|
'optgroup',
|
|
16
|
-
'option'
|
|
16
|
+
'option'
|
|
17
17
|
])) {
|
|
18
18
|
if (el.hasAttribute('disabled')) {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
} else if (isElementType.isElementType(el, 'fieldset')) {
|
|
22
|
-
var
|
|
23
|
-
if (el.hasAttribute('disabled') && !((
|
|
22
|
+
var _el_querySelector;
|
|
23
|
+
if (el.hasAttribute('disabled') && !((_el_querySelector = el.querySelector(':scope > legend')) === null || _el_querySelector === void 0 ? void 0 : _el_querySelector.contains(element))) {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
} else if (el.tagName.includes('-')) {
|
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var getWindow = require('./getWindow.js');
|
|
6
6
|
|
|
7
7
|
function isVisible(element) {
|
|
8
|
+
var _el;
|
|
8
9
|
const window = getWindow.getWindow(element);
|
|
9
|
-
for(let el = element; el === null ||
|
|
10
|
-
const { display
|
|
10
|
+
for(let el = element; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
|
|
11
|
+
const { display, visibility } = window.getComputedStyle(el);
|
|
11
12
|
if (display === 'none') {
|
|
12
13
|
return false;
|
|
13
14
|
}
|
|
@@ -8,12 +8,13 @@ var isElementType = require('../misc/isElementType.js');
|
|
|
8
8
|
var level = require('../misc/level.js');
|
|
9
9
|
|
|
10
10
|
function hasPointerEvents(instance, element) {
|
|
11
|
-
var
|
|
12
|
-
return ((
|
|
11
|
+
var _checkPointerEvents;
|
|
12
|
+
return ((_checkPointerEvents = checkPointerEvents(instance, element)) === null || _checkPointerEvents === void 0 ? void 0 : _checkPointerEvents.pointerEvents) !== 'none';
|
|
13
13
|
}
|
|
14
14
|
function closestPointerEventsDeclaration(element) {
|
|
15
|
+
var _el;
|
|
15
16
|
const window = getWindow.getWindow(element);
|
|
16
|
-
for(let el = element, tree = []; el === null ||
|
|
17
|
+
for(let el = element, tree = []; (_el = el) === null || _el === void 0 ? void 0 : _el.ownerDocument; el = el.parentElement){
|
|
17
18
|
tree.push(el);
|
|
18
19
|
const pointerEvents = window.getComputedStyle(el).pointerEvents;
|
|
19
20
|
if (pointerEvents && ![
|
|
@@ -33,7 +34,8 @@ function checkPointerEvents(instance, element) {
|
|
|
33
34
|
const lastCheck = element[PointerEventsCheck];
|
|
34
35
|
const needsCheck = instance.config.pointerEventsCheck !== options.PointerEventsCheckLevel.Never && (!lastCheck || hasBitFlag(instance.config.pointerEventsCheck, options.PointerEventsCheckLevel.EachApiCall) && lastCheck[level.ApiLevel.Call] !== level.getLevelRef(instance, level.ApiLevel.Call) || hasBitFlag(instance.config.pointerEventsCheck, options.PointerEventsCheckLevel.EachTrigger) && lastCheck[level.ApiLevel.Trigger] !== level.getLevelRef(instance, level.ApiLevel.Trigger));
|
|
35
36
|
if (!needsCheck) {
|
|
36
|
-
|
|
37
|
+
var _lastCheck;
|
|
38
|
+
return (_lastCheck = lastCheck) === null || _lastCheck === void 0 ? void 0 : _lastCheck.result;
|
|
37
39
|
}
|
|
38
40
|
const declaration = closestPointerEventsDeclaration(element);
|
|
39
41
|
element[PointerEventsCheck] = {
|
|
@@ -44,12 +46,13 @@ function checkPointerEvents(instance, element) {
|
|
|
44
46
|
return declaration;
|
|
45
47
|
}
|
|
46
48
|
function assertPointerEvents(instance, element) {
|
|
49
|
+
var _declaration;
|
|
47
50
|
const declaration = checkPointerEvents(instance, element);
|
|
48
|
-
if ((declaration === null ||
|
|
51
|
+
if (((_declaration = declaration) === null || _declaration === void 0 ? void 0 : _declaration.pointerEvents) === 'none') {
|
|
49
52
|
throw new Error([
|
|
50
53
|
`Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`,
|
|
51
54
|
'',
|
|
52
|
-
printTree(declaration.tree)
|
|
55
|
+
printTree(declaration.tree)
|
|
53
56
|
].join('\n'));
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -61,17 +64,17 @@ function printTree(tree) {
|
|
|
61
64
|
el.hasAttribute('data-testid') && `(testId=${el.getAttribute('data-testid')})`,
|
|
62
65
|
getLabelDescr(el),
|
|
63
66
|
tree.length > 1 && i === 0 && ' <-- This element declared `pointer-events: none`',
|
|
64
|
-
tree.length > 1 && i === tree.length - 1 && ' <-- Asserted pointer events here'
|
|
67
|
+
tree.length > 1 && i === tree.length - 1 && ' <-- Asserted pointer events here'
|
|
65
68
|
].filter(Boolean).join('')).join('\n');
|
|
66
69
|
}
|
|
67
70
|
function getLabelDescr(element) {
|
|
68
|
-
var
|
|
71
|
+
var _element_labels, _label, _label1;
|
|
69
72
|
let label;
|
|
70
73
|
if (element.hasAttribute('aria-label')) {
|
|
71
74
|
label = element.getAttribute('aria-label');
|
|
72
75
|
} else if (element.hasAttribute('aria-labelledby')) {
|
|
73
|
-
var
|
|
74
|
-
label = (
|
|
76
|
+
var _element_ownerDocument_getElementById_textContent, _element_ownerDocument_getElementById;
|
|
77
|
+
label = (_element_ownerDocument_getElementById = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))) === null || _element_ownerDocument_getElementById === void 0 ? void 0 : (_element_ownerDocument_getElementById_textContent = _element_ownerDocument_getElementById.textContent) === null || _element_ownerDocument_getElementById_textContent === void 0 ? void 0 : _element_ownerDocument_getElementById_textContent.trim();
|
|
75
78
|
} else if (isElementType.isElementType(element, [
|
|
76
79
|
'button',
|
|
77
80
|
'input',
|
|
@@ -79,19 +82,20 @@ function getLabelDescr(element) {
|
|
|
79
82
|
'output',
|
|
80
83
|
'progress',
|
|
81
84
|
'select',
|
|
82
|
-
'textarea'
|
|
83
|
-
]) && ((
|
|
85
|
+
'textarea'
|
|
86
|
+
]) && ((_element_labels = element.labels) === null || _element_labels === void 0 ? void 0 : _element_labels.length)) {
|
|
84
87
|
label = Array.from(element.labels).map((el)=>{
|
|
85
|
-
var
|
|
86
|
-
return (
|
|
88
|
+
var _el_textContent;
|
|
89
|
+
return (_el_textContent = el.textContent) === null || _el_textContent === void 0 ? void 0 : _el_textContent.trim();
|
|
87
90
|
}).join('|');
|
|
88
91
|
} else if (isElementType.isElementType(element, 'button')) {
|
|
89
|
-
var
|
|
90
|
-
label = (
|
|
92
|
+
var _element_textContent;
|
|
93
|
+
label = (_element_textContent = element.textContent) === null || _element_textContent === void 0 ? void 0 : _element_textContent.trim();
|
|
91
94
|
}
|
|
92
|
-
label = label === null ||
|
|
93
|
-
if (Number(label === null ||
|
|
94
|
-
|
|
95
|
+
label = (_label = label) === null || _label === void 0 ? void 0 : _label.replace(/\n/g, ' ');
|
|
96
|
+
if (Number((_label1 = label) === null || _label1 === void 0 ? void 0 : _label1.length) > 30) {
|
|
97
|
+
var _label2;
|
|
98
|
+
label = `${(_label2 = label) === null || _label2 === void 0 ? void 0 : _label2.substring(0, 29)}…`;
|
|
95
99
|
}
|
|
96
100
|
return label ? `(label=${label})` : '';
|
|
97
101
|
}
|
|
@@ -10,8 +10,8 @@ import { copySelection } from '../document/copySelection.js';
|
|
|
10
10
|
|
|
11
11
|
async function copy() {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
15
|
const clipboardData = copySelection(target);
|
|
16
16
|
if (clipboardData.items.length === 0) {
|
|
17
17
|
return;
|
|
@@ -10,8 +10,8 @@ import { copySelection } from '../document/copySelection.js';
|
|
|
10
10
|
|
|
11
11
|
async function cut() {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
15
|
const clipboardData = copySelection(target);
|
|
16
16
|
if (clipboardData.items.length === 0) {
|
|
17
17
|
return;
|
|
@@ -10,10 +10,10 @@ import '../options.js';
|
|
|
10
10
|
|
|
11
11
|
async function paste(clipboardData) {
|
|
12
12
|
const doc = this.config.document;
|
|
13
|
-
var
|
|
14
|
-
const target = (
|
|
15
|
-
var
|
|
16
|
-
const dataTransfer = (
|
|
13
|
+
var _doc_activeElement;
|
|
14
|
+
const target = (_doc_activeElement = doc.activeElement) !== null && _doc_activeElement !== void 0 ? _doc_activeElement : /* istanbul ignore next */ doc.body;
|
|
15
|
+
var _ref;
|
|
16
|
+
const dataTransfer = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && _ref !== void 0 ? _ref : await readDataTransferFromClipboard(doc).catch(()=>{
|
|
17
17
|
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
18
18
|
});
|
|
19
19
|
this.dispatchUIEvent(target, 'paste', {
|
package/dist/esm/document/UI.js
CHANGED
|
@@ -32,7 +32,7 @@ function getInitialValue(element) {
|
|
|
32
32
|
function setUISelectionRaw(element, selection) {
|
|
33
33
|
element[UISelection] = selection;
|
|
34
34
|
}
|
|
35
|
-
function setUISelection(element, { focusOffset: focusOffsetParam
|
|
35
|
+
function setUISelection(element, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam = focusOffsetParam }, mode = 'replace') {
|
|
36
36
|
const valueLength = getUIValue(element).length;
|
|
37
37
|
const sanitizeOffset = (o)=>Math.max(0, Math.min(valueLength, o));
|
|
38
38
|
const anchorOffset = mode === 'replace' || element[UISelection] === undefined ? sanitizeOffset(anchorOffsetParam) : element[UISelection].anchorOffset;
|
|
@@ -58,10 +58,10 @@ function setUISelection(element, { focusOffset: focusOffsetParam , anchorOffset:
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function getUISelection(element) {
|
|
61
|
-
var
|
|
62
|
-
const sel = (
|
|
63
|
-
anchorOffset: (
|
|
64
|
-
focusOffset: (
|
|
61
|
+
var _element_selectionStart, _element_selectionEnd, _element_UISelection;
|
|
62
|
+
const sel = (_element_UISelection = element[UISelection]) !== null && _element_UISelection !== void 0 ? _element_UISelection : {
|
|
63
|
+
anchorOffset: (_element_selectionStart = element.selectionStart) !== null && _element_selectionStart !== void 0 ? _element_selectionStart : 0,
|
|
64
|
+
focusOffset: (_element_selectionEnd = element.selectionEnd) !== null && _element_selectionEnd !== void 0 ? _element_selectionEnd : 0
|
|
65
65
|
};
|
|
66
66
|
return {
|
|
67
67
|
...sel,
|
|
@@ -12,21 +12,23 @@ import { setUISelectionClean, setUISelectionRaw, getUIValue, setUIValueClean, is
|
|
|
12
12
|
|
|
13
13
|
const Interceptor = Symbol('Interceptor for programmatical calls');
|
|
14
14
|
function prepareInterceptor(element, propName, interceptorImpl) {
|
|
15
|
+
var _prototypeDescriptor, _prototypeDescriptor1;
|
|
15
16
|
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
|
|
16
17
|
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
|
|
17
|
-
const target = (prototypeDescriptor === null ||
|
|
18
|
-
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null ||
|
|
18
|
+
const target = ((_prototypeDescriptor = prototypeDescriptor) === null || _prototypeDescriptor === void 0 ? void 0 : _prototypeDescriptor.set) ? 'set' : 'value';
|
|
19
|
+
/* istanbul ignore if */ if (typeof ((_prototypeDescriptor1 = prototypeDescriptor) === null || _prototypeDescriptor1 === void 0 ? void 0 : _prototypeDescriptor1[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
|
|
19
20
|
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
|
|
20
21
|
}
|
|
21
22
|
function intercept(...args) {
|
|
22
|
-
|
|
23
|
+
var _then;
|
|
24
|
+
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
|
|
23
25
|
const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
|
|
24
26
|
if (target === 'set') {
|
|
25
27
|
realFunc.call(this, realArgs);
|
|
26
28
|
} else {
|
|
27
29
|
realFunc.call(this, ...realArgs);
|
|
28
30
|
}
|
|
29
|
-
then === null ||
|
|
31
|
+
(_then = then) === null || _then === void 0 ? void 0 : _then();
|
|
30
32
|
}
|
|
31
33
|
intercept[Interceptor] = Interceptor;
|
|
32
34
|
Object.defineProperty(element, propName, {
|
|
@@ -29,8 +29,8 @@ function startTrackValue(element) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
function trackOrSetValue(element, v) {
|
|
32
|
-
var
|
|
33
|
-
(
|
|
32
|
+
var _element_TrackChanges_tracked, _element_TrackChanges;
|
|
33
|
+
(_element_TrackChanges = element[TrackChanges]) === null || _element_TrackChanges === void 0 ? void 0 : (_element_TrackChanges_tracked = _element_TrackChanges.tracked) === null || _element_TrackChanges_tracked === void 0 ? void 0 : _element_TrackChanges_tracked.push(v);
|
|
34
34
|
if (!element[TrackChanges]) {
|
|
35
35
|
setUIValueClean(element);
|
|
36
36
|
setUISelection(element, {
|
|
@@ -39,10 +39,10 @@ function trackOrSetValue(element, v) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function commitValueAfterInput(element, cursorOffset) {
|
|
42
|
-
var
|
|
42
|
+
var _changes_tracked, _changes;
|
|
43
43
|
const changes = element[TrackChanges];
|
|
44
44
|
element[TrackChanges] = undefined;
|
|
45
|
-
if (!(changes === null ||
|
|
45
|
+
if (!((_changes = changes) === null || _changes === void 0 ? void 0 : (_changes_tracked = _changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
@@ -21,9 +21,9 @@ import { walkRadio } from '../radio.js';
|
|
|
21
21
|
import { behavior } from './registry.js';
|
|
22
22
|
|
|
23
23
|
behavior.keydown = (event, target, instance)=>{
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
return (
|
|
24
|
+
var _keydownBehavior_event_key, _keydownBehavior;
|
|
25
|
+
var _keydownBehavior_event_key1;
|
|
26
|
+
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = (_keydownBehavior = keydownBehavior)[event.key]) === null || _keydownBehavior_event_key === void 0 ? void 0 : _keydownBehavior_event_key.call(_keydownBehavior, event, target, instance)) !== null && _keydownBehavior_event_key1 !== void 0 ? _keydownBehavior_event_key1 : combinationBehavior(event, target, instance);
|
|
27
27
|
};
|
|
28
28
|
const keydownBehavior = {
|
|
29
29
|
ArrowDown: (event, target, instance)=>{
|
|
@@ -76,9 +76,9 @@ const keydownBehavior = {
|
|
|
76
76
|
'textarea'
|
|
77
77
|
]) || isContentEditable(target)) {
|
|
78
78
|
return ()=>{
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
const newPos = (
|
|
79
|
+
var _getValueOrTextContent;
|
|
80
|
+
var _getValueOrTextContent_length;
|
|
81
|
+
const newPos = (_getValueOrTextContent_length = (_getValueOrTextContent = getValueOrTextContent(target)) === null || _getValueOrTextContent === void 0 ? void 0 : _getValueOrTextContent.length) !== null && _getValueOrTextContent_length !== void 0 ? _getValueOrTextContent_length : /* istanbul ignore next */ 0;
|
|
82
82
|
setSelectionRange(target, newPos, newPos);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
@@ -18,8 +18,9 @@ behavior.keypress = (event, target, instance)=>{
|
|
|
18
18
|
instance.dispatchUIEvent(target, 'click');
|
|
19
19
|
};
|
|
20
20
|
} else if (isElementType(target, 'input')) {
|
|
21
|
+
var _form;
|
|
21
22
|
const form = target.form;
|
|
22
|
-
const submit = form === null ||
|
|
23
|
+
const submit = (_form = form) === null || _form === void 0 ? void 0 : _form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
|
|
23
24
|
if (submit) {
|
|
24
25
|
return ()=>instance.dispatchUIEvent(submit, 'click');
|
|
25
26
|
} else if (form && SubmitSingleInputOnEnter.includes(target.type) && form.querySelectorAll('input').length === 1) {
|
|
@@ -41,7 +42,7 @@ const ClickInputOnEnter = [
|
|
|
41
42
|
'file',
|
|
42
43
|
'image',
|
|
43
44
|
'reset',
|
|
44
|
-
'submit'
|
|
45
|
+
'submit'
|
|
45
46
|
];
|
|
46
47
|
const SubmitSingleInputOnEnter = [
|
|
47
48
|
'email',
|
|
@@ -51,5 +52,5 @@ const SubmitSingleInputOnEnter = [
|
|
|
51
52
|
'tel',
|
|
52
53
|
'text',
|
|
53
54
|
'url',
|
|
54
|
-
'week'
|
|
55
|
+
'week'
|
|
55
56
|
];
|
|
@@ -9,8 +9,8 @@ import '../../options.js';
|
|
|
9
9
|
import { behavior } from './registry.js';
|
|
10
10
|
|
|
11
11
|
behavior.keyup = (event, target, instance)=>{
|
|
12
|
-
var
|
|
13
|
-
return (
|
|
12
|
+
var _keyupBehavior_event_key, _keyupBehavior;
|
|
13
|
+
return (_keyupBehavior_event_key = (_keyupBehavior = keyupBehavior)[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(_keyupBehavior, event, target, instance);
|
|
14
14
|
};
|
|
15
15
|
const keyupBehavior = {
|
|
16
16
|
' ': (event, target, instance)=>{
|
|
@@ -12,8 +12,8 @@ import { behavior } from './registry.js';
|
|
|
12
12
|
behavior.paste = (event, target, instance)=>{
|
|
13
13
|
if (isEditable(target)) {
|
|
14
14
|
return ()=>{
|
|
15
|
-
var
|
|
16
|
-
const insertData = (
|
|
15
|
+
var _event_clipboardData;
|
|
16
|
+
const insertData = (_event_clipboardData = event.clipboardData) === null || _event_clipboardData === void 0 ? void 0 : _event_clipboardData.getData('text');
|
|
17
17
|
if (insertData) {
|
|
18
18
|
input(instance, target, insertData, 'insertFromPaste');
|
|
19
19
|
}
|
|
@@ -25,7 +25,7 @@ const eventInitializer = {
|
|
|
25
25
|
initUIEvent,
|
|
26
26
|
initUIEventModififiers,
|
|
27
27
|
initMouseEvent,
|
|
28
|
-
initPointerEvent
|
|
28
|
+
initPointerEvent
|
|
29
29
|
],
|
|
30
30
|
KeyboardEvent: [
|
|
31
31
|
initUIEvent,
|
|
@@ -34,58 +34,58 @@ const eventInitializer = {
|
|
|
34
34
|
]
|
|
35
35
|
};
|
|
36
36
|
function createEvent(type, target, init) {
|
|
37
|
-
var
|
|
37
|
+
var _eventInitializer_EventType;
|
|
38
38
|
const window = getWindow(target);
|
|
39
|
-
const { EventType
|
|
39
|
+
const { EventType, defaultInit } = eventMap[eventMapKeys[type]];
|
|
40
40
|
const event = new (getEventConstructors(window))[EventType](type, defaultInit);
|
|
41
|
-
(
|
|
41
|
+
(_eventInitializer_EventType = eventInitializer[EventType]) === null || _eventInitializer_EventType === void 0 ? void 0 : _eventInitializer_EventType.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
|
|
42
42
|
return event;
|
|
43
43
|
}
|
|
44
44
|
/* istanbul ignore next */ function getEventConstructors(window) {
|
|
45
|
-
var
|
|
46
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (
|
|
45
|
+
var _window_Event;
|
|
46
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
|
|
47
47
|
};
|
|
48
|
-
var
|
|
49
|
-
const AnimationEvent = (
|
|
48
|
+
var _window_AnimationEvent;
|
|
49
|
+
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
50
50
|
};
|
|
51
|
-
var
|
|
52
|
-
const ClipboardEvent = (
|
|
51
|
+
var _window_ClipboardEvent;
|
|
52
|
+
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
53
53
|
};
|
|
54
|
-
var
|
|
55
|
-
const PopStateEvent = (
|
|
54
|
+
var _window_PopStateEvent;
|
|
55
|
+
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
56
56
|
};
|
|
57
|
-
var
|
|
58
|
-
const ProgressEvent = (
|
|
57
|
+
var _window_ProgressEvent;
|
|
58
|
+
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
59
59
|
};
|
|
60
|
-
var
|
|
61
|
-
const TransitionEvent = (
|
|
60
|
+
var _window_TransitionEvent;
|
|
61
|
+
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
62
62
|
};
|
|
63
|
-
var
|
|
64
|
-
const UIEvent = (
|
|
63
|
+
var _window_UIEvent;
|
|
64
|
+
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
|
|
65
65
|
};
|
|
66
|
-
var
|
|
67
|
-
const CompositionEvent = (
|
|
66
|
+
var _window_CompositionEvent;
|
|
67
|
+
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
68
68
|
};
|
|
69
|
-
var
|
|
70
|
-
const FocusEvent = (
|
|
69
|
+
var _window_FocusEvent;
|
|
70
|
+
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
71
71
|
};
|
|
72
|
-
var
|
|
73
|
-
const InputEvent = (
|
|
72
|
+
var _window_InputEvent;
|
|
73
|
+
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
74
74
|
};
|
|
75
|
-
var
|
|
76
|
-
const KeyboardEvent = (
|
|
75
|
+
var _window_KeyboardEvent;
|
|
76
|
+
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
77
77
|
};
|
|
78
|
-
var
|
|
79
|
-
const MouseEvent = (
|
|
78
|
+
var _window_MouseEvent;
|
|
79
|
+
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
80
80
|
};
|
|
81
|
-
var
|
|
82
|
-
const DragEvent = (
|
|
81
|
+
var _window_DragEvent;
|
|
82
|
+
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
83
83
|
};
|
|
84
|
-
var
|
|
85
|
-
const PointerEvent = (
|
|
84
|
+
var _window_PointerEvent;
|
|
85
|
+
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
86
86
|
};
|
|
87
|
-
var
|
|
88
|
-
const TouchEvent = (
|
|
87
|
+
var _window_TouchEvent;
|
|
88
|
+
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
89
89
|
};
|
|
90
90
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return {
|
|
91
91
|
Event,
|
|
@@ -115,25 +115,25 @@ function assignProps(obj, props) {
|
|
|
115
115
|
function sanitizeNumber(n) {
|
|
116
116
|
return Number(n !== null && n !== void 0 ? n : 0);
|
|
117
117
|
}
|
|
118
|
-
function initClipboardEvent(event, { clipboardData
|
|
118
|
+
function initClipboardEvent(event, { clipboardData }) {
|
|
119
119
|
assignProps(event, {
|
|
120
120
|
clipboardData
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
function initInputEvent(event, { data
|
|
123
|
+
function initInputEvent(event, { data, inputType, isComposing }) {
|
|
124
124
|
assignProps(event, {
|
|
125
125
|
data,
|
|
126
126
|
isComposing: Boolean(isComposing),
|
|
127
127
|
inputType: String(inputType)
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function initUIEvent(event, { view
|
|
130
|
+
function initUIEvent(event, { view, detail }) {
|
|
131
131
|
assignProps(event, {
|
|
132
132
|
view,
|
|
133
133
|
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
function initUIEventModififiers(event, { altKey
|
|
136
|
+
function initUIEventModififiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
|
|
137
137
|
assignProps(event, {
|
|
138
138
|
altKey: Boolean(altKey),
|
|
139
139
|
ctrlKey: Boolean(ctrlKey),
|
|
@@ -157,7 +157,7 @@ function initUIEventModififiers(event, { altKey , ctrlKey , metaKey , shiftKey ,
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
function initKeyboardEvent(event, { key
|
|
160
|
+
function initKeyboardEvent(event, { key, code, location, repeat, isComposing, charCode }) {
|
|
161
161
|
assignProps(event, {
|
|
162
162
|
key: String(key),
|
|
163
163
|
code: String(code),
|
|
@@ -167,7 +167,7 @@ function initKeyboardEvent(event, { key , code , location , repeat , isComposing
|
|
|
167
167
|
charCode
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
function initMouseEvent(event, { x
|
|
170
|
+
function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY = y, button, buttons, relatedTarget }) {
|
|
171
171
|
assignProps(event, {
|
|
172
172
|
screenX: sanitizeNumber(screenX),
|
|
173
173
|
screenY: sanitizeNumber(screenY),
|
|
@@ -180,7 +180,7 @@ function initMouseEvent(event, { x , y , screenX , screenY , clientX =x , client
|
|
|
180
180
|
relatedTarget
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
function initPointerEvent(event, { pointerId
|
|
183
|
+
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
|
|
184
184
|
assignProps(event, {
|
|
185
185
|
pointerId: sanitizeNumber(pointerId),
|
|
186
186
|
width: sanitizeNumber(width),
|
|
@@ -20,9 +20,9 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
|
|
|
20
20
|
return dispatchEvent.call(this, target, event, preventDefault);
|
|
21
21
|
}
|
|
22
22
|
function dispatchEvent(target, event, preventDefault = false) {
|
|
23
|
-
var
|
|
23
|
+
var _behavior_type, _behavior;
|
|
24
24
|
const type = event.type;
|
|
25
|
-
const behaviorImplementation = preventDefault ? ()=>{} : (
|
|
25
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = (_behavior = behavior)[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(_behavior, event, target, this);
|
|
26
26
|
if (behaviorImplementation) {
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
let defaultPrevented = false;
|