@testing-library/user-event 14.6.1 → 14.6.4
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/README.md +19 -16
- package/dist/cjs/clipboard/copy.js +2 -2
- package/dist/cjs/clipboard/cut.js +2 -2
- package/dist/cjs/clipboard/paste.js +3 -4
- package/dist/cjs/document/UI.js +5 -7
- package/dist/cjs/document/interceptor.js +4 -4
- package/dist/cjs/document/patchFocus.js +5 -3
- package/dist/cjs/document/trackValue.js +2 -2
- package/dist/cjs/event/behavior/keydown.js +4 -4
- package/dist/cjs/event/behavior/keypress.js +1 -1
- package/dist/cjs/event/behavior/keyup.js +1 -1
- package/dist/cjs/event/behavior/paste.js +1 -1
- package/dist/cjs/event/createEvent.js +25 -39
- package/dist/cjs/event/dispatchEvent.js +1 -1
- package/dist/cjs/event/focus.js +3 -3
- package/dist/cjs/event/input.js +3 -2
- package/dist/cjs/event/selection/getInputRange.js +1 -1
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +2 -2
- package/dist/cjs/event/selection/modifySelection.js +1 -1
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +2 -2
- package/dist/cjs/event/selection/moveSelection.js +1 -1
- package/dist/cjs/event/selection/resolveCaretPosition.js +4 -5
- package/dist/cjs/event/selection/selectAll.js +5 -5
- package/dist/cjs/event/selection/setSelection.js +1 -1
- package/dist/cjs/event/selection/setSelectionPerMouse.js +9 -11
- package/dist/cjs/event/selection/setSelectionRange.js +1 -1
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/cjs/event/wrapEvent.js +2 -1
- package/dist/cjs/keyboard/index.js +1 -1
- package/dist/cjs/keyboard/parseKeyDef.js +4 -4
- package/dist/cjs/pointer/index.js +9 -9
- package/dist/cjs/setup/api.js +4 -4
- package/dist/cjs/setup/setup.js +10 -10
- package/dist/cjs/system/index.js +1 -3
- package/dist/cjs/system/keyboard.js +8 -11
- package/dist/cjs/system/pointer/buttons.js +1 -5
- package/dist/cjs/system/pointer/device.js +1 -3
- package/dist/cjs/system/pointer/index.js +19 -22
- package/dist/cjs/system/pointer/mouse.js +10 -13
- package/dist/cjs/system/pointer/pointer.js +6 -8
- package/dist/cjs/system/pointer/shared.js +1 -1
- package/dist/cjs/utility/type.js +1 -1
- package/dist/cjs/utility/upload.js +3 -3
- package/dist/cjs/utils/dataTransfer/Clipboard.js +14 -9
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +5 -7
- package/dist/cjs/utils/edit/isContentEditable.js +1 -1
- package/dist/cjs/utils/edit/maxLength.js +1 -1
- package/dist/cjs/utils/edit/setFiles.js +2 -3
- package/dist/cjs/utils/focus/cursor.js +1 -1
- package/dist/cjs/utils/focus/getActiveElement.js +10 -8
- package/dist/cjs/utils/focus/selector.js +2 -1
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +8 -9
- package/dist/cjs/utils/misc/getWindow.js +1 -1
- package/dist/cjs/utils/misc/isDisabled.js +1 -1
- package/dist/cjs/utils/misc/isVisible.js +1 -1
- package/dist/cjs/utils/pointer/cssPointerEvents.js +11 -12
- package/dist/esm/clipboard/copy.js +2 -2
- package/dist/esm/clipboard/cut.js +2 -2
- package/dist/esm/clipboard/paste.js +3 -4
- package/dist/esm/document/UI.js +5 -7
- package/dist/esm/document/interceptor.js +5 -5
- package/dist/esm/document/patchFocus.js +5 -3
- package/dist/esm/document/trackValue.js +3 -3
- package/dist/esm/event/behavior/keydown.js +5 -5
- package/dist/esm/event/behavior/keypress.js +1 -1
- package/dist/esm/event/behavior/keyup.js +1 -1
- package/dist/esm/event/behavior/paste.js +1 -1
- package/dist/esm/event/createEvent.js +25 -39
- package/dist/esm/event/dispatchEvent.js +1 -1
- package/dist/esm/event/focus.js +3 -3
- package/dist/esm/event/input.js +3 -2
- package/dist/esm/event/selection/getInputRange.js +1 -1
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +2 -2
- package/dist/esm/event/selection/modifySelection.js +1 -1
- package/dist/esm/event/selection/modifySelectionPerMouse.js +2 -2
- package/dist/esm/event/selection/moveSelection.js +1 -1
- package/dist/esm/event/selection/resolveCaretPosition.js +4 -5
- package/dist/esm/event/selection/selectAll.js +6 -6
- package/dist/esm/event/selection/setSelection.js +1 -1
- package/dist/esm/event/selection/setSelectionPerMouse.js +9 -11
- package/dist/esm/event/selection/setSelectionRange.js +1 -1
- package/dist/esm/event/selection/updateSelectionOnFocus.js +2 -2
- package/dist/esm/event/wrapEvent.js +2 -1
- package/dist/esm/keyboard/index.js +1 -1
- package/dist/esm/keyboard/parseKeyDef.js +4 -4
- package/dist/esm/pointer/index.js +9 -9
- package/dist/esm/setup/api.js +3 -3
- package/dist/esm/setup/setup.js +11 -11
- package/dist/esm/system/index.js +1 -3
- package/dist/esm/system/keyboard.js +8 -11
- package/dist/esm/system/pointer/buttons.js +1 -5
- package/dist/esm/system/pointer/device.js +1 -3
- package/dist/esm/system/pointer/index.js +19 -22
- package/dist/esm/system/pointer/mouse.js +10 -13
- package/dist/esm/system/pointer/pointer.js +6 -8
- package/dist/esm/system/pointer/shared.js +1 -1
- package/dist/esm/utility/type.js +1 -1
- package/dist/esm/utility/upload.js +3 -3
- package/dist/esm/utils/dataTransfer/Clipboard.js +14 -9
- package/dist/esm/utils/dataTransfer/DataTransfer.js +5 -7
- package/dist/esm/utils/edit/isContentEditable.js +1 -1
- package/dist/esm/utils/edit/maxLength.js +1 -1
- package/dist/esm/utils/edit/setFiles.js +2 -3
- package/dist/esm/utils/focus/cursor.js +1 -1
- package/dist/esm/utils/focus/getActiveElement.js +10 -8
- package/dist/esm/utils/focus/selector.js +2 -1
- package/dist/esm/utils/keyDef/readNextDescriptor.js +8 -9
- package/dist/esm/utils/misc/getWindow.js +1 -1
- package/dist/esm/utils/misc/isDisabled.js +1 -1
- package/dist/esm/utils/misc/isVisible.js +1 -1
- package/dist/esm/utils/pointer/cssPointerEvents.js +11 -12
- package/dist/types/document/UI.d.ts +3 -3
- package/dist/types/event/behavior/registry.d.ts +1 -2
- package/dist/types/options.d.ts +1 -1
- package/dist/types/system/keyboard.d.ts +1 -1
- package/package.json +6 -3
|
@@ -36,56 +36,42 @@ function createEvent(type, target, init) {
|
|
|
36
36
|
const window = getWindow(target);
|
|
37
37
|
const { EventType, defaultInit } = eventMap[type];
|
|
38
38
|
const event = new (getEventConstructors(window))[EventType](type, defaultInit);
|
|
39
|
-
eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !==
|
|
39
|
+
eventInitializer[EventType].forEach((f)=>f(event, init !== null && init !== void 0 ? init : {}));
|
|
40
40
|
return event;
|
|
41
41
|
}
|
|
42
42
|
/* istanbul ignore next */ function getEventConstructors(window) {
|
|
43
|
-
var _window_Event;
|
|
44
|
-
|
|
43
|
+
var _window_Event, _window_AnimationEvent, _window_ClipboardEvent, _window_PopStateEvent, _window_ProgressEvent, _window_TransitionEvent, _window_UIEvent, _window_CompositionEvent, _window_FocusEvent, _window_InputEvent, _window_KeyboardEvent, _window_MouseEvent, _window_DragEvent, _window_PointerEvent, _window_TouchEvent;
|
|
44
|
+
const Event = (_window_Event = window.Event) !== null && _window_Event !== void 0 ? _window_Event : class Event {
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== undefined ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
46
|
+
const AnimationEvent = (_window_AnimationEvent = window.AnimationEvent) !== null && _window_AnimationEvent !== void 0 ? _window_AnimationEvent : class AnimationEvent extends Event {
|
|
48
47
|
};
|
|
49
|
-
|
|
50
|
-
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== undefined ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
48
|
+
const ClipboardEvent = (_window_ClipboardEvent = window.ClipboardEvent) !== null && _window_ClipboardEvent !== void 0 ? _window_ClipboardEvent : class ClipboardEvent extends Event {
|
|
51
49
|
};
|
|
52
|
-
|
|
53
|
-
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== undefined ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
50
|
+
const PopStateEvent = (_window_PopStateEvent = window.PopStateEvent) !== null && _window_PopStateEvent !== void 0 ? _window_PopStateEvent : class PopStateEvent extends Event {
|
|
54
51
|
};
|
|
55
|
-
|
|
56
|
-
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== undefined ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
52
|
+
const ProgressEvent = (_window_ProgressEvent = window.ProgressEvent) !== null && _window_ProgressEvent !== void 0 ? _window_ProgressEvent : class ProgressEvent extends Event {
|
|
57
53
|
};
|
|
58
|
-
|
|
59
|
-
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== undefined ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
54
|
+
const TransitionEvent = (_window_TransitionEvent = window.TransitionEvent) !== null && _window_TransitionEvent !== void 0 ? _window_TransitionEvent : class TransitionEvent extends Event {
|
|
60
55
|
};
|
|
61
|
-
|
|
62
|
-
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== undefined ? _window_UIEvent : class UIEvent extends Event {
|
|
56
|
+
const UIEvent = (_window_UIEvent = window.UIEvent) !== null && _window_UIEvent !== void 0 ? _window_UIEvent : class UIEvent extends Event {
|
|
63
57
|
};
|
|
64
|
-
|
|
65
|
-
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== undefined ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
58
|
+
const CompositionEvent = (_window_CompositionEvent = window.CompositionEvent) !== null && _window_CompositionEvent !== void 0 ? _window_CompositionEvent : class CompositionEvent extends UIEvent {
|
|
66
59
|
};
|
|
67
|
-
|
|
68
|
-
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== undefined ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
60
|
+
const FocusEvent = (_window_FocusEvent = window.FocusEvent) !== null && _window_FocusEvent !== void 0 ? _window_FocusEvent : class FocusEvent extends UIEvent {
|
|
69
61
|
};
|
|
70
|
-
|
|
71
|
-
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== undefined ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
62
|
+
const InputEvent = (_window_InputEvent = window.InputEvent) !== null && _window_InputEvent !== void 0 ? _window_InputEvent : class InputEvent extends UIEvent {
|
|
72
63
|
};
|
|
73
|
-
|
|
74
|
-
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== undefined ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
64
|
+
const KeyboardEvent = (_window_KeyboardEvent = window.KeyboardEvent) !== null && _window_KeyboardEvent !== void 0 ? _window_KeyboardEvent : class KeyboardEvent extends UIEvent {
|
|
75
65
|
};
|
|
76
|
-
|
|
77
|
-
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== undefined ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
66
|
+
const MouseEvent = (_window_MouseEvent = window.MouseEvent) !== null && _window_MouseEvent !== void 0 ? _window_MouseEvent : class MouseEvent extends UIEvent {
|
|
78
67
|
};
|
|
79
|
-
|
|
80
|
-
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== undefined ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
68
|
+
const DragEvent = (_window_DragEvent = window.DragEvent) !== null && _window_DragEvent !== void 0 ? _window_DragEvent : class DragEvent extends MouseEvent {
|
|
81
69
|
};
|
|
82
|
-
|
|
83
|
-
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== undefined ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
70
|
+
const PointerEvent = (_window_PointerEvent = window.PointerEvent) !== null && _window_PointerEvent !== void 0 ? _window_PointerEvent : class PointerEvent extends MouseEvent {
|
|
84
71
|
};
|
|
85
|
-
|
|
86
|
-
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== undefined ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
72
|
+
const TouchEvent = (_window_TouchEvent = window.TouchEvent) !== null && _window_TouchEvent !== void 0 ? _window_TouchEvent : class TouchEvent extends UIEvent {
|
|
87
73
|
};
|
|
88
|
-
|
|
74
|
+
return {
|
|
89
75
|
Event,
|
|
90
76
|
AnimationEvent,
|
|
91
77
|
ClipboardEvent,
|
|
@@ -106,12 +92,12 @@ function createEvent(type, target, init) {
|
|
|
106
92
|
function assignProps(obj, props) {
|
|
107
93
|
for (const [key, value] of Object.entries(props)){
|
|
108
94
|
Object.defineProperty(obj, key, {
|
|
109
|
-
get: ()=>value !== null && value !==
|
|
95
|
+
get: ()=>value !== null && value !== void 0 ? value : null
|
|
110
96
|
});
|
|
111
97
|
}
|
|
112
98
|
}
|
|
113
99
|
function sanitizeNumber(n) {
|
|
114
|
-
return Number(n !== null && n !==
|
|
100
|
+
return Number(n !== null && n !== void 0 ? n : 0);
|
|
115
101
|
}
|
|
116
102
|
function initClipboardEvent(event, { clipboardData }) {
|
|
117
103
|
assignProps(event, {
|
|
@@ -133,7 +119,7 @@ function initInputEvent(event, { data, inputType, isComposing }) {
|
|
|
133
119
|
function initUIEvent(event, { view, detail }) {
|
|
134
120
|
assignProps(event, {
|
|
135
121
|
view,
|
|
136
|
-
detail: sanitizeNumber(detail !== null && detail !==
|
|
122
|
+
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0)
|
|
137
123
|
});
|
|
138
124
|
}
|
|
139
125
|
function initUIEventModifiers(event, { altKey, ctrlKey, metaKey, shiftKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierNumLock, modifierScrollLock, modifierSymbol, modifierSymbolLock }) {
|
|
@@ -187,12 +173,12 @@ function initMouseEvent(event, { x, y, screenX, screenY, clientX = x, clientY =
|
|
|
187
173
|
pageY: sanitizeNumber(pageY)
|
|
188
174
|
});
|
|
189
175
|
}
|
|
190
|
-
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary }) {
|
|
176
|
+
function initPointerEvent(event, { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary, buttons }) {
|
|
191
177
|
assignProps(event, {
|
|
192
178
|
pointerId: sanitizeNumber(pointerId),
|
|
193
|
-
width: sanitizeNumber(width !== null && width !==
|
|
194
|
-
height: sanitizeNumber(height !== null && height !==
|
|
195
|
-
pressure: sanitizeNumber(pressure),
|
|
179
|
+
width: sanitizeNumber(width !== null && width !== void 0 ? width : 1),
|
|
180
|
+
height: sanitizeNumber(height !== null && height !== void 0 ? height : 1),
|
|
181
|
+
pressure: sanitizeNumber(pressure !== null && pressure !== void 0 ? pressure : buttons ? 0.5 : 0),
|
|
196
182
|
tangentialPressure: sanitizeNumber(tangentialPressure),
|
|
197
183
|
tiltX: sanitizeNumber(tiltX),
|
|
198
184
|
tiltY: sanitizeNumber(tiltY),
|
|
@@ -22,7 +22,7 @@ function dispatchUIEvent(target, type, init, preventDefault = false) {
|
|
|
22
22
|
function dispatchEvent(target, event, preventDefault = false) {
|
|
23
23
|
var _behavior_type;
|
|
24
24
|
const type = event.type;
|
|
25
|
-
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = behavior[type]) === null || _behavior_type ===
|
|
25
|
+
const behaviorImplementation = preventDefault ? ()=>{} : (_behavior_type = 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;
|
package/dist/esm/event/focus.js
CHANGED
|
@@ -12,14 +12,14 @@ import { wrapEvent } from './wrapEvent.js';
|
|
|
12
12
|
*/ function focusElement(element) {
|
|
13
13
|
const target = findClosest(element, isFocusable);
|
|
14
14
|
const activeElement = getActiveElement(element.ownerDocument);
|
|
15
|
-
if ((target !== null && target !==
|
|
15
|
+
if ((target !== null && target !== void 0 ? target : element.ownerDocument.body) === activeElement) {
|
|
16
16
|
return;
|
|
17
17
|
} else if (target) {
|
|
18
18
|
wrapEvent(()=>target.focus());
|
|
19
19
|
} else {
|
|
20
|
-
wrapEvent(()=>activeElement === null || activeElement ===
|
|
20
|
+
wrapEvent(()=>activeElement === null || activeElement === void 0 ? void 0 : activeElement.blur());
|
|
21
21
|
}
|
|
22
|
-
updateSelectionOnFocus(target !== null && target !==
|
|
22
|
+
updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body);
|
|
23
23
|
}
|
|
24
24
|
function blurElement(element) {
|
|
25
25
|
if (!isFocusable(element)) return;
|
package/dist/esm/event/input.js
CHANGED
|
@@ -80,7 +80,8 @@ function editInputElement(instance, element, inputRange, data, inputType) {
|
|
|
80
80
|
if (supportsMaxLength(element)) {
|
|
81
81
|
const maxLength = getMaxLength(element);
|
|
82
82
|
if (maxLength !== undefined && data.length > 0) {
|
|
83
|
-
const
|
|
83
|
+
const selectionLength = inputRange.endOffset - inputRange.startOffset;
|
|
84
|
+
const spaceUntilMaxLength = maxLength - element.value.length + selectionLength;
|
|
84
85
|
if (spaceUntilMaxLength > 0) {
|
|
85
86
|
dataToInsert = data.substring(0, spaceUntilMaxLength);
|
|
86
87
|
} else {
|
|
@@ -149,7 +150,7 @@ function isValidNumberInput(value) {
|
|
|
149
150
|
// it allows up to two '-' at any place before any 'e' or one directly following 'e'
|
|
150
151
|
// it allows one '.' at any place before e
|
|
151
152
|
const valueParts = value.split('e', 2);
|
|
152
|
-
return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match ===
|
|
153
|
+
return !(/[^\d.\-e]/.test(value) || Number((_value_match = value.match(/-/g)) === null || _value_match === void 0 ? void 0 : _value_match.length) > 2 || Number((_value_match1 = value.match(/\./g)) === null || _value_match1 === void 0 ? void 0 : _value_match1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1]));
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
export { input };
|
|
@@ -9,7 +9,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
9
9
|
} else if (typeAndSelection.type === 'contenteditable') {
|
|
10
10
|
var _typeAndSelection_selection;
|
|
11
11
|
// Multi-range on contenteditable edits the first selection instead of the last
|
|
12
|
-
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection ===
|
|
12
|
+
return (_typeAndSelection_selection = typeAndSelection.selection) === null || _typeAndSelection_selection === void 0 ? void 0 : _typeAndSelection_selection.getRangeAt(0);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -13,10 +13,10 @@ import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
|
13
13
|
selection: getUISelection(element)
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
const selection = element === null || element ===
|
|
16
|
+
const selection = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection();
|
|
17
17
|
// It is possible to extend a single-range selection into a contenteditable.
|
|
18
18
|
// This results in the range acting like a range outside of contenteditable.
|
|
19
|
-
const isCE = getContentEditable(node) && (selection === null || selection ===
|
|
19
|
+
const isCE = getContentEditable(node) && (selection === null || selection === void 0 ? void 0 : selection.anchorNode) && getContentEditable(selection.anchorNode);
|
|
20
20
|
return {
|
|
21
21
|
type: isCE ? 'contenteditable' : 'default',
|
|
22
22
|
selection
|
|
@@ -13,7 +13,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
13
13
|
focusOffset
|
|
14
14
|
}, 'modify');
|
|
15
15
|
}
|
|
16
|
-
(_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument ===
|
|
16
|
+
(_focusNode_ownerDocument = focusNode.ownerDocument) === null || _focusNode_ownerDocument === void 0 ? void 0 : (_focusNode_ownerDocument_getSelection = _focusNode_ownerDocument.getSelection()) === null || _focusNode_ownerDocument_getSelection === void 0 ? void 0 : _focusNode_ownerDocument_getSelection.extend(focusNode, focusOffset);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export { modifySelection };
|
|
@@ -30,8 +30,8 @@ function modifySelectionPerMouseMove(selectionRange, { document, target, node, o
|
|
|
30
30
|
range.setEnd(selectionFocus.node, selectionFocus.offset);
|
|
31
31
|
}
|
|
32
32
|
const selection = document.getSelection();
|
|
33
|
-
selection === null || selection ===
|
|
34
|
-
selection === null || selection ===
|
|
33
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
34
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -16,7 +16,7 @@ import { setSelection } from './setSelection.js';
|
|
|
16
16
|
});
|
|
17
17
|
} else {
|
|
18
18
|
const selection = node.ownerDocument.getSelection();
|
|
19
|
-
if (!(selection === null || selection ===
|
|
19
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if (selection.isCollapsed) {
|
|
@@ -6,12 +6,12 @@ function resolveCaretPosition({ target, node, offset }) {
|
|
|
6
6
|
if (hasOwnSelection(target)) {
|
|
7
7
|
return {
|
|
8
8
|
node: target,
|
|
9
|
-
offset: offset !== null && offset !==
|
|
9
|
+
offset: offset !== null && offset !== void 0 ? offset : getUIValue(target).length
|
|
10
10
|
};
|
|
11
11
|
} else if (node) {
|
|
12
12
|
return {
|
|
13
13
|
node,
|
|
14
|
-
offset: offset !== null && offset !==
|
|
14
|
+
offset: offset !== null && offset !== void 0 ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
return findNodeAtTextOffset(target, offset);
|
|
@@ -39,11 +39,10 @@ function findNodeAtTextOffset(node, offset, isRoot = true) {
|
|
|
39
39
|
} else {
|
|
40
40
|
// The pre-commit hooks keeps changing this
|
|
41
41
|
// See https://github.com/kentcdodds/kcd-scripts/issues/218
|
|
42
|
-
/* istanbul ignore else */
|
|
43
|
-
if (c.nodeType === 3) {
|
|
42
|
+
/* istanbul ignore else */ if (c.nodeType === 3) {
|
|
44
43
|
return {
|
|
45
44
|
node: c,
|
|
46
|
-
offset: offset !== null && offset !==
|
|
45
|
+
offset: offset !== null && offset !== void 0 ? offset : c.nodeValue.length
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getUISelection, getUIValue } from '../../document/UI.js';
|
|
2
2
|
import '../../utils/dataTransfer/Clipboard.js';
|
|
3
3
|
import { getContentEditable } from '../../utils/edit/isContentEditable.js';
|
|
4
4
|
import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
@@ -7,6 +7,7 @@ import { setSelection } from './setSelection.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Expand a selection like the browser does when pressing Ctrl+A.
|
|
9
9
|
*/ function selectAll(target) {
|
|
10
|
+
var _getContentEditable;
|
|
10
11
|
if (hasOwnSelection(target)) {
|
|
11
12
|
return setSelection({
|
|
12
13
|
focusNode: target,
|
|
@@ -14,8 +15,7 @@ import { setSelection } from './setSelection.js';
|
|
|
14
15
|
focusOffset: getUIValue(target).length
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
|
|
18
|
+
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
|
|
19
19
|
setSelection({
|
|
20
20
|
focusNode,
|
|
21
21
|
anchorOffset: 0,
|
|
@@ -23,13 +23,13 @@ import { setSelection } from './setSelection.js';
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
function isAllSelected(target) {
|
|
26
|
+
var _getContentEditable;
|
|
26
27
|
if (hasOwnSelection(target)) {
|
|
27
28
|
return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== undefined ? _getContentEditable : target.ownerDocument.body;
|
|
30
|
+
const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body;
|
|
31
31
|
const selection = target.ownerDocument.getSelection();
|
|
32
|
-
return (selection === null || selection ===
|
|
32
|
+
return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { isAllSelected, selectAll };
|
|
@@ -13,7 +13,7 @@ import { getTargetTypeAndSelection } from './getTargetTypeAndSelection.js';
|
|
|
13
13
|
focusOffset
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
(_anchorNode_ownerDocument = anchorNode.ownerDocument) === null || _anchorNode_ownerDocument ===
|
|
16
|
+
(_anchorNode_ownerDocument = anchorNode.ownerDocument) === null || _anchorNode_ownerDocument === void 0 ? void 0 : (_anchorNode_ownerDocument_getSelection = _anchorNode_ownerDocument.getSelection()) === null || _anchorNode_ownerDocument_getSelection === void 0 ? void 0 : _anchorNode_ownerDocument_getSelection.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export { setSelection };
|
|
@@ -14,22 +14,20 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
14
14
|
// Looks it might be every inline element.
|
|
15
15
|
// TODO: Check what might be considered part of the same line of text.
|
|
16
16
|
const text = String(targetHasOwnSelection ? getUIValue(target) : target.textContent);
|
|
17
|
-
const [start, end] = node ?
|
|
18
|
-
// TODO: support expanding initial range on multiple clicks if node is given
|
|
19
|
-
[
|
|
17
|
+
const [start, end] = node ? [
|
|
20
18
|
offset,
|
|
21
19
|
offset
|
|
22
20
|
] : getTextRange(text, offset, clickCount);
|
|
23
21
|
// TODO: implement modifying selection per shift/ctrl+mouse
|
|
24
22
|
if (targetHasOwnSelection) {
|
|
25
23
|
setUISelection(target, {
|
|
26
|
-
anchorOffset: start !== null && start !==
|
|
27
|
-
focusOffset: end !== null && end !==
|
|
24
|
+
anchorOffset: start !== null && start !== void 0 ? start : text.length,
|
|
25
|
+
focusOffset: end !== null && end !== void 0 ? end : text.length
|
|
28
26
|
});
|
|
29
27
|
return {
|
|
30
28
|
node: target,
|
|
31
|
-
start: start !== null && start !==
|
|
32
|
-
end: end !== null && end !==
|
|
29
|
+
start: start !== null && start !== void 0 ? start : 0,
|
|
30
|
+
end: end !== null && end !== void 0 ? end : text.length
|
|
33
31
|
};
|
|
34
32
|
} else {
|
|
35
33
|
const { node: startNode, offset: startOffset } = resolveCaretPosition({
|
|
@@ -46,12 +44,12 @@ function setSelectionPerMouseDown({ document, target, clickCount, node, offset }
|
|
|
46
44
|
try {
|
|
47
45
|
range.setStart(startNode, startOffset);
|
|
48
46
|
range.setEnd(endNode, endOffset);
|
|
49
|
-
} catch
|
|
47
|
+
} catch {
|
|
50
48
|
throw new Error('The given offset is out of bounds.');
|
|
51
49
|
}
|
|
52
50
|
const selection = document.getSelection();
|
|
53
|
-
selection === null || selection ===
|
|
54
|
-
selection === null || selection ===
|
|
51
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
52
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange());
|
|
55
53
|
return range;
|
|
56
54
|
}
|
|
57
55
|
}
|
|
@@ -62,7 +60,7 @@ function getTextRange(text, pos, clickCount) {
|
|
|
62
60
|
pos
|
|
63
61
|
];
|
|
64
62
|
}
|
|
65
|
-
const textPos = pos !== null && pos !==
|
|
63
|
+
const textPos = pos !== null && pos !== void 0 ? pos : text.length;
|
|
66
64
|
if (clickCount % 3 === 2) {
|
|
67
65
|
return [
|
|
68
66
|
textPos - text.substr(0, pos).match(/(\w+|\s+|\W)?$/)[0].length,
|
|
@@ -16,7 +16,7 @@ import { setSelection } from './setSelection.js';
|
|
|
16
16
|
focusOffset
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
/* istanbul ignore else */ if (isContentEditable(element) && ((_element_firstChild = element.firstChild) === null || _element_firstChild ===
|
|
19
|
+
/* istanbul ignore else */ if (isContentEditable(element) && ((_element_firstChild = element.firstChild) === null || _element_firstChild === void 0 ? void 0 : _element_firstChild.nodeType) === 3) {
|
|
20
20
|
return setSelection({
|
|
21
21
|
focusNode: element.firstChild,
|
|
22
22
|
anchorOffset,
|
|
@@ -11,7 +11,7 @@ import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
|
11
11
|
* with own selection implementation.
|
|
12
12
|
*/ function updateSelectionOnFocus(element) {
|
|
13
13
|
const selection = element.ownerDocument.getSelection();
|
|
14
|
-
/* istanbul ignore if */ if (!(selection === null || selection ===
|
|
14
|
+
/* istanbul ignore if */ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
// If the focus moves inside an element with own selection implementation,
|
|
@@ -26,7 +26,7 @@ import { hasOwnSelection } from '../../utils/focus/selection.js';
|
|
|
26
26
|
if (contenteditable) {
|
|
27
27
|
if (!selection.isCollapsed) {
|
|
28
28
|
var _contenteditable_firstChild;
|
|
29
|
-
const focusNode = ((_contenteditable_firstChild = contenteditable.firstChild) === null || _contenteditable_firstChild ===
|
|
29
|
+
const focusNode = ((_contenteditable_firstChild = contenteditable.firstChild) === null || _contenteditable_firstChild === void 0 ? void 0 : _contenteditable_firstChild.nodeType) === 3 ? contenteditable.firstChild : contenteditable;
|
|
30
30
|
selection.setBaseAndExtent(focusNode, 0, focusNode, 0);
|
|
31
31
|
}
|
|
32
32
|
} else {
|
|
@@ -17,7 +17,7 @@ async function keyboardAction(instance, { keyDef, releasePrevious, releaseSelf,
|
|
|
17
17
|
}
|
|
18
18
|
if (!releasePrevious) {
|
|
19
19
|
for(let i = 1; i <= repeat; i++){
|
|
20
|
-
await system.keyboard.keydown(instance, keyDef);
|
|
20
|
+
await system.keyboard.keydown(instance, keyDef, i > 1);
|
|
21
21
|
if (i < repeat) {
|
|
22
22
|
await wait(instance.config);
|
|
23
23
|
}
|
|
@@ -13,18 +13,18 @@ import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
|
|
|
13
13
|
*/ function parseKeyDef(keyboardMap, text) {
|
|
14
14
|
const defs = [];
|
|
15
15
|
do {
|
|
16
|
-
const { type, descriptor, consumedLength, releasePrevious, releaseSelf = true, repeat } = readNextDescriptor(text, 'keyboard');
|
|
17
16
|
var _keyboardMap_find;
|
|
17
|
+
const { type, descriptor, consumedLength, releasePrevious, releaseSelf = true, repeat } = readNextDescriptor(text, 'keyboard');
|
|
18
18
|
const keyDef = (_keyboardMap_find = keyboardMap.find((def)=>{
|
|
19
19
|
if (type === '[') {
|
|
20
20
|
var _def_code;
|
|
21
|
-
return ((_def_code = def.code) === null || _def_code ===
|
|
21
|
+
return ((_def_code = def.code) === null || _def_code === void 0 ? void 0 : _def_code.toLowerCase()) === descriptor.toLowerCase();
|
|
22
22
|
} else if (type === '{') {
|
|
23
23
|
var _def_key;
|
|
24
|
-
return ((_def_key = def.key) === null || _def_key ===
|
|
24
|
+
return ((_def_key = def.key) === null || _def_key === void 0 ? void 0 : _def_key.toLowerCase()) === descriptor.toLowerCase();
|
|
25
25
|
}
|
|
26
26
|
return def.key === descriptor;
|
|
27
|
-
})) !== null && _keyboardMap_find !==
|
|
27
|
+
})) !== null && _keyboardMap_find !== void 0 ? _keyboardMap_find : {
|
|
28
28
|
key: 'Unknown',
|
|
29
29
|
code: 'Unknown',
|
|
30
30
|
[type === '[' ? 'code' : 'key']: descriptor
|
|
@@ -27,16 +27,16 @@ async function pointer(input) {
|
|
|
27
27
|
this.system.pointer.resetClickCount();
|
|
28
28
|
}
|
|
29
29
|
async function pointerAction(instance, action) {
|
|
30
|
+
var _action_target, _action_coords, _action_node, _action_offset;
|
|
30
31
|
var _previousPosition_caret, _previousPosition_caret1;
|
|
31
32
|
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? instance.system.pointer.getPointerName(action.keyDef) : 'mouse';
|
|
32
33
|
const previousPosition = instance.system.pointer.getPreviousPosition(pointerName);
|
|
33
|
-
var _action_target, _action_coords, _action_node, _action_offset;
|
|
34
34
|
const position = {
|
|
35
|
-
target: (_action_target = action.target) !== null && _action_target !==
|
|
36
|
-
coords: (_action_coords = action.coords) !== null && _action_coords !==
|
|
35
|
+
target: (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : getPrevTarget(instance, previousPosition),
|
|
36
|
+
coords: (_action_coords = action.coords) !== null && _action_coords !== void 0 ? _action_coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords,
|
|
37
37
|
caret: {
|
|
38
|
-
node: (_action_node = action.node) !== null && _action_node !==
|
|
39
|
-
offset: (_action_offset = action.offset) !== null && _action_offset !==
|
|
38
|
+
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,
|
|
39
|
+
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
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
if ('keyDef' in action) {
|
|
@@ -58,15 +58,15 @@ async function pointerAction(instance, action) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function hasCaretPosition(action) {
|
|
61
|
-
var
|
|
62
|
-
return !!((_ref = (_action_target = action.target) !== null && _action_target !==
|
|
61
|
+
var _ref, _action_target;
|
|
62
|
+
return !!((_ref = (_action_target = action.target) !== null && _action_target !== void 0 ? _action_target : action.node) !== null && _ref !== void 0 ? _ref : action.offset !== undefined);
|
|
63
63
|
}
|
|
64
64
|
function getPrevTarget(instance, position) {
|
|
65
|
+
var _position_target;
|
|
65
66
|
if (!position) {
|
|
66
67
|
throw new Error('This pointer has no previous position. Provide a target property!');
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
return (_position_target = position.target) !== null && _position_target !== undefined ? _position_target : instance.config.document.body;
|
|
69
|
+
return (_position_target = position.target) !== null && _position_target !== void 0 ? _position_target : instance.config.document.body;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export { pointer };
|
package/dist/esm/setup/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { tripleClick, dblClick, click } from '../convenience/click.js';
|
|
2
|
+
import { unhover, hover } from '../convenience/hover.js';
|
|
3
3
|
import { tab } from '../convenience/tab.js';
|
|
4
4
|
import { keyboard } from '../keyboard/index.js';
|
|
5
5
|
import { copy } from '../clipboard/copy.js';
|
|
@@ -7,7 +7,7 @@ import { cut } from '../clipboard/cut.js';
|
|
|
7
7
|
import { paste } from '../clipboard/paste.js';
|
|
8
8
|
import { pointer } from '../pointer/index.js';
|
|
9
9
|
import { clear } from '../utility/clear.js';
|
|
10
|
-
import {
|
|
10
|
+
import { selectOptions, deselectOptions } from '../utility/selectOptions.js';
|
|
11
11
|
import { type } from '../utility/type.js';
|
|
12
12
|
import { upload } from '../utility/upload.js';
|
|
13
13
|
|
package/dist/esm/setup/setup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { patchFocus } from '../document/patchFocus.js';
|
|
2
2
|
import { prepareDocument } from '../document/prepareDocument.js';
|
|
3
|
-
import {
|
|
3
|
+
import { dispatchUIEvent, dispatchEvent } from '../event/dispatchEvent.js';
|
|
4
4
|
import { attachClipboardStubToView } from '../utils/dataTransfer/Clipboard.js';
|
|
5
5
|
import { getWindow } from '../utils/misc/getWindow.js';
|
|
6
6
|
import { getDocumentFromNode } from '../utils/misc/getDocumentFromNode.js';
|
|
@@ -8,8 +8,8 @@ import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
|
|
|
8
8
|
import { wait } from '../utils/misc/wait.js';
|
|
9
9
|
import { PointerEventsCheckLevel } from '../options.js';
|
|
10
10
|
import '@testing-library/dom';
|
|
11
|
-
import { defaultKeyMap } from '../keyboard/keyMap.js';
|
|
12
|
-
import { defaultKeyMap
|
|
11
|
+
import { defaultKeyMap as defaultKeyMap$1 } from '../keyboard/keyMap.js';
|
|
12
|
+
import { defaultKeyMap } from '../pointer/keyMap.js';
|
|
13
13
|
import { System } from '../system/index.js';
|
|
14
14
|
import { userEventApi } from './api.js';
|
|
15
15
|
import { wrapAsync } from './wrapAsync.js';
|
|
@@ -21,8 +21,8 @@ import { wrapAsync } from './wrapAsync.js';
|
|
|
21
21
|
autoModify: true,
|
|
22
22
|
delay: 0,
|
|
23
23
|
document: globalThis.document,
|
|
24
|
-
keyboardMap: defaultKeyMap,
|
|
25
|
-
pointerMap: defaultKeyMap
|
|
24
|
+
keyboardMap: defaultKeyMap$1,
|
|
25
|
+
pointerMap: defaultKeyMap,
|
|
26
26
|
pointerEventsCheck: PointerEventsCheckLevel.EachApiCall,
|
|
27
27
|
skipAutoClose: false,
|
|
28
28
|
skipClick: false,
|
|
@@ -48,22 +48,22 @@ function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
|
|
|
48
48
|
* Start a "session" with userEvent.
|
|
49
49
|
* All APIs returned by this function share an input device state and a default configuration.
|
|
50
50
|
*/ function setupMain(options = {}) {
|
|
51
|
+
var _config_document_defaultView;
|
|
51
52
|
const config = createConfig(options);
|
|
52
53
|
prepareDocument(config.document);
|
|
53
54
|
patchFocus(getWindow(config.document).HTMLElement);
|
|
54
|
-
|
|
55
|
-
const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== undefined ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
|
|
55
|
+
const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== void 0 ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
|
|
56
56
|
attachClipboardStubToView(view);
|
|
57
57
|
return createInstance(config).api;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Setup in direct call per `userEvent.anyApi()`
|
|
61
61
|
*/ function setupDirect({ keyboardState, pointerState, ...options } = {}, node) {
|
|
62
|
+
var _ref;
|
|
62
63
|
const config = createConfig(options, defaultOptionsDirect, node);
|
|
63
64
|
prepareDocument(config.document);
|
|
64
65
|
patchFocus(getWindow(config.document).HTMLElement);
|
|
65
|
-
|
|
66
|
-
const system = (_ref = pointerState !== null && pointerState !== undefined ? pointerState : keyboardState) !== null && _ref !== undefined ? _ref : new System();
|
|
66
|
+
const system = (_ref = pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState) !== null && _ref !== void 0 ? _ref : new System();
|
|
67
67
|
return {
|
|
68
68
|
api: createInstance(config, system).api,
|
|
69
69
|
system
|
|
@@ -112,8 +112,8 @@ function createInstance(config, system = new System()) {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function getDocument(options, node, defaults) {
|
|
115
|
-
var
|
|
116
|
-
return (_ref = (_options_document = options.document) !== null && _options_document !==
|
|
115
|
+
var _ref, _options_document;
|
|
116
|
+
return (_ref = (_options_document = options.document) !== null && _options_document !== void 0 ? _options_document : node && getDocumentFromNode(node)) !== null && _ref !== void 0 ? _ref : defaults.document;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export { createConfig, createInstance, setupDirect, setupMain, setupSub };
|