@testing-library/user-event 14.0.0-alpha.9 → 14.0.0-beta.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/clipboard/copy.d.ts +2 -0
- package/dist/clipboard/copy.js +36 -0
- package/dist/clipboard/cut.d.ts +2 -0
- package/dist/clipboard/cut.js +42 -0
- package/dist/clipboard/index.d.ts +3 -0
- package/dist/clipboard/index.js +44 -0
- package/dist/clipboard/paste.d.ts +2 -0
- package/dist/clipboard/paste.js +47 -0
- package/dist/convenience/click.d.ts +4 -0
- package/dist/convenience/click.js +52 -0
- package/dist/convenience/hover.d.ts +3 -0
- package/dist/convenience/hover.js +31 -0
- package/dist/convenience/index.d.ts +3 -0
- package/dist/convenience/index.js +44 -0
- package/dist/convenience/tab.d.ts +4 -0
- package/dist/convenience/tab.js +12 -0
- package/dist/index.d.ts +2 -7
- package/dist/index.js +3 -12
- package/dist/keyboard/getEventProps.d.ts +0 -2
- package/dist/keyboard/getEventProps.js +1 -7
- package/dist/keyboard/index.d.ts +6 -18
- package/dist/keyboard/index.js +9 -45
- package/dist/keyboard/keyMap.js +24 -48
- package/dist/keyboard/keyboardAction.d.ts +10 -0
- package/dist/keyboard/keyboardAction.js +156 -0
- package/dist/keyboard/{getNextKeyDef.d.ts → parseKeyDef.d.ts} +4 -6
- package/dist/keyboard/parseKeyDef.js +61 -0
- package/dist/keyboard/plugins/character.js +21 -14
- package/dist/keyboard/plugins/combination.js +3 -1
- package/dist/keyboard/plugins/functional.js +38 -20
- package/dist/keyboard/plugins/index.d.ts +0 -1
- package/dist/keyboard/plugins/index.js +1 -10
- package/dist/keyboard/types.d.ts +3 -19
- package/dist/options.d.ts +102 -0
- package/dist/options.js +36 -0
- package/dist/pointer/index.d.ts +6 -14
- package/dist/pointer/index.js +8 -42
- package/dist/pointer/parseKeyDef.d.ts +2 -2
- package/dist/pointer/parseKeyDef.js +1 -3
- package/dist/pointer/pointerAction.d.ts +3 -2
- package/dist/pointer/pointerAction.js +9 -15
- package/dist/pointer/pointerMove.d.ts +2 -1
- package/dist/pointer/pointerPress.d.ts +2 -1
- package/dist/pointer/types.d.ts +0 -11
- package/dist/setup/api.d.ts +5 -0
- package/dist/setup/api.js +111 -0
- package/dist/setup/config.d.ts +10 -0
- package/dist/setup/config.js +8 -0
- package/dist/setup/directApi.d.ts +20 -0
- package/dist/setup/directApi.js +95 -0
- package/dist/setup/index.d.ts +30 -0
- package/dist/setup/index.js +27 -0
- package/dist/setup/setup.d.ts +74 -0
- package/dist/setup/setup.js +98 -0
- package/dist/setup/wrapAsync.d.ts +4 -0
- package/dist/setup/wrapAsync.js +15 -0
- package/dist/{clear.d.ts → utility/clear.d.ts} +2 -2
- package/dist/utility/clear.js +30 -0
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.js +57 -0
- package/dist/utility/selectOptions.d.ts +3 -0
- package/dist/{selectOptions.js → utility/selectOptions.js} +31 -41
- package/dist/utility/type.d.ts +9 -0
- package/dist/utility/type.js +37 -0
- package/dist/utility/upload.d.ts +5 -0
- package/dist/{upload.js → utility/upload.js} +12 -40
- package/dist/utils/dataTransfer/Blob.d.ts +1 -0
- package/dist/utils/dataTransfer/Blob.js +21 -0
- package/dist/utils/dataTransfer/Clipboard.d.ts +9 -0
- package/dist/utils/dataTransfer/Clipboard.js +188 -0
- package/dist/utils/dataTransfer/DataTransfer.d.ts +2 -0
- package/dist/utils/dataTransfer/DataTransfer.js +158 -0
- package/dist/utils/dataTransfer/FileList.d.ts +1 -0
- package/dist/utils/dataTransfer/FileList.js +23 -0
- package/dist/utils/edit/calculateNewValue.d.ts +1 -3
- package/dist/utils/edit/calculateNewValue.js +1 -5
- package/dist/utils/edit/editInputElement.d.ts +16 -0
- package/dist/utils/edit/{fireInputEvent.js → editInputElement.js} +8 -20
- package/dist/utils/edit/prepareInput.d.ts +4 -1
- package/dist/utils/edit/prepareInput.js +56 -39
- package/dist/utils/edit/setFiles.d.ts +12 -0
- package/dist/utils/edit/setFiles.js +72 -0
- package/dist/utils/focus/copySelection.d.ts +1 -0
- package/dist/utils/focus/copySelection.js +36 -0
- package/dist/utils/focus/selectAll.d.ts +1 -0
- package/dist/utils/focus/selectAll.js +13 -0
- package/dist/utils/index.d.ts +8 -1
- package/dist/utils/index.js +95 -4
- package/dist/utils/misc/getDocumentFromNode.d.ts +1 -0
- package/dist/utils/misc/getDocumentFromNode.js +14 -0
- package/package.json +1 -1
- package/dist/clear.js +0 -46
- package/dist/click.d.ts +0 -9
- package/dist/click.js +0 -62
- package/dist/hover.d.ts +0 -4
- package/dist/hover.js +0 -43
- package/dist/keyboard/getNextKeyDef.js +0 -85
- package/dist/keyboard/keyboardImplementation.d.ts +0 -3
- package/dist/keyboard/keyboardImplementation.js +0 -169
- package/dist/keyboard/specialCharMap.d.ts +0 -22
- package/dist/keyboard/specialCharMap.js +0 -30
- package/dist/paste.d.ts +0 -7
- package/dist/paste.js +0 -60
- package/dist/selectOptions.d.ts +0 -4
- package/dist/setup.d.ts +0 -92
- package/dist/setup.js +0 -203
- package/dist/tab.d.ts +0 -5
- package/dist/tab.js +0 -12
- package/dist/type.d.ts +0 -14
- package/dist/type.js +0 -74
- package/dist/upload.d.ts +0 -10
- package/dist/utils/edit/fireInputEvent.d.ts +0 -11
package/dist/type.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.type = type;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _document = require("./document");
|
|
11
|
-
|
|
12
|
-
var _utils = require("./utils");
|
|
13
|
-
|
|
14
|
-
var _keyboard = require("./keyboard");
|
|
15
|
-
|
|
16
|
-
// this needs to be wrapped in the event/asyncWrapper for React's act and angular's change detection
|
|
17
|
-
// depending on whether it will be async.
|
|
18
|
-
function type(element, text, {
|
|
19
|
-
delay = 0,
|
|
20
|
-
...options
|
|
21
|
-
} = {}) {
|
|
22
|
-
(0, _document.prepareDocument)(element.ownerDocument); // we do not want to wrap in the asyncWrapper if we're not
|
|
23
|
-
// going to actually be doing anything async, so we only wrap
|
|
24
|
-
// if the delay is greater than 0
|
|
25
|
-
|
|
26
|
-
if (delay > 0) {
|
|
27
|
-
return (0, _dom.getConfig)().asyncWrapper(() => typeImplementation(this, element, text, {
|
|
28
|
-
delay,
|
|
29
|
-
...options
|
|
30
|
-
}));
|
|
31
|
-
} else {
|
|
32
|
-
return void typeImplementation(this, element, text, {
|
|
33
|
-
delay,
|
|
34
|
-
...options
|
|
35
|
-
}) // prevents users from dealing with UnhandledPromiseRejectionWarning
|
|
36
|
-
.catch(console.error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function typeImplementation(userEvent, element, text, {
|
|
41
|
-
delay,
|
|
42
|
-
skipClick = false,
|
|
43
|
-
skipAutoClose = false,
|
|
44
|
-
initialSelectionStart = undefined,
|
|
45
|
-
initialSelectionEnd = undefined
|
|
46
|
-
}) {
|
|
47
|
-
// TODO: properly type guard
|
|
48
|
-
// we use this workaround for now to prevent changing behavior
|
|
49
|
-
if (element.disabled) return;
|
|
50
|
-
if (!skipClick) userEvent.click(element);
|
|
51
|
-
|
|
52
|
-
if (initialSelectionStart !== undefined) {
|
|
53
|
-
(0, _utils.setSelectionRange)(element, initialSelectionStart, initialSelectionEnd != null ? initialSelectionEnd : initialSelectionStart);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const {
|
|
57
|
-
promise,
|
|
58
|
-
releaseAllKeys
|
|
59
|
-
} = (0, _keyboard.keyboardImplementationWrapper)(text, {
|
|
60
|
-
delay,
|
|
61
|
-
document: element.ownerDocument
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (delay > 0) {
|
|
65
|
-
await promise;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!skipAutoClose) {
|
|
69
|
-
releaseAllKeys();
|
|
70
|
-
} // eslint-disable-next-line consistent-return -- we need to return the internal Promise so that it is catchable if we don't await
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return promise;
|
|
74
|
-
}
|
package/dist/upload.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { UserEvent } from './setup';
|
|
2
|
-
interface uploadInit {
|
|
3
|
-
clickInit?: MouseEventInit;
|
|
4
|
-
changeInit?: EventInit;
|
|
5
|
-
}
|
|
6
|
-
export interface uploadOptions {
|
|
7
|
-
applyAccept?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function upload(this: UserEvent, element: HTMLElement, fileOrFiles: File | File[], init?: uploadInit, { applyAccept }?: uploadOptions): void;
|
|
10
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { fireEvent } from '@testing-library/dom';
|
|
2
|
-
export declare function fireInputEvent(element: HTMLElement, { newValue, newSelection, eventOverrides, }: {
|
|
3
|
-
newValue: string;
|
|
4
|
-
newSelection: {
|
|
5
|
-
node: Node;
|
|
6
|
-
offset: number;
|
|
7
|
-
};
|
|
8
|
-
eventOverrides: Partial<Parameters<typeof fireEvent>[1]> & {
|
|
9
|
-
[k: string]: unknown;
|
|
10
|
-
};
|
|
11
|
-
}): void;
|