26 lines · 981 B · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test"; import { isCommentSubmitShortcut } from "./commentSubmitShortcut"; describe("isCommentSubmitShortcut", () => {  it("accepts Command or Ctrl+Enter only while an eligible comment is idle", () => {    expect(      isCommentSubmitShortcut({ key: "Enter", metaKey: true, ctrlKey: false }, "Looks good", false),    ).toBe(true);    expect(      isCommentSubmitShortcut({ key: "Enter", metaKey: false, ctrlKey: true }, "Looks good", false),    ).toBe(true);    expect(      isCommentSubmitShortcut({ key: "Enter", metaKey: true, ctrlKey: false }, "Looks good", true),    ).toBe(false);  });   it("rejects empty comments and unrelated key presses", () => {    expect(      isCommentSubmitShortcut({ key: "Enter", metaKey: true, ctrlKey: false }, "   ", false),    ).toBe(false);    expect(      isCommentSubmitShortcut({ key: "K", metaKey: true, ctrlKey: false }, "Looks good", false),    ).toBe(false);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t