源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
commit
04bac1f6e2
2200 files changed
+489415
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import {
|
||||
favoriteModelShortcutLabel,
|
||||
isFavoriteModelShortcut,
|
||||
} from "../src/react-app/shell/favorite-model-shortcut";
|
||||
|
||||
const event = (overrides: Partial<KeyboardEvent> = {}) => ({
|
||||
altKey: false,
|
||||
ctrlKey: false,
|
||||
key: "m",
|
||||
metaKey: false,
|
||||
shiftKey: false,
|
||||
...overrides,
|
||||
});
|
||||
|
||||
describe("favorite model shortcut", () => {
|
||||
test("uses Control+Shift+M", () => {
|
||||
expect(favoriteModelShortcutLabel).toBe("Ctrl+Shift+M");
|
||||
expect(isFavoriteModelShortcut(event({ ctrlKey: true, shiftKey: true }))).toBe(true);
|
||||
});
|
||||
|
||||
test("does not consume neighboring modifier combinations", () => {
|
||||
expect(isFavoriteModelShortcut(event({ ctrlKey: true }))).toBe(false);
|
||||
expect(isFavoriteModelShortcut(event({ ctrlKey: true, shiftKey: true, altKey: true }))).toBe(false);
|
||||
expect(isFavoriteModelShortcut(event({ ctrlKey: true, shiftKey: true, metaKey: true }))).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user