@testspectra/react 1.2.9 → 1.2.11

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.js CHANGED
@@ -15,28 +15,12 @@ var SPECIAL_KEYS = {
15
15
  Home: { code: "Home", windowsVirtualKeyCode: 36 },
16
16
  End: { code: "End", windowsVirtualKeyCode: 35 },
17
17
  PageUp: { code: "PageUp", windowsVirtualKeyCode: 33 },
18
- PageDown: { code: "PageDown", windowsVirtualKeyCode: 34 },
19
- " ": { code: "Space", windowsVirtualKeyCode: 32, text: " " },
20
- Space: { code: "Space", windowsVirtualKeyCode: 32, text: " " }
18
+ PageDown: { code: "PageDown", windowsVirtualKeyCode: 34 }
21
19
  };
22
- function codeForChar(char) {
23
- if (/^[a-zA-Z]$/.test(char)) return `Key${char.toUpperCase()}`;
24
- if (/^[0-9]$/.test(char)) return `Digit${char}`;
25
- return void 0;
26
- }
27
20
  function describePressKey(input) {
28
21
  if (typeof input !== "string") return null;
29
- if (input === "Space") return { key: " ", code: "Space", windowsVirtualKeyCode: 32, text: " " };
30
22
  const special = SPECIAL_KEYS[input];
31
23
  if (special) return { key: input, ...special };
32
- if (input.length === 1) {
33
- return {
34
- key: input,
35
- code: codeForChar(input),
36
- windowsVirtualKeyCode: input.toUpperCase().charCodeAt(0),
37
- text: input
38
- };
39
- }
40
24
  return null;
41
25
  }
42
26
 
@@ -855,8 +839,8 @@ var DomDriverBridge = class {
855
839
  // ─── Gestures & Keys ─────────────────────────────────────────────────────
856
840
  async pressKey(key) {
857
841
  const desc = describePressKey(key);
858
- if (desc) {
859
- await getUser().keyboard(desc.code ? `{${desc.code}}` : desc.key);
842
+ if (desc?.code) {
843
+ await getUser().keyboard(`{${desc.code}}`);
860
844
  return;
861
845
  }
862
846
  const active = document.activeElement || document.body;