@testing-library/user-event 14.0.0-beta.13 → 14.0.0-beta.14
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 +1 -1
- package/dist/index.cjs +21 -26
- package/dist/index.mjs +13 -13
- package/dist/types/event/eventMap.d.ts +16 -0
- package/dist/types/utils/keyDef/readNextDescriptor.d.ts +3 -1
- package/package.json +10 -13
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ possible][contributors]. Contributions of any kind are welcome! 💚
|
|
|
104
104
|
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
|
|
105
105
|
[prs]: http://makeapullrequest.com
|
|
106
106
|
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
|
|
107
|
-
[coc]: https://github.com/testing-library/
|
|
107
|
+
[coc]: https://github.com/testing-library/.github/blob/main/CODE_OF_CONDUCT.md
|
|
108
108
|
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/user-event.svg?style=social
|
|
109
109
|
[github-watch]: https://github.com/testing-library/user-event/watchers
|
|
110
110
|
[github-star-badge]: https://img.shields.io/github/stars/testing-library/user-event.svg?style=social
|
package/dist/index.cjs
CHANGED
|
@@ -19,24 +19,19 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
21
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
23
22
|
var __export = (target, all) => {
|
|
24
23
|
for (var name in all)
|
|
25
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
25
|
};
|
|
27
|
-
var
|
|
28
|
-
if (
|
|
29
|
-
for (let key of __getOwnPropNames(
|
|
30
|
-
if (!__hasOwnProp.call(
|
|
31
|
-
__defProp(
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
31
|
}
|
|
33
|
-
return
|
|
32
|
+
return to;
|
|
34
33
|
};
|
|
35
|
-
var __toCommonJS =
|
|
36
|
-
return (module2, temp) => {
|
|
37
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
38
|
-
};
|
|
39
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
35
|
|
|
41
36
|
// src/index.ts
|
|
42
37
|
var src_exports = {};
|
|
@@ -44,6 +39,7 @@ __export(src_exports, {
|
|
|
44
39
|
PointerEventsCheckLevel: () => PointerEventsCheckLevel,
|
|
45
40
|
default: () => userEvent
|
|
46
41
|
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
47
43
|
|
|
48
44
|
// src/utils/misc/isElementType.ts
|
|
49
45
|
function isElementType(element, tag, props) {
|
|
@@ -1093,7 +1089,7 @@ var bracketDict = /* @__PURE__ */ ((bracketDict2) => {
|
|
|
1093
1089
|
bracketDict2["["] = "]";
|
|
1094
1090
|
return bracketDict2;
|
|
1095
1091
|
})(bracketDict || {});
|
|
1096
|
-
function readNextDescriptor(text) {
|
|
1092
|
+
function readNextDescriptor(text, context) {
|
|
1097
1093
|
let pos = 0;
|
|
1098
1094
|
const startBracket = text[pos] in bracketDict ? text[pos] : "";
|
|
1099
1095
|
pos += startBracket.length;
|
|
@@ -1101,11 +1097,11 @@ function readNextDescriptor(text) {
|
|
|
1101
1097
|
const type3 = isEscapedChar ? "" : startBracket;
|
|
1102
1098
|
return __spreadValues({
|
|
1103
1099
|
type: type3
|
|
1104
|
-
}, type3 === "" ? readPrintableChar(text, pos) : readTag(text, pos, type3));
|
|
1100
|
+
}, type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context));
|
|
1105
1101
|
}
|
|
1106
|
-
function readPrintableChar(text, pos) {
|
|
1102
|
+
function readPrintableChar(text, pos, context) {
|
|
1107
1103
|
const descriptor = text[pos];
|
|
1108
|
-
assertDescriptor(descriptor, text, pos);
|
|
1104
|
+
assertDescriptor(descriptor, text, pos, context);
|
|
1109
1105
|
pos += descriptor.length;
|
|
1110
1106
|
return {
|
|
1111
1107
|
consumedLength: pos,
|
|
@@ -1115,14 +1111,14 @@ function readPrintableChar(text, pos) {
|
|
|
1115
1111
|
repeat: 1
|
|
1116
1112
|
};
|
|
1117
1113
|
}
|
|
1118
|
-
function readTag(text, pos, startBracket) {
|
|
1114
|
+
function readTag(text, pos, startBracket, context) {
|
|
1119
1115
|
var _a, _b, _c;
|
|
1120
1116
|
const releasePreviousModifier = text[pos] === "/" ? "/" : "";
|
|
1121
1117
|
pos += releasePreviousModifier.length;
|
|
1122
1118
|
const escapedDescriptor = startBracket === "{" && text[pos] === "\\";
|
|
1123
1119
|
pos += Number(escapedDescriptor);
|
|
1124
1120
|
const descriptor = escapedDescriptor ? text[pos] : (_a = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) == null ? void 0 : _a[0];
|
|
1125
|
-
assertDescriptor(descriptor, text, pos);
|
|
1121
|
+
assertDescriptor(descriptor, text, pos, context);
|
|
1126
1122
|
pos += descriptor.length;
|
|
1127
1123
|
const repeatModifier = (_c = (_b = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _b[0]) != null ? _c : "";
|
|
1128
1124
|
pos += repeatModifier.length;
|
|
@@ -1135,7 +1131,7 @@ function readTag(text, pos, startBracket) {
|
|
|
1135
1131
|
!repeatModifier && "repeat modifier",
|
|
1136
1132
|
!releaseSelfModifier && "release modifier",
|
|
1137
1133
|
`"${expectedEndBracket}"`
|
|
1138
|
-
].filter(Boolean).join(" or "), text[pos], text));
|
|
1134
|
+
].filter(Boolean).join(" or "), text[pos], text, context));
|
|
1139
1135
|
}
|
|
1140
1136
|
pos += endBracket.length;
|
|
1141
1137
|
return {
|
|
@@ -1146,9 +1142,9 @@ function readTag(text, pos, startBracket) {
|
|
|
1146
1142
|
releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
|
|
1147
1143
|
};
|
|
1148
1144
|
}
|
|
1149
|
-
function assertDescriptor(descriptor, text, pos) {
|
|
1145
|
+
function assertDescriptor(descriptor, text, pos, context) {
|
|
1150
1146
|
if (!descriptor) {
|
|
1151
|
-
throw new Error(getErrorMessage("key descriptor", text[pos], text));
|
|
1147
|
+
throw new Error(getErrorMessage("key descriptor", text[pos], text, context));
|
|
1152
1148
|
}
|
|
1153
1149
|
}
|
|
1154
1150
|
function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
@@ -1159,9 +1155,9 @@ function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
|
1159
1155
|
return false;
|
|
1160
1156
|
}
|
|
1161
1157
|
}
|
|
1162
|
-
function getErrorMessage(expected, found, text) {
|
|
1158
|
+
function getErrorMessage(expected, found, text, context) {
|
|
1163
1159
|
return `Expected ${expected} but found "${found != null ? found : ""}" in "${text}"
|
|
1164
|
-
See https://
|
|
1160
|
+
See ${context === "pointer" ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`}
|
|
1165
1161
|
for more information about how userEvent parses your input.`;
|
|
1166
1162
|
}
|
|
1167
1163
|
|
|
@@ -1971,7 +1967,7 @@ function parseKeyDef(keyboardMap, text) {
|
|
|
1971
1967
|
releasePrevious,
|
|
1972
1968
|
releaseSelf = true,
|
|
1973
1969
|
repeat
|
|
1974
|
-
} = readNextDescriptor(text);
|
|
1970
|
+
} = readNextDescriptor(text, "keyboard");
|
|
1975
1971
|
const keyDef = (_a = keyboardMap.find((def) => {
|
|
1976
1972
|
var _a2, _b;
|
|
1977
1973
|
if (type3 === "[") {
|
|
@@ -2028,7 +2024,7 @@ function parseKeyDef2(pointerMap, keys) {
|
|
|
2028
2024
|
consumedLength,
|
|
2029
2025
|
releasePrevious,
|
|
2030
2026
|
releaseSelf = true
|
|
2031
|
-
} = readNextDescriptor(keys);
|
|
2027
|
+
} = readNextDescriptor(keys, "pointer");
|
|
2032
2028
|
const keyDef = pointerMap.find((p) => p.name === descriptor);
|
|
2033
2029
|
if (keyDef) {
|
|
2034
2030
|
defs.push({ keyDef, releasePrevious, releaseSelf });
|
|
@@ -2898,4 +2894,3 @@ function tab2(options = {}) {
|
|
|
2898
2894
|
var userEvent = __spreadProps(__spreadValues({}, directApi_exports), {
|
|
2899
2895
|
setup: setupMain
|
|
2900
2896
|
});
|
|
2901
|
-
module.exports = __toCommonJS(src_exports);
|
package/dist/index.mjs
CHANGED
|
@@ -1105,7 +1105,7 @@ var bracketDict = /* @__PURE__ */ ((bracketDict2) => {
|
|
|
1105
1105
|
bracketDict2["["] = "]";
|
|
1106
1106
|
return bracketDict2;
|
|
1107
1107
|
})(bracketDict || {});
|
|
1108
|
-
function readNextDescriptor(text) {
|
|
1108
|
+
function readNextDescriptor(text, context) {
|
|
1109
1109
|
let pos = 0;
|
|
1110
1110
|
const startBracket = text[pos] in bracketDict ? text[pos] : "";
|
|
1111
1111
|
pos += startBracket.length;
|
|
@@ -1113,11 +1113,11 @@ function readNextDescriptor(text) {
|
|
|
1113
1113
|
const type3 = isEscapedChar ? "" : startBracket;
|
|
1114
1114
|
return __spreadValues({
|
|
1115
1115
|
type: type3
|
|
1116
|
-
}, type3 === "" ? readPrintableChar(text, pos) : readTag(text, pos, type3));
|
|
1116
|
+
}, type3 === "" ? readPrintableChar(text, pos, context) : readTag(text, pos, type3, context));
|
|
1117
1117
|
}
|
|
1118
|
-
function readPrintableChar(text, pos) {
|
|
1118
|
+
function readPrintableChar(text, pos, context) {
|
|
1119
1119
|
const descriptor = text[pos];
|
|
1120
|
-
assertDescriptor(descriptor, text, pos);
|
|
1120
|
+
assertDescriptor(descriptor, text, pos, context);
|
|
1121
1121
|
pos += descriptor.length;
|
|
1122
1122
|
return {
|
|
1123
1123
|
consumedLength: pos,
|
|
@@ -1127,14 +1127,14 @@ function readPrintableChar(text, pos) {
|
|
|
1127
1127
|
repeat: 1
|
|
1128
1128
|
};
|
|
1129
1129
|
}
|
|
1130
|
-
function readTag(text, pos, startBracket) {
|
|
1130
|
+
function readTag(text, pos, startBracket, context) {
|
|
1131
1131
|
var _a, _b, _c;
|
|
1132
1132
|
const releasePreviousModifier = text[pos] === "/" ? "/" : "";
|
|
1133
1133
|
pos += releasePreviousModifier.length;
|
|
1134
1134
|
const escapedDescriptor = startBracket === "{" && text[pos] === "\\";
|
|
1135
1135
|
pos += Number(escapedDescriptor);
|
|
1136
1136
|
const descriptor = escapedDescriptor ? text[pos] : (_a = text.slice(pos).match(startBracket === "{" ? /^\w+|^[^}>/]/ : /^\w+/)) == null ? void 0 : _a[0];
|
|
1137
|
-
assertDescriptor(descriptor, text, pos);
|
|
1137
|
+
assertDescriptor(descriptor, text, pos, context);
|
|
1138
1138
|
pos += descriptor.length;
|
|
1139
1139
|
const repeatModifier = (_c = (_b = text.slice(pos).match(/^>\d+/)) == null ? void 0 : _b[0]) != null ? _c : "";
|
|
1140
1140
|
pos += repeatModifier.length;
|
|
@@ -1147,7 +1147,7 @@ function readTag(text, pos, startBracket) {
|
|
|
1147
1147
|
!repeatModifier && "repeat modifier",
|
|
1148
1148
|
!releaseSelfModifier && "release modifier",
|
|
1149
1149
|
`"${expectedEndBracket}"`
|
|
1150
|
-
].filter(Boolean).join(" or "), text[pos], text));
|
|
1150
|
+
].filter(Boolean).join(" or "), text[pos], text, context));
|
|
1151
1151
|
}
|
|
1152
1152
|
pos += endBracket.length;
|
|
1153
1153
|
return {
|
|
@@ -1158,9 +1158,9 @@ function readTag(text, pos, startBracket) {
|
|
|
1158
1158
|
releaseSelf: hasReleaseSelf(releaseSelfModifier, repeatModifier)
|
|
1159
1159
|
};
|
|
1160
1160
|
}
|
|
1161
|
-
function assertDescriptor(descriptor, text, pos) {
|
|
1161
|
+
function assertDescriptor(descriptor, text, pos, context) {
|
|
1162
1162
|
if (!descriptor) {
|
|
1163
|
-
throw new Error(getErrorMessage("key descriptor", text[pos], text));
|
|
1163
|
+
throw new Error(getErrorMessage("key descriptor", text[pos], text, context));
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
1166
|
function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
@@ -1171,9 +1171,9 @@ function hasReleaseSelf(releaseSelfModifier, repeatModifier) {
|
|
|
1171
1171
|
return false;
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
1174
|
-
function getErrorMessage(expected, found, text) {
|
|
1174
|
+
function getErrorMessage(expected, found, text, context) {
|
|
1175
1175
|
return `Expected ${expected} but found "${found != null ? found : ""}" in "${text}"
|
|
1176
|
-
See https://
|
|
1176
|
+
See ${context === "pointer" ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`}
|
|
1177
1177
|
for more information about how userEvent parses your input.`;
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
@@ -1995,7 +1995,7 @@ function parseKeyDef(keyboardMap, text) {
|
|
|
1995
1995
|
releasePrevious,
|
|
1996
1996
|
releaseSelf = true,
|
|
1997
1997
|
repeat
|
|
1998
|
-
} = readNextDescriptor(text);
|
|
1998
|
+
} = readNextDescriptor(text, "keyboard");
|
|
1999
1999
|
const keyDef = (_a = keyboardMap.find((def) => {
|
|
2000
2000
|
var _a2, _b;
|
|
2001
2001
|
if (type3 === "[") {
|
|
@@ -2054,7 +2054,7 @@ function parseKeyDef2(pointerMap, keys) {
|
|
|
2054
2054
|
consumedLength,
|
|
2055
2055
|
releasePrevious,
|
|
2056
2056
|
releaseSelf = true
|
|
2057
|
-
} = readNextDescriptor(keys);
|
|
2057
|
+
} = readNextDescriptor(keys, "pointer");
|
|
2058
2058
|
const keyDef = pointerMap.find((p) => p.name === descriptor);
|
|
2059
2059
|
if (keyDef) {
|
|
2060
2060
|
defs.push({ keyDef, releasePrevious, releaseSelf });
|
|
@@ -103,6 +103,10 @@ export declare const eventMap: {
|
|
|
103
103
|
EventType: string;
|
|
104
104
|
defaultInit: EventInit;
|
|
105
105
|
};
|
|
106
|
+
resize: {
|
|
107
|
+
EventType: string;
|
|
108
|
+
defaultInit: EventInit;
|
|
109
|
+
};
|
|
106
110
|
seeked: {
|
|
107
111
|
EventType: string;
|
|
108
112
|
defaultInit: EventInit;
|
|
@@ -291,10 +295,22 @@ export declare const eventMap: {
|
|
|
291
295
|
EventType: string;
|
|
292
296
|
defaultInit: EventInit;
|
|
293
297
|
};
|
|
298
|
+
transitionCancel: {
|
|
299
|
+
EventType: string;
|
|
300
|
+
defaultInit: EventInit;
|
|
301
|
+
};
|
|
294
302
|
transitionEnd: {
|
|
295
303
|
EventType: string;
|
|
296
304
|
defaultInit: EventInit;
|
|
297
305
|
};
|
|
306
|
+
transitionRun: {
|
|
307
|
+
EventType: string;
|
|
308
|
+
defaultInit: EventInit;
|
|
309
|
+
};
|
|
310
|
+
transitionStart: {
|
|
311
|
+
EventType: string;
|
|
312
|
+
defaultInit: EventInit;
|
|
313
|
+
};
|
|
298
314
|
doubleClick: {
|
|
299
315
|
EventType: string;
|
|
300
316
|
defaultInit: EventInit;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
declare type Context = 'pointer' | 'keyboard';
|
|
1
2
|
/**
|
|
2
3
|
* Read the next key definition from user input
|
|
3
4
|
*
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
* When keeping the key pressed you can choose how long the key is pressed `{descriptor>3}`.
|
|
10
11
|
* You can then release the key per `{descriptor>3/}` or keep it pressed and continue with the next key.
|
|
11
12
|
*/
|
|
12
|
-
export declare function readNextDescriptor(text: string): {
|
|
13
|
+
export declare function readNextDescriptor(text: string, context: Context): {
|
|
13
14
|
consumedLength: number;
|
|
14
15
|
descriptor: string;
|
|
15
16
|
releasePrevious: boolean;
|
|
@@ -17,3 +18,4 @@ export declare function readNextDescriptor(text: string): {
|
|
|
17
18
|
releaseSelf: boolean | undefined;
|
|
18
19
|
type: string;
|
|
19
20
|
};
|
|
21
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/user-event",
|
|
3
|
-
"version": "14.0.0-beta.
|
|
3
|
+
"version": "14.0.0-beta.14",
|
|
4
4
|
"description": "Fire events the same way the user does",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-testing-library",
|
|
@@ -44,22 +44,19 @@
|
|
|
44
44
|
"validate": "kcd-scripts validate",
|
|
45
45
|
"typecheck": "kcd-scripts typecheck"
|
|
46
46
|
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@babel/runtime": "^7.12.5"
|
|
49
|
-
},
|
|
47
|
+
"dependencies": {},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@testing-library/dom": "^
|
|
52
|
-
"@testing-library/jest-dom": "^5.
|
|
53
|
-
"@testing-library/react": "^
|
|
54
|
-
"@types/estree": "0.0.45",
|
|
49
|
+
"@testing-library/dom": "^8.11.4",
|
|
50
|
+
"@testing-library/jest-dom": "^5.16.3",
|
|
51
|
+
"@testing-library/react": "^12.1.4",
|
|
55
52
|
"@types/jest-in-case": "^1.0.3",
|
|
56
|
-
"@types/react": "^17.0.
|
|
57
|
-
"esbuild": "^0.14.
|
|
58
|
-
"eslint-import-resolver-typescript": "^2.
|
|
59
|
-
"is-ci": "^
|
|
53
|
+
"@types/react": "^17.0.42",
|
|
54
|
+
"esbuild": "^0.14.27",
|
|
55
|
+
"eslint-import-resolver-typescript": "^2.7.0",
|
|
56
|
+
"is-ci": "^3.0.1",
|
|
60
57
|
"jest-in-case": "^1.0.2",
|
|
61
58
|
"jest-serializer-ansi": "^1.0.3",
|
|
62
|
-
"kcd-scripts": "^
|
|
59
|
+
"kcd-scripts": "^12.1.0",
|
|
63
60
|
"react": "^17.0.2",
|
|
64
61
|
"react-dom": "^17.0.2",
|
|
65
62
|
"typescript": "^4.1.2"
|