command-tooltip-keybind.test.ts 687 B

12345678910111213141516171819202122
  1. import { describe, expect, test } from "bun:test"
  2. import { newTabTooltipKeybind, reviewTooltipKeybind } from "./command-tooltip-keybind"
  3. describe("command tooltip keybinds", () => {
  4. test("keeps localized review shortcut modifiers", () => {
  5. const command = {
  6. keybind: () => "Ctrl+Maj+R",
  7. keybindParts: () => ["Ctrl", "Maj", "R"],
  8. }
  9. expect(reviewTooltipKeybind(command, (key) => key)).toEqual(["Ctrl", "Maj", "R"])
  10. })
  11. test("uses the configured new-tab shortcut", () => {
  12. const command = {
  13. keybind: () => "Alt+N",
  14. keybindParts: () => ["Alt", "N"],
  15. }
  16. expect(newTabTooltipKeybind(command, (key) => key)).toEqual(["Alt", "N"])
  17. })
  18. })