@testing-library/user-event 14.0.0-beta.3 → 14.0.0-beta.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/dist/index.d.ts +1110 -3
- package/dist/index.js +2826 -8
- package/dist/package.json +1 -0
- package/package.json +6 -30
- package/dist/clipboard/copy.d.ts +0 -2
- package/dist/clipboard/copy.js +0 -36
- package/dist/clipboard/cut.d.ts +0 -2
- package/dist/clipboard/cut.js +0 -42
- package/dist/clipboard/index.d.ts +0 -3
- package/dist/clipboard/index.js +0 -44
- package/dist/clipboard/paste.d.ts +0 -2
- package/dist/clipboard/paste.js +0 -47
- package/dist/convenience/click.d.ts +0 -4
- package/dist/convenience/click.js +0 -52
- package/dist/convenience/hover.d.ts +0 -3
- package/dist/convenience/hover.js +0 -31
- package/dist/convenience/index.d.ts +0 -3
- package/dist/convenience/index.js +0 -44
- package/dist/convenience/tab.d.ts +0 -4
- package/dist/convenience/tab.js +0 -12
- package/dist/document/index.d.ts +0 -10
- package/dist/document/index.js +0 -100
- package/dist/document/interceptor.d.ts +0 -15
- package/dist/document/interceptor.js +0 -37
- package/dist/document/selection.d.ts +0 -27
- package/dist/document/selection.js +0 -90
- package/dist/document/value.d.ts +0 -18
- package/dist/document/value.js +0 -77
- package/dist/keyboard/getEventProps.d.ts +0 -15
- package/dist/keyboard/getEventProps.js +0 -27
- package/dist/keyboard/index.d.ts +0 -7
- package/dist/keyboard/index.js +0 -42
- package/dist/keyboard/keyMap.d.ts +0 -5
- package/dist/keyboard/keyMap.js +0 -119
- package/dist/keyboard/keyboardAction.d.ts +0 -10
- package/dist/keyboard/keyboardAction.js +0 -156
- package/dist/keyboard/parseKeyDef.d.ts +0 -17
- package/dist/keyboard/parseKeyDef.js +0 -61
- package/dist/keyboard/plugins/arrow.d.ts +0 -6
- package/dist/keyboard/plugins/arrow.js +0 -28
- package/dist/keyboard/plugins/character.d.ts +0 -5
- package/dist/keyboard/plugins/character.js +0 -173
- package/dist/keyboard/plugins/combination.d.ts +0 -5
- package/dist/keyboard/plugins/combination.js +0 -19
- package/dist/keyboard/plugins/control.d.ts +0 -6
- package/dist/keyboard/plugins/control.js +0 -52
- package/dist/keyboard/plugins/functional.d.ts +0 -11
- package/dist/keyboard/plugins/functional.js +0 -158
- package/dist/keyboard/plugins/index.d.ts +0 -7
- package/dist/keyboard/plugins/index.js +0 -33
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.d.ts +0 -3
- package/dist/keyboard/shared/fireChangeForInputTimeIfValid.js +0 -20
- package/dist/keyboard/shared/index.d.ts +0 -1
- package/dist/keyboard/shared/index.js +0 -18
- package/dist/keyboard/types.d.ts +0 -64
- package/dist/keyboard/types.js +0 -19
- package/dist/options.d.ts +0 -102
- package/dist/options.js +0 -36
- package/dist/pointer/index.d.ts +0 -10
- package/dist/pointer/index.js +0 -56
- package/dist/pointer/keyMap.d.ts +0 -2
- package/dist/pointer/keyMap.js +0 -29
- package/dist/pointer/parseKeyDef.d.ts +0 -6
- package/dist/pointer/parseKeyDef.js +0 -34
- package/dist/pointer/pointerAction.d.ts +0 -7
- package/dist/pointer/pointerAction.js +0 -46
- package/dist/pointer/pointerMove.d.ts +0 -6
- package/dist/pointer/pointerMove.js +0 -136
- package/dist/pointer/pointerPress.d.ts +0 -8
- package/dist/pointer/pointerPress.js +0 -327
- package/dist/pointer/resolveSelectionTarget.d.ts +0 -5
- package/dist/pointer/resolveSelectionTarget.js +0 -75
- package/dist/pointer/types.d.ts +0 -61
- package/dist/pointer/types.js +0 -1
- package/dist/setup/api.d.ts +0 -5
- package/dist/setup/api.js +0 -111
- package/dist/setup/config.d.ts +0 -10
- package/dist/setup/config.js +0 -8
- package/dist/setup/directApi.d.ts +0 -20
- package/dist/setup/directApi.js +0 -95
- package/dist/setup/index.d.ts +0 -30
- package/dist/setup/index.js +0 -27
- package/dist/setup/setup.d.ts +0 -74
- package/dist/setup/setup.js +0 -98
- package/dist/setup/wrapAsync.d.ts +0 -4
- package/dist/setup/wrapAsync.js +0 -15
- package/dist/utility/clear.d.ts +0 -2
- package/dist/utility/clear.js +0 -30
- package/dist/utility/index.d.ts +0 -4
- package/dist/utility/index.js +0 -57
- package/dist/utility/selectOptions.d.ts +0 -3
- package/dist/utility/selectOptions.js +0 -132
- package/dist/utility/type.d.ts +0 -9
- package/dist/utility/type.js +0 -37
- package/dist/utility/upload.d.ts +0 -5
- package/dist/utility/upload.js +0 -64
- package/dist/utils/click/isClickableInput.d.ts +0 -1
- package/dist/utils/click/isClickableInput.js +0 -14
- package/dist/utils/dataTransfer/Blob.d.ts +0 -1
- package/dist/utils/dataTransfer/Blob.js +0 -21
- package/dist/utils/dataTransfer/Clipboard.d.ts +0 -9
- package/dist/utils/dataTransfer/Clipboard.js +0 -188
- package/dist/utils/dataTransfer/DataTransfer.d.ts +0 -2
- package/dist/utils/dataTransfer/DataTransfer.js +0 -158
- package/dist/utils/dataTransfer/FileList.d.ts +0 -1
- package/dist/utils/dataTransfer/FileList.js +0 -23
- package/dist/utils/edit/buildTimeValue.d.ts +0 -1
- package/dist/utils/edit/buildTimeValue.js +0 -44
- package/dist/utils/edit/calculateNewValue.d.ts +0 -14
- package/dist/utils/edit/calculateNewValue.js +0 -46
- package/dist/utils/edit/editInputElement.d.ts +0 -16
- package/dist/utils/edit/editInputElement.js +0 -53
- package/dist/utils/edit/getValue.d.ts +0 -1
- package/dist/utils/edit/getValue.js +0 -23
- package/dist/utils/edit/isContentEditable.d.ts +0 -7
- package/dist/utils/edit/isContentEditable.js +0 -25
- package/dist/utils/edit/isEditable.d.ts +0 -25
- package/dist/utils/edit/isEditable.js +0 -42
- package/dist/utils/edit/isValidDateValue.d.ts +0 -3
- package/dist/utils/edit/isValidDateValue.js +0 -12
- package/dist/utils/edit/isValidInputTimeValue.d.ts +0 -3
- package/dist/utils/edit/isValidInputTimeValue.js +0 -12
- package/dist/utils/edit/maxLength.d.ts +0 -1
- package/dist/utils/edit/maxLength.js +0 -50
- package/dist/utils/edit/prepareInput.d.ts +0 -7
- package/dist/utils/edit/prepareInput.js +0 -77
- package/dist/utils/edit/setFiles.d.ts +0 -12
- package/dist/utils/edit/setFiles.js +0 -72
- package/dist/utils/focus/blur.d.ts +0 -2
- package/dist/utils/focus/blur.js +0 -19
- package/dist/utils/focus/copySelection.d.ts +0 -1
- package/dist/utils/focus/copySelection.js +0 -36
- package/dist/utils/focus/focus.d.ts +0 -2
- package/dist/utils/focus/focus.js +0 -22
- package/dist/utils/focus/getActiveElement.d.ts +0 -1
- package/dist/utils/focus/getActiveElement.js +0 -26
- package/dist/utils/focus/getTabDestination.d.ts +0 -1
- package/dist/utils/focus/getTabDestination.js +0 -84
- package/dist/utils/focus/isFocusable.d.ts +0 -1
- package/dist/utils/focus/isFocusable.js +0 -12
- package/dist/utils/focus/selectAll.d.ts +0 -5
- package/dist/utils/focus/selectAll.js +0 -51
- package/dist/utils/focus/selection.d.ts +0 -42
- package/dist/utils/focus/selection.js +0 -190
- package/dist/utils/focus/selector.d.ts +0 -1
- package/dist/utils/focus/selector.js +0 -8
- package/dist/utils/index.d.ts +0 -38
- package/dist/utils/index.js +0 -499
- package/dist/utils/keyDef/readNextDescriptor.d.ts +0 -19
- package/dist/utils/keyDef/readNextDescriptor.js +0 -102
- package/dist/utils/misc/eventWrapper.d.ts +0 -1
- package/dist/utils/misc/eventWrapper.js +0 -16
- package/dist/utils/misc/findClosest.d.ts +0 -1
- package/dist/utils/misc/findClosest.js +0 -20
- package/dist/utils/misc/getDocumentFromNode.d.ts +0 -1
- package/dist/utils/misc/getDocumentFromNode.js +0 -14
- package/dist/utils/misc/hasFormSubmit.d.ts +0 -1
- package/dist/utils/misc/hasFormSubmit.js +0 -10
- package/dist/utils/misc/hasPointerEvents.d.ts +0 -15
- package/dist/utils/misc/hasPointerEvents.js +0 -24
- package/dist/utils/misc/isDescendantOrSelf.d.ts +0 -1
- package/dist/utils/misc/isDescendantOrSelf.js +0 -20
- package/dist/utils/misc/isDisabled.d.ts +0 -1
- package/dist/utils/misc/isDisabled.js +0 -12
- package/dist/utils/misc/isElementType.d.ts +0 -5
- package/dist/utils/misc/isElementType.js +0 -24
- package/dist/utils/misc/isVisible.d.ts +0 -1
- package/dist/utils/misc/isVisible.js +0 -31
- package/dist/utils/misc/wait.d.ts +0 -1
- package/dist/utils/misc/wait.js +0 -10
- package/dist/utils/pointer/firePointerEvents.d.ts +0 -25
- package/dist/utils/pointer/firePointerEvents.js +0 -110
- package/dist/utils/pointer/mouseButtons.d.ts +0 -12
- package/dist/utils/pointer/mouseButtons.js +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/user-event",
|
|
3
|
-
"version": "14.0.0-beta.
|
|
3
|
+
"version": "14.0.0-beta.4",
|
|
4
4
|
"description": "Fire events the same way the user does",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"react-testing-library",
|
|
8
7
|
"dom-testing-library",
|
|
@@ -26,8 +25,10 @@
|
|
|
26
25
|
"files": [
|
|
27
26
|
"dist"
|
|
28
27
|
],
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"exports": "./dist/index.js",
|
|
29
30
|
"scripts": {
|
|
30
|
-
"build": "
|
|
31
|
+
"build": "node build.js",
|
|
31
32
|
"lint": "kcd-scripts lint",
|
|
32
33
|
"setup": "npm install && npm run validate -s",
|
|
33
34
|
"test": "kcd-scripts test",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"@types/estree": "0.0.45",
|
|
47
48
|
"@types/jest-in-case": "^1.0.3",
|
|
48
49
|
"@types/react": "^17.0.3",
|
|
50
|
+
"esbuild": "^0.14.9",
|
|
49
51
|
"eslint-import-resolver-typescript": "^2.5.0",
|
|
50
52
|
"is-ci": "^2.0.0",
|
|
51
53
|
"jest-in-case": "^1.0.2",
|
|
@@ -57,31 +59,5 @@
|
|
|
57
59
|
},
|
|
58
60
|
"peerDependencies": {
|
|
59
61
|
"@testing-library/dom": ">=7.21.4"
|
|
60
|
-
}
|
|
61
|
-
"eslintConfig": {
|
|
62
|
-
"extends": "./node_modules/kcd-scripts/eslint.js",
|
|
63
|
-
"rules": {
|
|
64
|
-
"jsx-a11y/click-events-have-key-events": "off",
|
|
65
|
-
"jsx-a11y/tabindex-no-positive": "off",
|
|
66
|
-
"no-func-assign": "off",
|
|
67
|
-
"no-return-assign": "off",
|
|
68
|
-
"react/prop-types": "off",
|
|
69
|
-
"testing-library/no-dom-import": "off"
|
|
70
|
-
},
|
|
71
|
-
"overrides": [
|
|
72
|
-
{
|
|
73
|
-
"files": [
|
|
74
|
-
"**/__tests__/**"
|
|
75
|
-
],
|
|
76
|
-
"rules": {
|
|
77
|
-
"no-console": "off"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
"eslintIgnore": [
|
|
83
|
-
"node_modules",
|
|
84
|
-
"coverage",
|
|
85
|
-
"dist"
|
|
86
|
-
]
|
|
62
|
+
}
|
|
87
63
|
}
|
package/dist/clipboard/copy.d.ts
DELETED
package/dist/clipboard/copy.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copy = copy;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function copy() {
|
|
15
|
-
var _doc$activeElement;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const clipboardData = (0, _utils.copySelection)(target);
|
|
22
|
-
|
|
23
|
-
if (clipboardData.items.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_dom.fireEvent.copy(target, {
|
|
28
|
-
clipboardData
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (this[_setup.Config].writeToClipboard) {
|
|
32
|
-
await (0, _utils.writeDataTransferToClipboard)(doc, clipboardData);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return clipboardData;
|
|
36
|
-
}
|
package/dist/clipboard/cut.d.ts
DELETED
package/dist/clipboard/cut.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cut = cut;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function cut() {
|
|
15
|
-
var _doc$activeElement;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const clipboardData = (0, _utils.copySelection)(target);
|
|
22
|
-
|
|
23
|
-
if (clipboardData.items.length === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_dom.fireEvent.cut(target, {
|
|
28
|
-
clipboardData
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if ((0, _utils.isEditable)(target)) {
|
|
32
|
-
var _prepareInput;
|
|
33
|
-
|
|
34
|
-
(_prepareInput = (0, _utils.prepareInput)('', target, 'deleteByCut')) == null ? void 0 : _prepareInput.commit();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (this[_setup.Config].writeToClipboard) {
|
|
38
|
-
await (0, _utils.writeDataTransferToClipboard)(doc, clipboardData);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return clipboardData;
|
|
42
|
-
}
|
package/dist/clipboard/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _copy = require("./copy");
|
|
8
|
-
|
|
9
|
-
Object.keys(_copy).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _copy[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _copy[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
var _cut = require("./cut");
|
|
21
|
-
|
|
22
|
-
Object.keys(_cut).forEach(function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _cut[key]) return;
|
|
25
|
-
Object.defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _cut[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _paste = require("./paste");
|
|
34
|
-
|
|
35
|
-
Object.keys(_paste).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _paste[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _paste[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
package/dist/clipboard/paste.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.paste = paste;
|
|
7
|
-
|
|
8
|
-
var _dom = require("@testing-library/dom");
|
|
9
|
-
|
|
10
|
-
var _setup = require("../setup");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function paste(clipboardData) {
|
|
15
|
-
var _doc$activeElement, _ref;
|
|
16
|
-
|
|
17
|
-
const doc = this[_setup.Config].document;
|
|
18
|
-
const target = (_doc$activeElement = doc.activeElement) != null ? _doc$activeElement :
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
doc.body;
|
|
21
|
-
const data = (_ref = typeof clipboardData === 'string' ? getClipboardDataFromString(clipboardData) : clipboardData) != null ? _ref : await (0, _utils.readDataTransferFromClipboard)(doc).catch(() => {
|
|
22
|
-
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.');
|
|
23
|
-
});
|
|
24
|
-
return pasteImpl(target, data);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function pasteImpl(target, clipboardData) {
|
|
28
|
-
_dom.fireEvent.paste(target, {
|
|
29
|
-
clipboardData
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if ((0, _utils.isEditable)(target)) {
|
|
33
|
-
const data = clipboardData.getData('text').substr(0, (0, _utils.getSpaceUntilMaxLength)(target));
|
|
34
|
-
|
|
35
|
-
if (data) {
|
|
36
|
-
var _prepareInput;
|
|
37
|
-
|
|
38
|
-
(_prepareInput = (0, _utils.prepareInput)(data, target, 'insertFromPaste')) == null ? void 0 : _prepareInput.commit();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getClipboardDataFromString(text) {
|
|
44
|
-
const dt = (0, _utils.createDataTransfer)();
|
|
45
|
-
dt.setData('text', text);
|
|
46
|
-
return dt;
|
|
47
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { UserEvent } from '../setup';
|
|
2
|
-
export declare function click(this: UserEvent, element: Element): Promise<void>;
|
|
3
|
-
export declare function dblClick(this: UserEvent, element: Element): Promise<void>;
|
|
4
|
-
export declare function tripleClick(this: UserEvent, element: Element): Promise<void>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.click = click;
|
|
7
|
-
exports.dblClick = dblClick;
|
|
8
|
-
exports.tripleClick = tripleClick;
|
|
9
|
-
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
|
|
12
|
-
var _setup = require("../setup");
|
|
13
|
-
|
|
14
|
-
async function click(element) {
|
|
15
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
16
|
-
throw new Error('unable to click element as it has or inherits pointer-events set to "none".');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const pointerIn = [];
|
|
20
|
-
|
|
21
|
-
if (!this[_setup.Config].skipHover) {
|
|
22
|
-
pointerIn.push({
|
|
23
|
-
target: element
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
pointerIn.push({
|
|
28
|
-
keys: '[MouseLeft]',
|
|
29
|
-
target: element
|
|
30
|
-
});
|
|
31
|
-
return this.pointer(pointerIn);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function dblClick(element) {
|
|
35
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
36
|
-
throw new Error('unable to double-click element as it has or inherits pointer-events set to "none".');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return this.pointer([{
|
|
40
|
-
target: element
|
|
41
|
-
}, '[MouseLeft][MouseLeft]']);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async function tripleClick(element) {
|
|
45
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
46
|
-
throw new Error('unable to triple-click element as it has or inherits pointer-events set to "none".');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return this.pointer([{
|
|
50
|
-
target: element
|
|
51
|
-
}, '[MouseLeft][MouseLeft][MouseLeft]']);
|
|
52
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.hover = hover;
|
|
7
|
-
exports.unhover = unhover;
|
|
8
|
-
|
|
9
|
-
var _setup = require("../setup");
|
|
10
|
-
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
|
|
13
|
-
async function hover(element) {
|
|
14
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
15
|
-
throw new Error('unable to hover element as it has or inherits pointer-events set to "none".');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return this.pointer({
|
|
19
|
-
target: element
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function unhover(element) {
|
|
24
|
-
if (!this[_setup.Config].skipPointerEventsCheck && !(0, _utils.hasPointerEvents)(element)) {
|
|
25
|
-
throw new Error('unable to unhover element as it has or inherits pointer-events set to "none".');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return this.pointer({
|
|
29
|
-
target: element.ownerDocument.body
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _click = require("./click");
|
|
8
|
-
|
|
9
|
-
Object.keys(_click).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _click[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _click[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
var _hover = require("./hover");
|
|
21
|
-
|
|
22
|
-
Object.keys(_hover).forEach(function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _hover[key]) return;
|
|
25
|
-
Object.defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _hover[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _tab = require("./tab");
|
|
34
|
-
|
|
35
|
-
Object.keys(_tab).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _tab[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _tab[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
package/dist/convenience/tab.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.tab = tab;
|
|
7
|
-
|
|
8
|
-
async function tab({
|
|
9
|
-
shift
|
|
10
|
-
} = {}) {
|
|
11
|
-
return this.keyboard(shift === true ? '{Shift>}{Tab}{/Shift}' : shift === false ? '[/ShiftLeft][/ShiftRight]{Tab}' : '{Tab}');
|
|
12
|
-
}
|
package/dist/document/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const isPrepared: unique symbol;
|
|
2
|
-
declare global {
|
|
3
|
-
interface Node {
|
|
4
|
-
[isPrepared]?: typeof isPrepared;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export declare function prepareDocument(document: Document): void;
|
|
8
|
-
export { getUIValue, setUIValue, startTrackValue, endTrackValue } from './value';
|
|
9
|
-
export { getUISelection, setUISelection } from './selection';
|
|
10
|
-
export type { UISelectionRange } from './selection';
|
package/dist/document/index.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "endTrackValue", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _value.endTrackValue;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getUISelection", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _selection.getUISelection;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getUIValue", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _value.getUIValue;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
exports.prepareDocument = prepareDocument;
|
|
25
|
-
Object.defineProperty(exports, "setUISelection", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _selection.setUISelection;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "setUIValue", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _value.setUIValue;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "startTrackValue", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _value.startTrackValue;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
var _dom = require("@testing-library/dom");
|
|
45
|
-
|
|
46
|
-
var _selection = require("./selection");
|
|
47
|
-
|
|
48
|
-
var _value = require("./value");
|
|
49
|
-
|
|
50
|
-
const isPrepared = Symbol('Node prepared with document state workarounds');
|
|
51
|
-
|
|
52
|
-
function prepareDocument(document) {
|
|
53
|
-
if (document[isPrepared]) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
document.addEventListener('focus', e => {
|
|
58
|
-
const el = e.target;
|
|
59
|
-
prepareElement(el);
|
|
60
|
-
}, {
|
|
61
|
-
capture: true,
|
|
62
|
-
passive: true
|
|
63
|
-
}); // Our test environment defaults to `document.body` as `activeElement`.
|
|
64
|
-
// In other environments this might be `null` when preparing.
|
|
65
|
-
// istanbul ignore else
|
|
66
|
-
|
|
67
|
-
if (document.activeElement) {
|
|
68
|
-
prepareElement(document.activeElement);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
document.addEventListener('blur', e => {
|
|
72
|
-
const el = e.target;
|
|
73
|
-
const initialValue = (0, _value.getInitialValue)(el);
|
|
74
|
-
|
|
75
|
-
if (typeof initialValue === 'string' && el.value !== initialValue) {
|
|
76
|
-
_dom.fireEvent.change(el);
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
capture: true,
|
|
80
|
-
passive: true
|
|
81
|
-
});
|
|
82
|
-
document[isPrepared] = isPrepared;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function prepareElement(el) {
|
|
86
|
-
if ('value' in el) {
|
|
87
|
-
(0, _value.setInitialValue)(el);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (el[isPrepared]) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if ('value' in el) {
|
|
95
|
-
(0, _value.prepareValueInterceptor)(el);
|
|
96
|
-
(0, _selection.prepareSelectionInterceptor)(el);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
el[isPrepared] = isPrepared;
|
|
100
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare type anyFunc = (...a: any[]) => any;
|
|
2
|
-
declare type Params<Prop> = Prop extends anyFunc ? Parameters<Prop> : [Prop];
|
|
3
|
-
declare type ImplReturn<Prop> = Prop extends anyFunc ? Parameters<Prop> : Prop;
|
|
4
|
-
export declare function prepareInterceptor<ElementType extends Node, PropName extends keyof ElementType>(element: ElementType, propName: PropName, interceptorImpl: (this: ElementType, ...args: Params<ElementType[PropName]>) => {
|
|
5
|
-
/**
|
|
6
|
-
* React tracks the changes on element properties.
|
|
7
|
-
* This workaround tries to alter the DOM element without React noticing,
|
|
8
|
-
* so that it later picks up the change.
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/facebook/react/blob/148f8e497c7d37a3c7ab99f01dec2692427272b1/packages/react-dom/src/client/inputValueTracking.js#L51-L104
|
|
11
|
-
*/
|
|
12
|
-
applyNative?: boolean;
|
|
13
|
-
realArgs?: ImplReturn<ElementType[PropName]>;
|
|
14
|
-
}): void;
|
|
15
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.prepareInterceptor = prepareInterceptor;
|
|
7
|
-
const Interceptor = Symbol('Interceptor for programmatical calls');
|
|
8
|
-
|
|
9
|
-
function prepareInterceptor(element, propName, interceptorImpl) {
|
|
10
|
-
const prototypeDescriptor = Object.getOwnPropertyDescriptor(element.constructor.prototype, propName);
|
|
11
|
-
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName);
|
|
12
|
-
const target = prototypeDescriptor != null && prototypeDescriptor.set ? 'set' : 'value';
|
|
13
|
-
|
|
14
|
-
if (typeof (prototypeDescriptor == null ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function intercept(...args) {
|
|
19
|
-
const {
|
|
20
|
-
applyNative = true,
|
|
21
|
-
realArgs
|
|
22
|
-
} = interceptorImpl.call(this, ...args);
|
|
23
|
-
const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
|
|
24
|
-
|
|
25
|
-
if (target === 'set') {
|
|
26
|
-
realFunc.call(this, realArgs);
|
|
27
|
-
} else {
|
|
28
|
-
realFunc.call(this, ...realArgs);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
;
|
|
33
|
-
intercept[Interceptor] = Interceptor;
|
|
34
|
-
Object.defineProperty(element, propName, { ...(objectDescriptor != null ? objectDescriptor : prototypeDescriptor),
|
|
35
|
-
[target]: intercept
|
|
36
|
-
});
|
|
37
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare const UISelection: unique symbol;
|
|
2
|
-
export interface UISelectionRange {
|
|
3
|
-
startOffset: number;
|
|
4
|
-
endOffset: number;
|
|
5
|
-
}
|
|
6
|
-
export interface UISelection {
|
|
7
|
-
anchorOffset: number;
|
|
8
|
-
focusOffset: number;
|
|
9
|
-
}
|
|
10
|
-
declare global {
|
|
11
|
-
interface Element {
|
|
12
|
-
[UISelection]?: UISelection;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare function prepareSelectionInterceptor(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
16
|
-
export declare function setUISelection(element: HTMLInputElement | HTMLTextAreaElement, { focusOffset: focusOffsetParam, anchorOffset: anchorOffsetParam, }: {
|
|
17
|
-
anchorOffset?: number;
|
|
18
|
-
focusOffset: number;
|
|
19
|
-
}, mode?: 'replace' | 'modify'): void;
|
|
20
|
-
export declare function getUISelection(element: HTMLInputElement | HTMLTextAreaElement): {
|
|
21
|
-
startOffset: number;
|
|
22
|
-
endOffset: number;
|
|
23
|
-
anchorOffset: number;
|
|
24
|
-
focusOffset: number;
|
|
25
|
-
};
|
|
26
|
-
export declare function clearUISelection(element: HTMLInputElement | HTMLTextAreaElement): void;
|
|
27
|
-
export {};
|