@testing-library/user-event 14.5.0 → 14.5.1
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 +4 -7
- package/dist/cjs/_interop/dtlEventMap.js +4 -7
- package/dist/cjs/_interop/dtlHelpers.js +4 -7
- package/dist/cjs/document/interceptor.js +3 -5
- package/dist/cjs/document/trackValue.js +2 -2
- package/dist/cjs/event/behavior/keydown.js +2 -2
- package/dist/cjs/event/behavior/keypress.js +1 -2
- package/dist/cjs/event/behavior/keyup.js +2 -2
- package/dist/cjs/event/dispatchEvent.js +2 -2
- package/dist/cjs/event/eventMap.js +22 -2
- package/dist/cjs/event/focus.js +1 -4
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -3
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -3
- package/dist/cjs/event/selection/moveSelection.js +1 -2
- package/dist/cjs/event/selection/selectAll.js +1 -2
- package/dist/cjs/event/selection/setSelectionPerMouse.js +2 -3
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +1 -2
- package/dist/cjs/event/wrapEvent.js +22 -2
- package/dist/cjs/pointer/index.js +4 -4
- package/dist/cjs/setup/wrapAsync.js +22 -2
- package/dist/cjs/system/pointer/index.js +12 -15
- package/dist/cjs/utility/selectOptions.js +22 -2
- package/dist/cjs/utility/upload.js +1 -2
- package/dist/cjs/utils/dataTransfer/Clipboard.js +2 -4
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +1 -2
- package/dist/cjs/utils/edit/setFiles.js +2 -2
- package/dist/cjs/utils/focus/getActiveElement.js +1 -2
- package/dist/cjs/utils/misc/getWindow.js +22 -2
- package/dist/cjs/utils/misc/isVisible.js +1 -2
- package/dist/cjs/utils/pointer/cssPointerEvents.js +7 -11
- package/dist/esm/_interop/dtl.js +2 -6
- package/dist/esm/_interop/dtlEventMap.js +2 -6
- package/dist/esm/_interop/dtlHelpers.js +2 -6
- package/dist/esm/document/interceptor.js +3 -5
- package/dist/esm/document/trackValue.js +2 -2
- package/dist/esm/event/behavior/keydown.js +2 -2
- package/dist/esm/event/behavior/keypress.js +1 -2
- package/dist/esm/event/behavior/keyup.js +2 -2
- package/dist/esm/event/dispatchEvent.js +2 -2
- package/dist/esm/event/eventMap.js +2 -2
- package/dist/esm/event/focus.js +1 -4
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +2 -3
- package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -3
- package/dist/esm/event/selection/moveSelection.js +1 -2
- package/dist/esm/event/selection/selectAll.js +1 -2
- package/dist/esm/event/selection/setSelectionPerMouse.js +2 -3
- package/dist/esm/event/selection/updateSelectionOnFocus.js +1 -2
- package/dist/esm/event/wrapEvent.js +2 -2
- package/dist/esm/pointer/index.js +4 -4
- package/dist/esm/setup/wrapAsync.js +2 -2
- package/dist/esm/system/pointer/index.js +12 -15
- package/dist/esm/utility/selectOptions.js +2 -2
- package/dist/esm/utility/upload.js +1 -2
- package/dist/esm/utils/dataTransfer/Clipboard.js +2 -4
- package/dist/esm/utils/dataTransfer/DataTransfer.js +1 -2
- package/dist/esm/utils/edit/setFiles.js +2 -2
- package/dist/esm/utils/focus/getActiveElement.js +1 -2
- package/dist/esm/utils/misc/getWindow.js +2 -2
- package/dist/esm/utils/misc/isVisible.js +1 -2
- package/dist/esm/utils/pointer/cssPointerEvents.js +7 -11
- package/dist/types/_interop/dtl.d.ts +2 -3
- package/dist/types/_interop/dtlEventMap.d.ts +2 -3
- package/dist/types/_interop/dtlHelpers.d.ts +2 -3
- package/package.json +1 -1
package/dist/cjs/_interop/dtl.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
3
|
+
var named = require('@testing-library/dom');
|
|
6
4
|
|
|
7
5
|
function _interopNamespace(e) {
|
|
8
6
|
if (e && e.__esModule) return e;
|
|
@@ -22,9 +20,8 @@ function _interopNamespace(e) {
|
|
|
22
20
|
return Object.freeze(n);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
var
|
|
26
|
-
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
27
25
|
|
|
28
|
-
var dtl = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
|
|
29
26
|
|
|
30
|
-
module.exports =
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
3
|
+
var named = require('@testing-library/dom/dist/event-map.js');
|
|
6
4
|
|
|
7
5
|
function _interopNamespace(e) {
|
|
8
6
|
if (e && e.__esModule) return e;
|
|
@@ -22,9 +20,8 @@ function _interopNamespace(e) {
|
|
|
22
20
|
return Object.freeze(n);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
var
|
|
26
|
-
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
27
25
|
|
|
28
|
-
var dtlEvents = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
|
|
29
26
|
|
|
30
|
-
module.exports =
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
3
|
+
var named = require('@testing-library/dom/dist/helpers.js');
|
|
6
4
|
|
|
7
5
|
function _interopNamespace(e) {
|
|
8
6
|
if (e && e.__esModule) return e;
|
|
@@ -22,9 +20,8 @@ function _interopNamespace(e) {
|
|
|
22
20
|
return Object.freeze(n);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
var
|
|
26
|
-
|
|
23
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
24
|
+
|
|
27
25
|
|
|
28
|
-
var dtlHelpers = def__default["default"] !== null && def__default["default"] !== void 0 ? def__default["default"] : def__namespace;
|
|
29
26
|
|
|
30
|
-
module.exports =
|
|
27
|
+
module.exports = named__namespace;
|
|
@@ -16,15 +16,13 @@ var UI = require('./UI.js');
|
|
|
16
16
|
|
|
17
17
|
const Interceptor = Symbol('Interceptor for programmatical calls');
|
|
18
18
|
function prepareInterceptor(element, propName, interceptorImpl) {
|
|
19
|
-
var _prototypeDescriptor, _prototypeDescriptor1;
|
|
20
19
|
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
|
|
21
20
|
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
|
|
22
|
-
const target = (
|
|
23
|
-
/* istanbul ignore if */ if (typeof (
|
|
21
|
+
const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value';
|
|
22
|
+
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
|
|
24
23
|
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`);
|
|
25
24
|
}
|
|
26
25
|
function intercept(...args) {
|
|
27
|
-
var _then;
|
|
28
26
|
const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
|
|
29
27
|
const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
|
|
30
28
|
if (target === 'set') {
|
|
@@ -32,7 +30,7 @@ function prepareInterceptor(element, propName, interceptorImpl) {
|
|
|
32
30
|
} else {
|
|
33
31
|
realFunc.call(this, ...realArgs);
|
|
34
32
|
}
|
|
35
|
-
|
|
33
|
+
then === null || then === void 0 ? void 0 : then();
|
|
36
34
|
}
|
|
37
35
|
intercept[Interceptor] = Interceptor;
|
|
38
36
|
Object.defineProperty(element, propName, {
|
|
@@ -43,10 +43,10 @@ function trackOrSetValue(element, v) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function commitValueAfterInput(element, cursorOffset) {
|
|
46
|
-
var _changes_tracked
|
|
46
|
+
var _changes_tracked;
|
|
47
47
|
const changes = element[TrackChanges];
|
|
48
48
|
element[TrackChanges] = undefined;
|
|
49
|
-
if (!(
|
|
49
|
+
if (!(changes === null || changes === void 0 ? void 0 : (_changes_tracked = changes.tracked) === null || _changes_tracked === void 0 ? void 0 : _changes_tracked.length)) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const isJustReactStateUpdate = changes.tracked.length === 2 && changes.tracked[0] === changes.previousValue && changes.tracked[1] === element.value;
|
|
@@ -23,9 +23,9 @@ var radio = require('../radio.js');
|
|
|
23
23
|
var registry = require('./registry.js');
|
|
24
24
|
|
|
25
25
|
registry.behavior.keydown = (event, target, instance)=>{
|
|
26
|
-
var _keydownBehavior_event_key
|
|
26
|
+
var _keydownBehavior_event_key;
|
|
27
27
|
var _keydownBehavior_event_key1;
|
|
28
|
-
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key =
|
|
28
|
+
return (_keydownBehavior_event_key1 = (_keydownBehavior_event_key = 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);
|
|
29
29
|
};
|
|
30
30
|
const keydownBehavior = {
|
|
31
31
|
ArrowDown: (event, target, instance)=>{
|
|
@@ -20,9 +20,8 @@ registry.behavior.keypress = (event, target, instance)=>{
|
|
|
20
20
|
instance.dispatchUIEvent(target, 'click');
|
|
21
21
|
};
|
|
22
22
|
} else if (isElementType.isElementType(target, 'input')) {
|
|
23
|
-
var _form;
|
|
24
23
|
const form = target.form;
|
|
25
|
-
const submit =
|
|
24
|
+
const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]');
|
|
26
25
|
if (submit) {
|
|
27
26
|
return ()=>instance.dispatchUIEvent(submit, 'click');
|
|
28
27
|
} else if (form && SubmitSingleInputOnEnter.includes(target.type) && form.querySelectorAll('input').length === 1) {
|
|
@@ -11,8 +11,8 @@ require('../../options.js');
|
|
|
11
11
|
var registry = require('./registry.js');
|
|
12
12
|
|
|
13
13
|
registry.behavior.keyup = (event, target, instance)=>{
|
|
14
|
-
var _keyupBehavior_event_key
|
|
15
|
-
return (_keyupBehavior_event_key =
|
|
14
|
+
var _keyupBehavior_event_key;
|
|
15
|
+
return (_keyupBehavior_event_key = keyupBehavior[event.key]) === null || _keyupBehavior_event_key === void 0 ? void 0 : _keyupBehavior_event_key.call(keyupBehavior, event, target, instance);
|
|
16
16
|
};
|
|
17
17
|
const keyupBehavior = {
|
|
18
18
|
' ': (event, target, instance)=>{
|
|
@@ -24,9 +24,9 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
|
|
|
24
24
|
return dispatchEvent.call(this, target, event, preventDefault);
|
|
25
25
|
}
|
|
26
26
|
function dispatchEvent(target, event, preventDefault = false) {
|
|
27
|
-
var _behavior_type
|
|
27
|
+
var _behavior_type;
|
|
28
28
|
const type = event.type;
|
|
29
|
-
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type =
|
|
29
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = registry.behavior[type]) === null || _behavior_type === void 0 ? void 0 : _behavior_type.call(registry.behavior, event, target, this);
|
|
30
30
|
if (behaviorImplementation) {
|
|
31
31
|
event.preventDefault();
|
|
32
32
|
let defaultPrevented = false;
|
|
@@ -2,10 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom/dist/event-map.js');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
6
26
|
|
|
7
27
|
const eventMap = {
|
|
8
|
-
...
|
|
28
|
+
...named__namespace.eventMap,
|
|
9
29
|
click: {
|
|
10
30
|
EventType: 'PointerEvent',
|
|
11
31
|
defaultInit: {
|
package/dist/cjs/event/focus.js
CHANGED
|
@@ -26,10 +26,7 @@ var wrapEvent = require('./wrapEvent.js');
|
|
|
26
26
|
} else if (target) {
|
|
27
27
|
wrapEvent.wrapEvent(()=>target.focus());
|
|
28
28
|
} else {
|
|
29
|
-
wrapEvent.wrapEvent(()=>
|
|
30
|
-
var _activeElement;
|
|
31
|
-
return (_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.blur();
|
|
32
|
-
});
|
|
29
|
+
wrapEvent.wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
|
|
33
30
|
}
|
|
34
31
|
updateSelectionOnFocus.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
|
|
35
32
|
}
|
|
@@ -17,7 +17,6 @@ require('../../options.js');
|
|
|
17
17
|
/**
|
|
18
18
|
* Determine which selection logic and selection ranges to consider.
|
|
19
19
|
*/ function getTargetTypeAndSelection(node) {
|
|
20
|
-
var _element, _selection;
|
|
21
20
|
const element = getElement(node);
|
|
22
21
|
if (element && selection.hasOwnSelection(element)) {
|
|
23
22
|
return {
|
|
@@ -25,10 +24,10 @@ require('../../options.js');
|
|
|
25
24
|
selection: UI.getUISelection(element)
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
|
-
const selection$1 =
|
|
27
|
+
const selection$1 = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
|
|
29
28
|
// It is possible to extend a single-range selection into a contenteditable.
|
|
30
29
|
// This results in the range acting like a range outside of contenteditable.
|
|
31
|
-
const isCE = isContentEditable.getContentEditable(node) && (
|
|
30
|
+
const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode);
|
|
32
31
|
return {
|
|
33
32
|
type: isCE ? 'contenteditable' : 'default',
|
|
34
33
|
selection: selection$1
|
|
@@ -33,7 +33,6 @@ function modifySelectionPerMouseMove(selectionRange, { document, target, node, o
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
} else {
|
|
36
|
-
var _selection, _selection1;
|
|
37
36
|
const range = selectionRange.cloneRange();
|
|
38
37
|
const cmp = range.comparePoint(selectionFocus.node, selectionFocus.offset);
|
|
39
38
|
if (cmp < 0) {
|
|
@@ -42,8 +41,8 @@ function modifySelectionPerMouseMove(selectionRange, { document, target, node, o
|
|
|
42
41
|
range.setEnd(selectionFocus.node, selectionFocus.offset);
|
|
43
42
|
}
|
|
44
43
|
const selection = document.getSelection();
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
45
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -26,9 +26,8 @@ var setSelection = require('./setSelection.js');
|
|
|
26
26
|
focusOffset: selection.startOffset === selection.endOffset ? selection.focusOffset + direction : direction < 0 ? selection.startOffset : selection.endOffset
|
|
27
27
|
});
|
|
28
28
|
} else {
|
|
29
|
-
var _selection;
|
|
30
29
|
const selection = node.ownerDocument.getSelection();
|
|
31
|
-
if (!(
|
|
30
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
if (selection.isCollapsed) {
|
|
@@ -34,14 +34,13 @@ var setSelection = require('./setSelection.js');
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function isAllSelected(target) {
|
|
37
|
-
var _selection;
|
|
38
37
|
if (selection.hasOwnSelection(target)) {
|
|
39
38
|
return UI.getUISelection(target).startOffset === 0 && UI.getUISelection(target).endOffset === UI.getUIValue(target).length;
|
|
40
39
|
}
|
|
41
40
|
var _getContentEditable;
|
|
42
41
|
const focusNode = (_getContentEditable = isContentEditable.getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
|
|
43
42
|
const selection$1 = target.ownerDocument.getSelection();
|
|
44
|
-
return (
|
|
43
|
+
return (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) === focusNode && selection$1.focusNode === focusNode && selection$1.anchorOffset === 0 && selection$1.focusOffset === focusNode.childNodes.length;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
exports.isAllSelected = isAllSelected;
|
|
@@ -43,7 +43,6 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
43
43
|
end: end !== null && end !== void 0 ? end : text.length
|
|
44
44
|
};
|
|
45
45
|
} else {
|
|
46
|
-
var _selection, _selection1;
|
|
47
46
|
const { node: startNode, offset: startOffset } = resolveCaretPosition.resolveCaretPosition({
|
|
48
47
|
target,
|
|
49
48
|
node,
|
|
@@ -62,8 +61,8 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
62
61
|
throw new Error('The given offset is out of bounds.');
|
|
63
62
|
}
|
|
64
63
|
const selection = document.getSelection();
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
65
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
|
|
67
66
|
return range;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -17,9 +17,8 @@ require('../../options.js');
|
|
|
17
17
|
* Reset the Document Selection when moving focus into an element
|
|
18
18
|
* with own selection implementation.
|
|
19
19
|
*/ function updateSelectionOnFocus(element) {
|
|
20
|
-
var _selection;
|
|
21
20
|
const selection$1 = element.ownerDocument.getSelection();
|
|
22
|
-
/* istanbul ignore if */ if (!(
|
|
21
|
+
/* istanbul ignore if */ if (!(selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.focusNode)) {
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
24
|
// If the focus moves inside an element with own selection implementation,
|
|
@@ -2,9 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
26
|
+
|
|
27
|
+
const { getConfig } = named__namespace;
|
|
8
28
|
function wrapEvent(cb, _element) {
|
|
9
29
|
return getConfig().eventWrapper(cb);
|
|
10
30
|
}
|
|
@@ -37,16 +37,16 @@ async function pointer(input) {
|
|
|
37
37
|
this.system.pointer.resetClickCount();
|
|
38
38
|
}
|
|
39
39
|
async function pointerAction(instance, action) {
|
|
40
|
-
var
|
|
40
|
+
var _previousPosition_caret, _previousPosition_caret1;
|
|
41
41
|
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';
|
|
42
42
|
const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
|
|
43
43
|
var _action_target, _action_coords, _action_node, _action_offset;
|
|
44
44
|
const position = {
|
|
45
45
|
target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
|
|
46
|
-
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords :
|
|
46
|
+
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
|
|
47
47
|
caret: {
|
|
48
|
-
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined :
|
|
49
|
-
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined :
|
|
48
|
+
node: (_action_node = action.node) !== null && _action_node !== void 0 ? _action_node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret = previousPosition.caret) === null || _previousPosition_caret === void 0 ? void 0 : _previousPosition_caret.node,
|
|
49
|
+
offset: (_action_offset = action.offset) !== null && _action_offset !== void 0 ? _action_offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (_previousPosition_caret1 = previousPosition.caret) === null || _previousPosition_caret1 === void 0 ? void 0 : _previousPosition_caret1.offset
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
if ('keyDef' in action) {
|
|
@@ -2,9 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
26
|
+
|
|
27
|
+
const { getConfig } = named__namespace;
|
|
8
28
|
/**
|
|
9
29
|
* Wrap an internal Promise
|
|
10
30
|
*/ function wrapAsync(implementation) {
|
|
@@ -40,7 +40,6 @@ class PointerHost {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
async move(instance, pointerName, position) {
|
|
43
|
-
var _pointermove, _mousemove, _pointermove1, _mousemove1, _pointermove2, _mousemove2;
|
|
44
43
|
const pointer = this.pointers.get(pointerName);
|
|
45
44
|
// In (some?) browsers this order of events can be observed.
|
|
46
45
|
// This interweaving of events is probably unnecessary.
|
|
@@ -48,12 +47,12 @@ class PointerHost {
|
|
|
48
47
|
// the order in which they interweave/follow on a user interaction depends on the implementation.
|
|
49
48
|
const pointermove = pointer.move(instance, position);
|
|
50
49
|
const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(instance, position);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave();
|
|
51
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
|
|
52
|
+
pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter();
|
|
53
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
|
|
54
|
+
pointermove === null || pointermove === void 0 ? void 0 : pointermove.move();
|
|
55
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
|
|
57
56
|
}
|
|
58
57
|
async release(instance, keyDef, position) {
|
|
59
58
|
const device = this.devices.get(keyDef.pointerType);
|
|
@@ -73,19 +72,17 @@ class PointerHost {
|
|
|
73
72
|
}
|
|
74
73
|
if (!pointer.isPrevented) {
|
|
75
74
|
if (pointer.pointerType === 'touch' && !pointer.isMultitouch) {
|
|
76
|
-
var _mousemove, _mousemove1, _mousemove2;
|
|
77
75
|
const mousemove = this.mouse.move(instance, pointer.position);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
|
|
77
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
|
|
78
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
|
|
81
79
|
this.mouse.down(instance, keyDef, pointer);
|
|
82
80
|
}
|
|
83
81
|
if (!pointer.isMultitouch) {
|
|
84
|
-
var _mousemove3, _mousemove4, _mousemove5;
|
|
85
82
|
const mousemove = this.mouse.move(instance, pointer.position);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave();
|
|
84
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter();
|
|
85
|
+
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move();
|
|
89
86
|
this.mouse.up(instance, keyDef, pointer);
|
|
90
87
|
}
|
|
91
88
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom');
|
|
6
6
|
require('../utils/click/isClickableInput.js');
|
|
7
7
|
require('../utils/dataTransfer/Clipboard.js');
|
|
8
8
|
require('../utils/edit/isEditable.js');
|
|
@@ -23,7 +23,27 @@ require('../event/behavior/paste.js');
|
|
|
23
23
|
require('../event/eventMap.js');
|
|
24
24
|
var focus = require('../event/focus.js');
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function _interopNamespace(e) {
|
|
27
|
+
if (e && e.__esModule) return e;
|
|
28
|
+
var n = Object.create(null);
|
|
29
|
+
if (e) {
|
|
30
|
+
Object.keys(e).forEach(function (k) {
|
|
31
|
+
if (k !== 'default') {
|
|
32
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return e[k]; }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
n["default"] = e;
|
|
41
|
+
return Object.freeze(n);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
45
|
+
|
|
46
|
+
const { getConfig } = named__namespace;
|
|
27
47
|
async function selectOptions(select, values) {
|
|
28
48
|
return selectOptionsBase.call(this, true, select, values);
|
|
29
49
|
}
|
|
@@ -20,8 +20,7 @@ async function upload(element, fileOrFiles) {
|
|
|
20
20
|
if (!input || !isElementType.isElementType(input, 'input', {
|
|
21
21
|
type: 'file'
|
|
22
22
|
})) {
|
|
23
|
-
|
|
24
|
-
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${(_input = input) === null || _input === void 0 ? void 0 : _input.tagName} element does not accept file uploads`);
|
|
23
|
+
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`);
|
|
25
24
|
}
|
|
26
25
|
if (isDisabled.isDisabled(element)) return;
|
|
27
26
|
const files = (Array.isArray(fileOrFiles) ? fileOrFiles : [
|
|
@@ -86,8 +86,7 @@ function createClipboardStub(window, control) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
function isClipboardStub(clipboard) {
|
|
89
|
-
|
|
90
|
-
return !!((_clipboard = clipboard) === null || _clipboard === void 0 ? void 0 : _clipboard[ClipboardStubControl]);
|
|
89
|
+
return !!(clipboard === null || clipboard === void 0 ? void 0 : clipboard[ClipboardStubControl]);
|
|
91
90
|
}
|
|
92
91
|
function attachClipboardStubToView(window) {
|
|
93
92
|
if (isClipboardStub(window.navigator.clipboard)) {
|
|
@@ -128,9 +127,8 @@ function detachClipboardStubFromView(window) {
|
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
async function readDataTransferFromClipboard(document) {
|
|
131
|
-
var _window;
|
|
132
130
|
const window = document.defaultView;
|
|
133
|
-
const clipboard =
|
|
131
|
+
const clipboard = window === null || window === void 0 ? void 0 : window.navigator.clipboard;
|
|
134
132
|
const items = clipboard && await clipboard.read();
|
|
135
133
|
if (!items) {
|
|
136
134
|
throw new Error('The Clipboard API is unavailable.');
|
|
@@ -70,11 +70,10 @@ function getTypeMatcher(type, exact) {
|
|
|
70
70
|
function createDataTransferStub(window) {
|
|
71
71
|
return new class DataTransferStub {
|
|
72
72
|
getData(format) {
|
|
73
|
-
var _match;
|
|
74
73
|
var _this_items_find;
|
|
75
74
|
const match = (_this_items_find = this.items.find(getTypeMatcher(format, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(format, false));
|
|
76
75
|
let text = '';
|
|
77
|
-
|
|
76
|
+
match === null || match === void 0 ? void 0 : match.getAsString((t)=>{
|
|
78
77
|
text = t;
|
|
79
78
|
});
|
|
80
79
|
return text;
|
|
@@ -40,8 +40,8 @@ function setFiles(el, files) {
|
|
|
40
40
|
if (v === '') {
|
|
41
41
|
restore();
|
|
42
42
|
} else {
|
|
43
|
-
var _valueDescr_set
|
|
44
|
-
|
|
43
|
+
var _valueDescr_set;
|
|
44
|
+
valueDescr === null || valueDescr === void 0 ? void 0 : (_valueDescr_set = valueDescr.set) === null || _valueDescr_set === void 0 ? void 0 : _valueDescr_set.call(el, v);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isDisabled = require('../misc/isDisabled.js');
|
|
6
6
|
|
|
7
7
|
function getActiveElement(document) {
|
|
8
|
-
var _activeElement;
|
|
9
8
|
const activeElement = document.activeElement;
|
|
10
|
-
if (
|
|
9
|
+
if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) {
|
|
11
10
|
return getActiveElement(activeElement.shadowRoot);
|
|
12
11
|
} else {
|
|
13
12
|
// Browser does not yield disabled elements as document.activeElement - jsdom does
|
|
@@ -2,9 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var named = require('@testing-library/dom/dist/helpers.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var named__namespace = /*#__PURE__*/_interopNamespace(named);
|
|
26
|
+
|
|
27
|
+
const { getWindowFromNode } = named__namespace;
|
|
8
28
|
function getWindow(node) {
|
|
9
29
|
return getWindowFromNode(node);
|
|
10
30
|
}
|
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var getWindow = require('./getWindow.js');
|
|
6
6
|
|
|
7
7
|
function isVisible(element) {
|
|
8
|
-
var _el;
|
|
9
8
|
const window = getWindow.getWindow(element);
|
|
10
|
-
for(let el = element;
|
|
9
|
+
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){
|
|
11
10
|
const { display, visibility } = window.getComputedStyle(el);
|
|
12
11
|
if (display === 'none') {
|
|
13
12
|
return false;
|