fix(ci): sync frontend tests with grid changes

This commit is contained in:
t8y2 committed 2026-08-25 11:02:27 +08:00
1 parent 4be1928d15
commit 08365d73eb
8 files changed
+25 -10

No files matched your search

@@ -67,7 +67,16 @@ describe("gridSelection", () => {
["single cell", [[8]], 1, 1, 8],
["row", [[1, 3]], 2, 1, 2],
["column", [[1], [3]], 2, 2, 2],
["range", [[1, 2], [3, 4]], 4, 2, 2.5],
[
"range",
[
[1, 2],
[3, 4],
],
4,
2,
2.5,
],
] as const)("averages a %s selection without changing its counts", (_label, rows, cellCount, rowCount, average) => {
expect(summarizeSelection({ columns: [], rows: rows.map((row) => [...row]) })).toMatchObject({ cellCount, rowCount, average });
});
@@ -97,9 +97,9 @@ describe("keyboard shortcut matching", () => {
});
it("matches only the configured go-to-column shortcut", () => {
expect(isGoToColumnShortcut({ key: "g", ctrlKey: true }, { goToColumn: "Mod+G" })).toBe(true);
expect(isGoToColumnShortcut({ key: "g", ctrlKey: true, shiftKey: true }, { goToColumn: "Mod+G" })).toBe(false);
expect(isGoToColumnShortcut({ key: "j", ctrlKey: true }, { goToColumn: "Mod+G" })).toBe(false);
expect(isGoToColumnShortcut({ key: "g", ctrlKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(true);
expect(isGoToColumnShortcut({ key: "g", ctrlKey: true, shiftKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(false);
expect(isGoToColumnShortcut({ key: "j", ctrlKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(false);
});
it("does not match an empty or composing go-to-column shortcut", () => {
@@ -211,8 +211,8 @@ export function isDeleteCurrentRowShortcut(event: ShortcutLikeEvent, shortcuts?:
return matchesShortcut(event, actionShortcut("deleteCurrentRow", shortcuts));
}
export function isGoToColumnShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
return matchesShortcut(event, actionShortcut("goToColumn", shortcuts));
export function isGoToColumnShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>, platform = globalThis.navigator?.platform || ""): boolean {
return matchesShortcut(event, actionShortcut("goToColumn", shortcuts, platform), platform);
}
export function isGoToFirstPageShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {