@depup/testing-library__user-event 14.6.3-depup.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/LICENSE +20 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/cjs/clipboard/copy.js +22 -0
- package/dist/cjs/clipboard/cut.js +22 -0
- package/dist/cjs/clipboard/index.js +11 -0
- package/dist/cjs/clipboard/paste.js +24 -0
- package/dist/cjs/convenience/click.js +35 -0
- package/dist/cjs/convenience/hover.js +19 -0
- package/dist/cjs/convenience/index.js +14 -0
- package/dist/cjs/convenience/tab.js +7 -0
- package/dist/cjs/document/UI.js +90 -0
- package/dist/cjs/document/copySelection.js +29 -0
- package/dist/cjs/document/getValueOrTextContent.js +18 -0
- package/dist/cjs/document/index.js +17 -0
- package/dist/cjs/document/interceptor.js +104 -0
- package/dist/cjs/document/patchFocus.js +106 -0
- package/dist/cjs/document/prepareDocument.js +58 -0
- package/dist/cjs/document/trackValue.js +57 -0
- package/dist/cjs/event/behavior/click.js +32 -0
- package/dist/cjs/event/behavior/cut.js +14 -0
- package/dist/cjs/event/behavior/index.js +13 -0
- package/dist/cjs/event/behavior/keydown.js +128 -0
- package/dist/cjs/event/behavior/keypress.js +51 -0
- package/dist/cjs/event/behavior/keyup.js +17 -0
- package/dist/cjs/event/behavior/paste.js +18 -0
- package/dist/cjs/event/behavior/registry.js +5 -0
- package/dist/cjs/event/createEvent.js +193 -0
- package/dist/cjs/event/dispatchEvent.js +54 -0
- package/dist/cjs/event/eventMap.js +281 -0
- package/dist/cjs/event/focus.js +34 -0
- package/dist/cjs/event/index.js +22 -0
- package/dist/cjs/event/input.js +158 -0
- package/dist/cjs/event/radio.js +27 -0
- package/dist/cjs/event/selection/getInputRange.js +18 -0
- package/dist/cjs/event/selection/getTargetTypeAndSelection.js +31 -0
- package/dist/cjs/event/selection/index.js +24 -0
- package/dist/cjs/event/selection/modifySelection.js +21 -0
- package/dist/cjs/event/selection/modifySelectionPerMouse.js +40 -0
- package/dist/cjs/event/selection/moveSelection.js +38 -0
- package/dist/cjs/event/selection/resolveCaretPosition.js +60 -0
- package/dist/cjs/event/selection/selectAll.js +38 -0
- package/dist/cjs/event/selection/setSelection.js +21 -0
- package/dist/cjs/event/selection/setSelectionPerMouse.js +79 -0
- package/dist/cjs/event/selection/setSelectionRange.js +31 -0
- package/dist/cjs/event/selection/updateSelectionOnFocus.js +40 -0
- package/dist/cjs/event/types.js +2 -0
- package/dist/cjs/event/wrapEvent.js +10 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/keyboard/index.js +40 -0
- package/dist/cjs/keyboard/keyMap.js +178 -0
- package/dist/cjs/keyboard/parseKeyDef.js +45 -0
- package/dist/cjs/options.js +14 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pointer/index.js +74 -0
- package/dist/cjs/pointer/keyMap.js +33 -0
- package/dist/cjs/pointer/parseKeyDef.js +23 -0
- package/dist/cjs/setup/api.js +35 -0
- package/dist/cjs/setup/directApi.js +75 -0
- package/dist/cjs/setup/index.js +11 -0
- package/dist/cjs/setup/setup.js +125 -0
- package/dist/cjs/setup/wrapAsync.js +11 -0
- package/dist/cjs/system/index.js +42 -0
- package/dist/cjs/system/keyboard.js +165 -0
- package/dist/cjs/system/pointer/buttons.js +80 -0
- package/dist/cjs/system/pointer/device.js +32 -0
- package/dist/cjs/system/pointer/index.js +156 -0
- package/dist/cjs/system/pointer/mouse.js +204 -0
- package/dist/cjs/system/pointer/pointer.js +129 -0
- package/dist/cjs/system/pointer/shared.js +8 -0
- package/dist/cjs/utility/clear.js +32 -0
- package/dist/cjs/utility/index.js +14 -0
- package/dist/cjs/utility/selectOptions.js +114 -0
- package/dist/cjs/utility/type.js +23 -0
- package/dist/cjs/utility/upload.js +62 -0
- package/dist/cjs/utils/click/isClickableInput.js +20 -0
- package/dist/cjs/utils/dataTransfer/Blob.js +16 -0
- package/dist/cjs/utils/dataTransfer/Clipboard.js +174 -0
- package/dist/cjs/utils/dataTransfer/DataTransfer.js +134 -0
- package/dist/cjs/utils/dataTransfer/FileList.js +24 -0
- package/dist/cjs/utils/edit/isContentEditable.js +18 -0
- package/dist/cjs/utils/edit/isEditable.js +29 -0
- package/dist/cjs/utils/edit/maxLength.js +26 -0
- package/dist/cjs/utils/edit/setFiles.js +58 -0
- package/dist/cjs/utils/edit/timeValue.js +40 -0
- package/dist/cjs/utils/focus/cursor.js +126 -0
- package/dist/cjs/utils/focus/getActiveElement.js +25 -0
- package/dist/cjs/utils/focus/getTabDestination.js +80 -0
- package/dist/cjs/utils/focus/isFocusable.js +9 -0
- package/dist/cjs/utils/focus/selection.js +20 -0
- package/dist/cjs/utils/focus/selector.js +15 -0
- package/dist/cjs/utils/index.js +78 -0
- package/dist/cjs/utils/keyDef/readNextDescriptor.js +91 -0
- package/dist/cjs/utils/misc/cloneEvent.js +7 -0
- package/dist/cjs/utils/misc/findClosest.js +14 -0
- package/dist/cjs/utils/misc/getDocumentFromNode.js +10 -0
- package/dist/cjs/utils/misc/getTreeDiff.js +25 -0
- package/dist/cjs/utils/misc/getWindow.js +19 -0
- package/dist/cjs/utils/misc/isDescendantOrSelf.js +14 -0
- package/dist/cjs/utils/misc/isDisabled.js +33 -0
- package/dist/cjs/utils/misc/isElementType.js +20 -0
- package/dist/cjs/utils/misc/isVisible.js +19 -0
- package/dist/cjs/utils/misc/level.js +17 -0
- package/dist/cjs/utils/misc/wait.js +14 -0
- package/dist/cjs/utils/pointer/cssPointerEvents.js +102 -0
- package/dist/esm/clipboard/copy.js +20 -0
- package/dist/esm/clipboard/cut.js +20 -0
- package/dist/esm/clipboard/index.js +3 -0
- package/dist/esm/clipboard/paste.js +22 -0
- package/dist/esm/convenience/click.js +31 -0
- package/dist/esm/convenience/hover.js +16 -0
- package/dist/esm/convenience/index.js +3 -0
- package/dist/esm/convenience/tab.js +5 -0
- package/dist/esm/document/UI.js +77 -0
- package/dist/esm/document/copySelection.js +27 -0
- package/dist/esm/document/getValueOrTextContent.js +16 -0
- package/dist/esm/document/index.js +4 -0
- package/dist/esm/document/interceptor.js +99 -0
- package/dist/esm/document/patchFocus.js +103 -0
- package/dist/esm/document/prepareDocument.js +56 -0
- package/dist/esm/document/trackValue.js +53 -0
- package/dist/esm/event/behavior/click.js +30 -0
- package/dist/esm/event/behavior/cut.js +12 -0
- package/dist/esm/event/behavior/index.js +7 -0
- package/dist/esm/event/behavior/keydown.js +126 -0
- package/dist/esm/event/behavior/keypress.js +49 -0
- package/dist/esm/event/behavior/keyup.js +15 -0
- package/dist/esm/event/behavior/paste.js +16 -0
- package/dist/esm/event/behavior/registry.js +3 -0
- package/dist/esm/event/createEvent.js +191 -0
- package/dist/esm/event/dispatchEvent.js +50 -0
- package/dist/esm/event/eventMap.js +277 -0
- package/dist/esm/event/focus.js +31 -0
- package/dist/esm/event/index.js +7 -0
- package/dist/esm/event/input.js +156 -0
- package/dist/esm/event/radio.js +25 -0
- package/dist/esm/event/selection/getInputRange.js +16 -0
- package/dist/esm/event/selection/getTargetTypeAndSelection.js +29 -0
- package/dist/esm/event/selection/index.js +9 -0
- package/dist/esm/event/selection/modifySelection.js +19 -0
- package/dist/esm/event/selection/modifySelectionPerMouse.js +38 -0
- package/dist/esm/event/selection/moveSelection.js +36 -0
- package/dist/esm/event/selection/resolveCaretPosition.js +58 -0
- package/dist/esm/event/selection/selectAll.js +35 -0
- package/dist/esm/event/selection/setSelection.js +19 -0
- package/dist/esm/event/selection/setSelectionPerMouse.js +77 -0
- package/dist/esm/event/selection/setSelectionRange.js +29 -0
- package/dist/esm/event/selection/updateSelectionOnFocus.js +38 -0
- package/dist/esm/event/types.js +1 -0
- package/dist/esm/event/wrapEvent.js +8 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/keyboard/index.js +37 -0
- package/dist/esm/keyboard/keyMap.js +176 -0
- package/dist/esm/keyboard/parseKeyDef.js +43 -0
- package/dist/esm/options.js +12 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/pointer/index.js +72 -0
- package/dist/esm/pointer/keyMap.js +31 -0
- package/dist/esm/pointer/parseKeyDef.js +21 -0
- package/dist/esm/setup/api.js +33 -0
- package/dist/esm/setup/directApi.js +58 -0
- package/dist/esm/setup/index.js +9 -0
- package/dist/esm/setup/setup.js +119 -0
- package/dist/esm/setup/wrapAsync.js +9 -0
- package/dist/esm/system/index.js +40 -0
- package/dist/esm/system/keyboard.js +162 -0
- package/dist/esm/system/pointer/buttons.js +74 -0
- package/dist/esm/system/pointer/device.js +30 -0
- package/dist/esm/system/pointer/index.js +154 -0
- package/dist/esm/system/pointer/mouse.js +202 -0
- package/dist/esm/system/pointer/pointer.js +127 -0
- package/dist/esm/system/pointer/shared.js +6 -0
- package/dist/esm/utility/clear.js +30 -0
- package/dist/esm/utility/index.js +4 -0
- package/dist/esm/utility/selectOptions.js +111 -0
- package/dist/esm/utility/type.js +21 -0
- package/dist/esm/utility/upload.js +60 -0
- package/dist/esm/utils/click/isClickableInput.js +18 -0
- package/dist/esm/utils/dataTransfer/Blob.js +14 -0
- package/dist/esm/utils/dataTransfer/Clipboard.js +167 -0
- package/dist/esm/utils/dataTransfer/DataTransfer.js +131 -0
- package/dist/esm/utils/dataTransfer/FileList.js +22 -0
- package/dist/esm/utils/edit/isContentEditable.js +15 -0
- package/dist/esm/utils/edit/isEditable.js +26 -0
- package/dist/esm/utils/edit/maxLength.js +23 -0
- package/dist/esm/utils/edit/setFiles.js +56 -0
- package/dist/esm/utils/edit/timeValue.js +37 -0
- package/dist/esm/utils/focus/cursor.js +124 -0
- package/dist/esm/utils/focus/getActiveElement.js +22 -0
- package/dist/esm/utils/focus/getTabDestination.js +78 -0
- package/dist/esm/utils/focus/isFocusable.js +7 -0
- package/dist/esm/utils/focus/selection.js +17 -0
- package/dist/esm/utils/focus/selector.js +13 -0
- package/dist/esm/utils/index.js +29 -0
- package/dist/esm/utils/keyDef/readNextDescriptor.js +89 -0
- package/dist/esm/utils/misc/cloneEvent.js +5 -0
- package/dist/esm/utils/misc/findClosest.js +12 -0
- package/dist/esm/utils/misc/getDocumentFromNode.js +8 -0
- package/dist/esm/utils/misc/getTreeDiff.js +23 -0
- package/dist/esm/utils/misc/getWindow.js +17 -0
- package/dist/esm/utils/misc/isDescendantOrSelf.js +12 -0
- package/dist/esm/utils/misc/isDisabled.js +31 -0
- package/dist/esm/utils/misc/isElementType.js +18 -0
- package/dist/esm/utils/misc/isVisible.js +17 -0
- package/dist/esm/utils/misc/level.js +13 -0
- package/dist/esm/utils/misc/wait.js +12 -0
- package/dist/esm/utils/pointer/cssPointerEvents.js +99 -0
- package/dist/types/clipboard/copy.d.ts +2 -0
- package/dist/types/clipboard/cut.d.ts +2 -0
- package/dist/types/clipboard/index.d.ts +3 -0
- package/dist/types/clipboard/paste.d.ts +2 -0
- package/dist/types/convenience/click.d.ts +4 -0
- package/dist/types/convenience/hover.d.ts +3 -0
- package/dist/types/convenience/index.d.ts +3 -0
- package/dist/types/convenience/tab.d.ts +4 -0
- package/dist/types/document/UI.d.ts +42 -0
- package/dist/types/document/copySelection.d.ts +1 -0
- package/dist/types/document/getValueOrTextContent.d.ts +1 -0
- package/dist/types/document/index.d.ts +5 -0
- package/dist/types/document/interceptor.d.ts +19 -0
- package/dist/types/document/patchFocus.d.ts +9 -0
- package/dist/types/document/prepareDocument.d.ts +8 -0
- package/dist/types/document/trackValue.d.ts +17 -0
- package/dist/types/event/behavior/click.d.ts +1 -0
- package/dist/types/event/behavior/cut.d.ts +1 -0
- package/dist/types/event/behavior/index.d.ts +8 -0
- package/dist/types/event/behavior/keydown.d.ts +1 -0
- package/dist/types/event/behavior/keypress.d.ts +1 -0
- package/dist/types/event/behavior/keyup.d.ts +1 -0
- package/dist/types/event/behavior/paste.d.ts +1 -0
- package/dist/types/event/behavior/registry.d.ts +8 -0
- package/dist/types/event/createEvent.d.ts +2 -0
- package/dist/types/event/dispatchEvent.d.ts +5 -0
- package/dist/types/event/eventMap.d.ts +265 -0
- package/dist/types/event/focus.d.ts +5 -0
- package/dist/types/event/index.d.ts +7 -0
- package/dist/types/event/input.d.ts +2 -0
- package/dist/types/event/radio.d.ts +4 -0
- package/dist/types/event/selection/getInputRange.d.ts +5 -0
- package/dist/types/event/selection/getTargetTypeAndSelection.d.ts +10 -0
- package/dist/types/event/selection/index.d.ts +15 -0
- package/dist/types/event/selection/modifySelection.d.ts +8 -0
- package/dist/types/event/selection/modifySelectionPerMouse.d.ts +7 -0
- package/dist/types/event/selection/moveSelection.d.ts +4 -0
- package/dist/types/event/selection/resolveCaretPosition.d.ts +8 -0
- package/dist/types/event/selection/selectAll.d.ts +5 -0
- package/dist/types/event/selection/setSelection.d.ts +10 -0
- package/dist/types/event/selection/setSelectionPerMouse.d.ts +8 -0
- package/dist/types/event/selection/setSelectionRange.d.ts +6 -0
- package/dist/types/event/selection/updateSelectionOnFocus.d.ts +5 -0
- package/dist/types/event/types.d.ts +20 -0
- package/dist/types/event/wrapEvent.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/keyboard/index.d.ts +3 -0
- package/dist/types/keyboard/keyMap.d.ts +5 -0
- package/dist/types/keyboard/parseKeyDef.d.ts +17 -0
- package/dist/types/options.d.ts +115 -0
- package/dist/types/pointer/index.d.ts +28 -0
- package/dist/types/pointer/keyMap.d.ts +2 -0
- package/dist/types/pointer/parseKeyDef.d.ts +6 -0
- package/dist/types/setup/api.d.ts +23 -0
- package/dist/types/setup/directApi.d.ts +24 -0
- package/dist/types/setup/index.d.ts +22 -0
- package/dist/types/setup/setup.d.ts +44 -0
- package/dist/types/setup/wrapAsync.d.ts +4 -0
- package/dist/types/system/index.d.ts +10 -0
- package/dist/types/system/keyboard.d.ts +50 -0
- package/dist/types/system/pointer/buttons.d.ts +23 -0
- package/dist/types/system/pointer/device.d.ts +8 -0
- package/dist/types/system/pointer/index.d.ts +21 -0
- package/dist/types/system/pointer/mouse.d.ts +31 -0
- package/dist/types/system/pointer/pointer.d.ts +32 -0
- package/dist/types/system/pointer/shared.d.ts +20 -0
- package/dist/types/utility/clear.d.ts +2 -0
- package/dist/types/utility/index.d.ts +4 -0
- package/dist/types/utility/selectOptions.d.ts +3 -0
- package/dist/types/utility/type.d.ts +9 -0
- package/dist/types/utility/upload.d.ts +5 -0
- package/dist/types/utils/click/isClickableInput.d.ts +15 -0
- package/dist/types/utils/dataTransfer/Blob.d.ts +3 -0
- package/dist/types/utils/dataTransfer/Clipboard.d.ts +11 -0
- package/dist/types/utils/dataTransfer/DataTransfer.d.ts +2 -0
- package/dist/types/utils/dataTransfer/FileList.d.ts +1 -0
- package/dist/types/utils/edit/isContentEditable.d.ts +7 -0
- package/dist/types/utils/edit/isEditable.d.ts +24 -0
- package/dist/types/utils/edit/maxLength.d.ts +14 -0
- package/dist/types/utils/edit/setFiles.d.ts +12 -0
- package/dist/types/utils/edit/timeValue.d.ts +4 -0
- package/dist/types/utils/focus/cursor.d.ts +9 -0
- package/dist/types/utils/focus/getActiveElement.d.ts +2 -0
- package/dist/types/utils/focus/getTabDestination.d.ts +1 -0
- package/dist/types/utils/focus/isFocusable.d.ts +1 -0
- package/dist/types/utils/focus/selection.d.ts +8 -0
- package/dist/types/utils/focus/selector.d.ts +1 -0
- package/dist/types/utils/index.d.ts +29 -0
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +21 -0
- package/dist/types/utils/misc/cloneEvent.d.ts +1 -0
- package/dist/types/utils/misc/findClosest.d.ts +1 -0
- package/dist/types/utils/misc/getDocumentFromNode.d.ts +1 -0
- package/dist/types/utils/misc/getTreeDiff.d.ts +1 -0
- package/dist/types/utils/misc/getWindow.d.ts +1 -0
- package/dist/types/utils/misc/isDescendantOrSelf.d.ts +1 -0
- package/dist/types/utils/misc/isDisabled.d.ts +1 -0
- package/dist/types/utils/misc/isElementType.d.ts +5 -0
- package/dist/types/utils/misc/isVisible.d.ts +1 -0
- package/dist/types/utils/misc/level.d.ts +8 -0
- package/dist/types/utils/misc/wait.d.ts +2 -0
- package/dist/types/utils/pointer/cssPointerEvents.d.ts +19 -0
- package/package.json +131 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const defaultKeyMap = [
|
|
2
|
+
{
|
|
3
|
+
name: 'MouseLeft',
|
|
4
|
+
pointerType: 'mouse',
|
|
5
|
+
button: 'primary'
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: 'MouseRight',
|
|
9
|
+
pointerType: 'mouse',
|
|
10
|
+
button: 'secondary'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'MouseMiddle',
|
|
14
|
+
pointerType: 'mouse',
|
|
15
|
+
button: 'auxiliary'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'TouchA',
|
|
19
|
+
pointerType: 'touch'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'TouchB',
|
|
23
|
+
pointerType: 'touch'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'TouchC',
|
|
27
|
+
pointerType: 'touch'
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export { defaultKeyMap };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
2
|
+
import { readNextDescriptor } from '../utils/keyDef/readNextDescriptor.js';
|
|
3
|
+
|
|
4
|
+
function parseKeyDef(pointerMap, keys) {
|
|
5
|
+
const defs = [];
|
|
6
|
+
do {
|
|
7
|
+
const { descriptor, consumedLength, releasePrevious, releaseSelf = true } = readNextDescriptor(keys, 'pointer');
|
|
8
|
+
const keyDef = pointerMap.find((p)=>p.name === descriptor);
|
|
9
|
+
if (keyDef) {
|
|
10
|
+
defs.push({
|
|
11
|
+
keyDef,
|
|
12
|
+
releasePrevious,
|
|
13
|
+
releaseSelf
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
keys = keys.slice(consumedLength);
|
|
17
|
+
}while (keys)
|
|
18
|
+
return defs;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { parseKeyDef };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { tripleClick, dblClick, click } from '../convenience/click.js';
|
|
2
|
+
import { unhover, hover } from '../convenience/hover.js';
|
|
3
|
+
import { tab } from '../convenience/tab.js';
|
|
4
|
+
import { keyboard } from '../keyboard/index.js';
|
|
5
|
+
import { copy } from '../clipboard/copy.js';
|
|
6
|
+
import { cut } from '../clipboard/cut.js';
|
|
7
|
+
import { paste } from '../clipboard/paste.js';
|
|
8
|
+
import { pointer } from '../pointer/index.js';
|
|
9
|
+
import { clear } from '../utility/clear.js';
|
|
10
|
+
import { selectOptions, deselectOptions } from '../utility/selectOptions.js';
|
|
11
|
+
import { type } from '../utility/type.js';
|
|
12
|
+
import { upload } from '../utility/upload.js';
|
|
13
|
+
|
|
14
|
+
const userEventApi = {
|
|
15
|
+
click,
|
|
16
|
+
dblClick,
|
|
17
|
+
tripleClick,
|
|
18
|
+
hover,
|
|
19
|
+
unhover,
|
|
20
|
+
tab,
|
|
21
|
+
keyboard,
|
|
22
|
+
copy,
|
|
23
|
+
cut,
|
|
24
|
+
paste,
|
|
25
|
+
pointer,
|
|
26
|
+
clear,
|
|
27
|
+
deselectOptions,
|
|
28
|
+
selectOptions,
|
|
29
|
+
type,
|
|
30
|
+
upload
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { userEventApi };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { setupDirect } from './setup.js';
|
|
2
|
+
|
|
3
|
+
function clear(element) {
|
|
4
|
+
return setupDirect().api.clear(element);
|
|
5
|
+
}
|
|
6
|
+
function click(element, options = {}) {
|
|
7
|
+
return setupDirect(options, element).api.click(element);
|
|
8
|
+
}
|
|
9
|
+
function copy(options = {}) {
|
|
10
|
+
return setupDirect(options).api.copy();
|
|
11
|
+
}
|
|
12
|
+
function cut(options = {}) {
|
|
13
|
+
return setupDirect(options).api.cut();
|
|
14
|
+
}
|
|
15
|
+
function dblClick(element, options = {}) {
|
|
16
|
+
return setupDirect(options).api.dblClick(element);
|
|
17
|
+
}
|
|
18
|
+
function deselectOptions(select, values, options = {}) {
|
|
19
|
+
return setupDirect(options).api.deselectOptions(select, values);
|
|
20
|
+
}
|
|
21
|
+
function hover(element, options = {}) {
|
|
22
|
+
return setupDirect(options).api.hover(element);
|
|
23
|
+
}
|
|
24
|
+
async function keyboard(text, options = {}) {
|
|
25
|
+
const { api, system } = setupDirect(options);
|
|
26
|
+
return api.keyboard(text).then(()=>system);
|
|
27
|
+
}
|
|
28
|
+
async function pointer(input, options = {}) {
|
|
29
|
+
const { api, system } = setupDirect(options);
|
|
30
|
+
return api.pointer(input).then(()=>system);
|
|
31
|
+
}
|
|
32
|
+
function paste(clipboardData, options) {
|
|
33
|
+
return setupDirect(options).api.paste(clipboardData);
|
|
34
|
+
}
|
|
35
|
+
function selectOptions(select, values, options = {}) {
|
|
36
|
+
return setupDirect(options).api.selectOptions(select, values);
|
|
37
|
+
}
|
|
38
|
+
function tripleClick(element, options = {}) {
|
|
39
|
+
return setupDirect(options).api.tripleClick(element);
|
|
40
|
+
}
|
|
41
|
+
function type(element, text, options = {}) {
|
|
42
|
+
return setupDirect(options, element).api.type(element, text, options);
|
|
43
|
+
}
|
|
44
|
+
function unhover(element, options = {}) {
|
|
45
|
+
const { api, system } = setupDirect(options);
|
|
46
|
+
system.pointer.setMousePosition({
|
|
47
|
+
target: element
|
|
48
|
+
});
|
|
49
|
+
return api.unhover(element);
|
|
50
|
+
}
|
|
51
|
+
function upload(element, fileOrFiles, options = {}) {
|
|
52
|
+
return setupDirect(options).api.upload(element, fileOrFiles);
|
|
53
|
+
}
|
|
54
|
+
function tab(options = {}) {
|
|
55
|
+
return setupDirect().api.tab(options);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { clear, click, copy, cut, dblClick, deselectOptions, hover, keyboard, paste, pointer, selectOptions, tab, tripleClick, type, unhover, upload };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { patchFocus } from '../document/patchFocus.js';
|
|
2
|
+
import { prepareDocument } from '../document/prepareDocument.js';
|
|
3
|
+
import { dispatchUIEvent, dispatchEvent } from '../event/dispatchEvent.js';
|
|
4
|
+
import { attachClipboardStubToView } from '../utils/dataTransfer/Clipboard.js';
|
|
5
|
+
import { getWindow } from '../utils/misc/getWindow.js';
|
|
6
|
+
import { getDocumentFromNode } from '../utils/misc/getDocumentFromNode.js';
|
|
7
|
+
import { setLevelRef, ApiLevel } from '../utils/misc/level.js';
|
|
8
|
+
import { wait } from '../utils/misc/wait.js';
|
|
9
|
+
import { PointerEventsCheckLevel } from '../options.js';
|
|
10
|
+
import '@testing-library/dom';
|
|
11
|
+
import { defaultKeyMap as defaultKeyMap$1 } from '../keyboard/keyMap.js';
|
|
12
|
+
import { defaultKeyMap } from '../pointer/keyMap.js';
|
|
13
|
+
import { System } from '../system/index.js';
|
|
14
|
+
import { userEventApi } from './api.js';
|
|
15
|
+
import { wrapAsync } from './wrapAsync.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default options applied when API is called per `userEvent.anyApi()`
|
|
19
|
+
*/ const defaultOptionsDirect = {
|
|
20
|
+
applyAccept: true,
|
|
21
|
+
autoModify: true,
|
|
22
|
+
delay: 0,
|
|
23
|
+
document: globalThis.document,
|
|
24
|
+
keyboardMap: defaultKeyMap$1,
|
|
25
|
+
pointerMap: defaultKeyMap,
|
|
26
|
+
pointerEventsCheck: PointerEventsCheckLevel.EachApiCall,
|
|
27
|
+
skipAutoClose: false,
|
|
28
|
+
skipClick: false,
|
|
29
|
+
skipHover: false,
|
|
30
|
+
writeToClipboard: false,
|
|
31
|
+
advanceTimers: ()=>Promise.resolve()
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Default options applied when API is called per `userEvent().anyApi()`
|
|
35
|
+
*/ const defaultOptionsSetup = {
|
|
36
|
+
...defaultOptionsDirect,
|
|
37
|
+
writeToClipboard: true
|
|
38
|
+
};
|
|
39
|
+
function createConfig(options = {}, defaults = defaultOptionsSetup, node) {
|
|
40
|
+
const document = getDocument(options, node, defaults);
|
|
41
|
+
return {
|
|
42
|
+
...defaults,
|
|
43
|
+
...options,
|
|
44
|
+
document
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Start a "session" with userEvent.
|
|
49
|
+
* All APIs returned by this function share an input device state and a default configuration.
|
|
50
|
+
*/ function setupMain(options = {}) {
|
|
51
|
+
var _config_document_defaultView;
|
|
52
|
+
const config = createConfig(options);
|
|
53
|
+
prepareDocument(config.document);
|
|
54
|
+
patchFocus(getWindow(config.document).HTMLElement);
|
|
55
|
+
const view = (_config_document_defaultView = config.document.defaultView) !== null && _config_document_defaultView !== void 0 ? _config_document_defaultView : /* istanbul ignore next */ globalThis.window;
|
|
56
|
+
attachClipboardStubToView(view);
|
|
57
|
+
return createInstance(config).api;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Setup in direct call per `userEvent.anyApi()`
|
|
61
|
+
*/ function setupDirect({ keyboardState, pointerState, ...options } = {}, node) {
|
|
62
|
+
var _ref;
|
|
63
|
+
const config = createConfig(options, defaultOptionsDirect, node);
|
|
64
|
+
prepareDocument(config.document);
|
|
65
|
+
patchFocus(getWindow(config.document).HTMLElement);
|
|
66
|
+
const system = (_ref = pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState) !== null && _ref !== void 0 ? _ref : new System();
|
|
67
|
+
return {
|
|
68
|
+
api: createInstance(config, system).api,
|
|
69
|
+
system
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a set of callbacks with different default settings but the same state.
|
|
74
|
+
*/ function setupSub(options) {
|
|
75
|
+
return createInstance({
|
|
76
|
+
...this.config,
|
|
77
|
+
...options
|
|
78
|
+
}, this.system).api;
|
|
79
|
+
}
|
|
80
|
+
function wrapAndBindImpl(instance, impl) {
|
|
81
|
+
function method(...args) {
|
|
82
|
+
setLevelRef(instance, ApiLevel.Call);
|
|
83
|
+
return wrapAsync(()=>impl.apply(instance, args).then(async (ret)=>{
|
|
84
|
+
await wait(instance.config);
|
|
85
|
+
return ret;
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
Object.defineProperty(method, 'name', {
|
|
89
|
+
get: ()=>impl.name
|
|
90
|
+
});
|
|
91
|
+
return method;
|
|
92
|
+
}
|
|
93
|
+
function createInstance(config, system = new System()) {
|
|
94
|
+
const instance = {};
|
|
95
|
+
Object.assign(instance, {
|
|
96
|
+
config,
|
|
97
|
+
dispatchEvent: dispatchEvent.bind(instance),
|
|
98
|
+
dispatchUIEvent: dispatchUIEvent.bind(instance),
|
|
99
|
+
system,
|
|
100
|
+
levelRefs: {},
|
|
101
|
+
...userEventApi
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
instance,
|
|
105
|
+
api: {
|
|
106
|
+
...Object.fromEntries(Object.entries(userEventApi).map(([name, api])=>[
|
|
107
|
+
name,
|
|
108
|
+
wrapAndBindImpl(instance, api)
|
|
109
|
+
])),
|
|
110
|
+
setup: setupSub.bind(instance)
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function getDocument(options, node, defaults) {
|
|
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
|
+
}
|
|
118
|
+
|
|
119
|
+
export { createConfig, createInstance, setupDirect, setupMain, setupSub };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { KeyboardHost } from './keyboard.js';
|
|
2
|
+
import { PointerHost } from './pointer/index.js';
|
|
3
|
+
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
if (key in obj) {
|
|
6
|
+
Object.defineProperty(obj, key, {
|
|
7
|
+
value: value,
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true
|
|
11
|
+
});
|
|
12
|
+
} else obj[key] = value;
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal Do not create/alter this by yourself as this type might be subject to changes.
|
|
17
|
+
*/ class System {
|
|
18
|
+
getUIEventModifiers() {
|
|
19
|
+
return {
|
|
20
|
+
altKey: this.keyboard.modifiers.Alt,
|
|
21
|
+
ctrlKey: this.keyboard.modifiers.Control,
|
|
22
|
+
metaKey: this.keyboard.modifiers.Meta,
|
|
23
|
+
shiftKey: this.keyboard.modifiers.Shift,
|
|
24
|
+
modifierAltGraph: this.keyboard.modifiers.AltGraph,
|
|
25
|
+
modifierCapsLock: this.keyboard.modifiers.CapsLock,
|
|
26
|
+
modifierFn: this.keyboard.modifiers.Fn,
|
|
27
|
+
modifierFnLock: this.keyboard.modifiers.FnLock,
|
|
28
|
+
modifierNumLock: this.keyboard.modifiers.NumLock,
|
|
29
|
+
modifierScrollLock: this.keyboard.modifiers.ScrollLock,
|
|
30
|
+
modifierSymbol: this.keyboard.modifiers.Symbol,
|
|
31
|
+
modifierSymbolLock: this.keyboard.modifiers.SymbolLock
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
constructor(){
|
|
35
|
+
_define_property(this, "keyboard", new KeyboardHost(this));
|
|
36
|
+
_define_property(this, "pointer", new PointerHost(this));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { System };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import '../utils/dataTransfer/Clipboard.js';
|
|
2
|
+
import { getActiveElementOrBody } from '../utils/focus/getActiveElement.js';
|
|
3
|
+
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
if (key in obj) {
|
|
6
|
+
Object.defineProperty(obj, key, {
|
|
7
|
+
value: value,
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true
|
|
11
|
+
});
|
|
12
|
+
} else obj[key] = value;
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
|
|
16
|
+
DOM_KEY_LOCATION[DOM_KEY_LOCATION["STANDARD"] = 0] = "STANDARD";
|
|
17
|
+
DOM_KEY_LOCATION[DOM_KEY_LOCATION["LEFT"] = 1] = "LEFT";
|
|
18
|
+
DOM_KEY_LOCATION[DOM_KEY_LOCATION["RIGHT"] = 2] = "RIGHT";
|
|
19
|
+
DOM_KEY_LOCATION[DOM_KEY_LOCATION["NUMPAD"] = 3] = "NUMPAD";
|
|
20
|
+
return DOM_KEY_LOCATION;
|
|
21
|
+
}({});
|
|
22
|
+
const modifierKeys = [
|
|
23
|
+
'Alt',
|
|
24
|
+
'AltGraph',
|
|
25
|
+
'Control',
|
|
26
|
+
'Fn',
|
|
27
|
+
'Meta',
|
|
28
|
+
'Shift',
|
|
29
|
+
'Symbol'
|
|
30
|
+
];
|
|
31
|
+
function isModifierKey(key) {
|
|
32
|
+
return modifierKeys.includes(key);
|
|
33
|
+
}
|
|
34
|
+
const modifierLocks = [
|
|
35
|
+
'CapsLock',
|
|
36
|
+
'FnLock',
|
|
37
|
+
'NumLock',
|
|
38
|
+
'ScrollLock',
|
|
39
|
+
'SymbolLock'
|
|
40
|
+
];
|
|
41
|
+
function isModifierLock(key) {
|
|
42
|
+
return modifierLocks.includes(key);
|
|
43
|
+
}
|
|
44
|
+
class KeyboardHost {
|
|
45
|
+
isKeyPressed(keyDef) {
|
|
46
|
+
return this.pressed.has(String(keyDef.code));
|
|
47
|
+
}
|
|
48
|
+
getPressedKeys() {
|
|
49
|
+
return this.pressed.values().map((p)=>p.keyDef);
|
|
50
|
+
}
|
|
51
|
+
/** Press a key */ async keydown(instance, keyDef) {
|
|
52
|
+
const key = String(keyDef.key);
|
|
53
|
+
const code = String(keyDef.code);
|
|
54
|
+
const target = getActiveElementOrBody(instance.config.document);
|
|
55
|
+
this.setKeydownTarget(target);
|
|
56
|
+
this.pressed.add(code, keyDef);
|
|
57
|
+
if (isModifierKey(key)) {
|
|
58
|
+
this.modifiers[key] = true;
|
|
59
|
+
}
|
|
60
|
+
const unprevented = instance.dispatchUIEvent(target, 'keydown', {
|
|
61
|
+
key,
|
|
62
|
+
code
|
|
63
|
+
});
|
|
64
|
+
if (isModifierLock(key) && !this.modifiers[key]) {
|
|
65
|
+
this.modifiers[key] = true;
|
|
66
|
+
this.modifierLockStart[key] = true;
|
|
67
|
+
}
|
|
68
|
+
if (unprevented) {
|
|
69
|
+
this.pressed.setUnprevented(code);
|
|
70
|
+
}
|
|
71
|
+
if (unprevented && this.hasKeyPress(key)) {
|
|
72
|
+
instance.dispatchUIEvent(getActiveElementOrBody(instance.config.document), 'keypress', {
|
|
73
|
+
key,
|
|
74
|
+
code,
|
|
75
|
+
charCode: keyDef.key === 'Enter' ? 13 : String(keyDef.key).charCodeAt(0)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Release a key */ async keyup(instance, keyDef) {
|
|
80
|
+
const key = String(keyDef.key);
|
|
81
|
+
const code = String(keyDef.code);
|
|
82
|
+
const unprevented = this.pressed.isUnprevented(code);
|
|
83
|
+
this.pressed.delete(code);
|
|
84
|
+
if (isModifierKey(key) && !this.pressed.values().find((p)=>p.keyDef.key === key)) {
|
|
85
|
+
this.modifiers[key] = false;
|
|
86
|
+
}
|
|
87
|
+
instance.dispatchUIEvent(getActiveElementOrBody(instance.config.document), 'keyup', {
|
|
88
|
+
key,
|
|
89
|
+
code
|
|
90
|
+
}, !unprevented);
|
|
91
|
+
if (isModifierLock(key) && this.modifiers[key]) {
|
|
92
|
+
if (this.modifierLockStart[key]) {
|
|
93
|
+
this.modifierLockStart[key] = false;
|
|
94
|
+
} else {
|
|
95
|
+
this.modifiers[key] = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
setKeydownTarget(target) {
|
|
100
|
+
if (target !== this.lastKeydownTarget) {
|
|
101
|
+
this.carryChar = '';
|
|
102
|
+
}
|
|
103
|
+
this.lastKeydownTarget = target;
|
|
104
|
+
}
|
|
105
|
+
hasKeyPress(key) {
|
|
106
|
+
return (key.length === 1 || key === 'Enter') && !this.modifiers.Control && !this.modifiers.Alt;
|
|
107
|
+
}
|
|
108
|
+
constructor(system){
|
|
109
|
+
_define_property(this, "system", void 0);
|
|
110
|
+
_define_property(this, "modifiers", {
|
|
111
|
+
Alt: false,
|
|
112
|
+
AltGraph: false,
|
|
113
|
+
CapsLock: false,
|
|
114
|
+
Control: false,
|
|
115
|
+
Fn: false,
|
|
116
|
+
FnLock: false,
|
|
117
|
+
Meta: false,
|
|
118
|
+
NumLock: false,
|
|
119
|
+
ScrollLock: false,
|
|
120
|
+
Shift: false,
|
|
121
|
+
Symbol: false,
|
|
122
|
+
SymbolLock: false
|
|
123
|
+
});
|
|
124
|
+
_define_property(this, "pressed", new class {
|
|
125
|
+
add(code, keyDef) {
|
|
126
|
+
var _this_registry, _code, _;
|
|
127
|
+
(_ = (_this_registry = this.registry)[_code = code]) !== null && _ !== void 0 ? _ : _this_registry[_code] = {
|
|
128
|
+
keyDef,
|
|
129
|
+
unpreventedDefault: false
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
has(code) {
|
|
133
|
+
return !!this.registry[code];
|
|
134
|
+
}
|
|
135
|
+
setUnprevented(code) {
|
|
136
|
+
const o = this.registry[code];
|
|
137
|
+
if (o) {
|
|
138
|
+
o.unpreventedDefault = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
isUnprevented(code) {
|
|
142
|
+
var _this_registry_code;
|
|
143
|
+
return !!((_this_registry_code = this.registry[code]) === null || _this_registry_code === void 0 ? void 0 : _this_registry_code.unpreventedDefault);
|
|
144
|
+
}
|
|
145
|
+
delete(code) {
|
|
146
|
+
delete this.registry[code];
|
|
147
|
+
}
|
|
148
|
+
values() {
|
|
149
|
+
return Object.values(this.registry);
|
|
150
|
+
}
|
|
151
|
+
constructor(){
|
|
152
|
+
_define_property(this, "registry", {});
|
|
153
|
+
}
|
|
154
|
+
}());
|
|
155
|
+
_define_property(this, "carryChar", '');
|
|
156
|
+
_define_property(this, "lastKeydownTarget", undefined);
|
|
157
|
+
_define_property(this, "modifierLockStart", {});
|
|
158
|
+
this.system = system;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { DOM_KEY_LOCATION, KeyboardHost };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else obj[key] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
class Buttons {
|
|
13
|
+
getButtons() {
|
|
14
|
+
let v = 0;
|
|
15
|
+
for (const button of Object.keys(this.pressed)){
|
|
16
|
+
v |= 2 ** Number(button);
|
|
17
|
+
}
|
|
18
|
+
return v;
|
|
19
|
+
}
|
|
20
|
+
down(keyDef) {
|
|
21
|
+
const button = getMouseButtonId(keyDef.button);
|
|
22
|
+
if (button in this.pressed) {
|
|
23
|
+
this.pressed[button].push(keyDef);
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
this.pressed[button] = [
|
|
27
|
+
keyDef
|
|
28
|
+
];
|
|
29
|
+
return button;
|
|
30
|
+
}
|
|
31
|
+
up(keyDef) {
|
|
32
|
+
const button = getMouseButtonId(keyDef.button);
|
|
33
|
+
if (button in this.pressed) {
|
|
34
|
+
this.pressed[button] = this.pressed[button].filter((k)=>k.name !== keyDef.name);
|
|
35
|
+
if (this.pressed[button].length === 0) {
|
|
36
|
+
delete this.pressed[button];
|
|
37
|
+
return button;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
constructor(){
|
|
43
|
+
_define_property(this, "pressed", {});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const MouseButton = {
|
|
47
|
+
primary: 0,
|
|
48
|
+
secondary: 1,
|
|
49
|
+
auxiliary: 2,
|
|
50
|
+
back: 3,
|
|
51
|
+
X1: 3,
|
|
52
|
+
forward: 4,
|
|
53
|
+
X2: 4
|
|
54
|
+
};
|
|
55
|
+
function getMouseButtonId(button = 0) {
|
|
56
|
+
if (button in MouseButton) {
|
|
57
|
+
return MouseButton[button];
|
|
58
|
+
}
|
|
59
|
+
return Number(button);
|
|
60
|
+
}
|
|
61
|
+
// On the `MouseEvent.button` property auxiliary and secondary button are flipped compared to `MouseEvent.buttons`.
|
|
62
|
+
const MouseButtonFlip = {
|
|
63
|
+
1: 2,
|
|
64
|
+
2: 1
|
|
65
|
+
};
|
|
66
|
+
function getMouseEventButton(button) {
|
|
67
|
+
button = getMouseButtonId(button);
|
|
68
|
+
if (button in MouseButtonFlip) {
|
|
69
|
+
return MouseButtonFlip[button];
|
|
70
|
+
}
|
|
71
|
+
return button;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Buttons, MouseButton, MouseButtonFlip, getMouseButtonId, getMouseEventButton };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else obj[key] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
class Device {
|
|
13
|
+
get countPressed() {
|
|
14
|
+
return this.pressedKeys.size;
|
|
15
|
+
}
|
|
16
|
+
isPressed(keyDef) {
|
|
17
|
+
return this.pressedKeys.has(keyDef.name);
|
|
18
|
+
}
|
|
19
|
+
addPressed(keyDef) {
|
|
20
|
+
return this.pressedKeys.add(keyDef.name);
|
|
21
|
+
}
|
|
22
|
+
removePressed(keyDef) {
|
|
23
|
+
return this.pressedKeys.delete(keyDef.name);
|
|
24
|
+
}
|
|
25
|
+
constructor(){
|
|
26
|
+
_define_property(this, "pressedKeys", new Set());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Device };
|