@testing-library/user-event 14.6.3 → 14.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,7 +19,7 @@ async function keyboardAction(instance, { keyDef, releasePrevious, releaseSelf,
|
|
|
19
19
|
}
|
|
20
20
|
if (!releasePrevious) {
|
|
21
21
|
for(let i = 1; i <= repeat; i++){
|
|
22
|
-
await system.keyboard.keydown(instance, keyDef);
|
|
22
|
+
await system.keyboard.keydown(instance, keyDef, i > 1);
|
|
23
23
|
if (i < repeat) {
|
|
24
24
|
await wait.wait(instance.config);
|
|
25
25
|
}
|
|
@@ -50,7 +50,7 @@ class KeyboardHost {
|
|
|
50
50
|
getPressedKeys() {
|
|
51
51
|
return this.pressed.values().map((p)=>p.keyDef);
|
|
52
52
|
}
|
|
53
|
-
/** Press a key */ async keydown(instance, keyDef) {
|
|
53
|
+
/** Press a key */ async keydown(instance, keyDef, repeat = false) {
|
|
54
54
|
const key = String(keyDef.key);
|
|
55
55
|
const code = String(keyDef.code);
|
|
56
56
|
const target = getActiveElement.getActiveElementOrBody(instance.config.document);
|
|
@@ -61,7 +61,8 @@ class KeyboardHost {
|
|
|
61
61
|
}
|
|
62
62
|
const unprevented = instance.dispatchUIEvent(target, 'keydown', {
|
|
63
63
|
key,
|
|
64
|
-
code
|
|
64
|
+
code,
|
|
65
|
+
repeat
|
|
65
66
|
});
|
|
66
67
|
if (isModifierLock(key) && !this.modifiers[key]) {
|
|
67
68
|
this.modifiers[key] = true;
|
|
@@ -17,7 +17,7 @@ async function keyboardAction(instance, { keyDef, releasePrevious, releaseSelf,
|
|
|
17
17
|
}
|
|
18
18
|
if (!releasePrevious) {
|
|
19
19
|
for(let i = 1; i <= repeat; i++){
|
|
20
|
-
await system.keyboard.keydown(instance, keyDef);
|
|
20
|
+
await system.keyboard.keydown(instance, keyDef, i > 1);
|
|
21
21
|
if (i < repeat) {
|
|
22
22
|
await wait(instance.config);
|
|
23
23
|
}
|
|
@@ -48,7 +48,7 @@ class KeyboardHost {
|
|
|
48
48
|
getPressedKeys() {
|
|
49
49
|
return this.pressed.values().map((p)=>p.keyDef);
|
|
50
50
|
}
|
|
51
|
-
/** Press a key */ async keydown(instance, keyDef) {
|
|
51
|
+
/** Press a key */ async keydown(instance, keyDef, repeat = false) {
|
|
52
52
|
const key = String(keyDef.key);
|
|
53
53
|
const code = String(keyDef.code);
|
|
54
54
|
const target = getActiveElementOrBody(instance.config.document);
|
|
@@ -59,7 +59,8 @@ class KeyboardHost {
|
|
|
59
59
|
}
|
|
60
60
|
const unprevented = instance.dispatchUIEvent(target, 'keydown', {
|
|
61
61
|
key,
|
|
62
|
-
code
|
|
62
|
+
code,
|
|
63
|
+
repeat
|
|
63
64
|
});
|
|
64
65
|
if (isModifierLock(key) && !this.modifiers[key]) {
|
|
65
66
|
this.modifiers[key] = true;
|
|
@@ -42,7 +42,7 @@ export declare class KeyboardHost {
|
|
|
42
42
|
isKeyPressed(keyDef: keyboardKey): boolean;
|
|
43
43
|
getPressedKeys(): keyboardKey[];
|
|
44
44
|
/** Press a key */
|
|
45
|
-
keydown(instance: Instance, keyDef: keyboardKey): Promise<void>;
|
|
45
|
+
keydown(instance: Instance, keyDef: keyboardKey, repeat?: boolean): Promise<void>;
|
|
46
46
|
/** Release a key */
|
|
47
47
|
keyup(instance: Instance, keyDef: keyboardKey): Promise<void>;
|
|
48
48
|
private setKeydownTarget;
|