Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { parseDesktopSnapShotShortcut, snapShotShortcutKeyLabels } from "./snapShotShortcut";
4
5describe("desktop-approved window capture shortcut labels", () => {
6 it.each([
7 ["Press <Shift><Control>2", ["Ctrl", "⇧", "2"]],
8 ["<Control><Shift>2", ["Ctrl", "⇧", "2"]],
9 ["Ctrl+Shift+8", ["Ctrl", "⇧", "8"]],
10 ["CTRL+SHIFT+8", ["Ctrl", "⇧", "8"]],
11 ["Meta+F12", ["Super", "F12"]],
12 ["Super+F8", ["Super", "F8"]],
13 ["<Primary><Alt>Return", ["Ctrl", "Alt", "Enter"]],
14 ["<Super>Left", ["Super", "Left"]],
15 ["<Control>space", ["Ctrl", "Space"]],
16 ["<Control>plus", ["Ctrl", "+"]],
17 ["<Control>+", ["Ctrl", "+"]],
18 ["Ctrl++", ["Ctrl", "+"]],
19 [" Ctrl + Shift + 2 ", ["Ctrl", "⇧", "2"]],
20 ])("formats %s using the shared keycap labels", (label, expected) => {
21 const shortcut = parseDesktopSnapShotShortcut(label);
22 expect(shortcut).not.toBeNull();
23 expect(snapShotShortcutKeyLabels(shortcut!, "Linux")).toEqual(expected);
24 });
25
26 it.each([
27 "",
28 " ",
29 "Press ",
30 "Ctrl+",
31 "Press the shortcut configured in your desktop",
32 "Ctrl+Shift+2 or Ctrl+Shift+3",
33 "Press <Control>2 or <Control>3",
34 "<Unknown>2",
35 "<Control>",
36 "<Control>UnknownKey",
37 ])("does not guess keys from an unrecognized description: %s", (label) => {
38 expect(parseDesktopSnapShotShortcut(label)).toBeNull();
39 });
40});