Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

test(hotkeys): honor platform-specific shortcut labels (#10237)

rnshinec1df7acc19d0
diff --git a/invokeai/frontend/webv2/src/workbench/hotkeys/shortcutHints.test.ts b/invokeai/frontend/webv2/src/workbench/hotkeys/shortcutHints.test.ts
index 11b3253bb4..c07d6de4bb 100644
--- a/invokeai/frontend/webv2/src/workbench/hotkeys/shortcutHints.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/hotkeys/shortcutHints.test.ts
@@ -47,11 +47,9 @@ describe('contextual shortcut resolution', () => {
it('uses platform-normalized display parts for configured chords and preserves bare gesture modifiers', () => {
const hotkey = applyCustomHotkeys(command, { [command.id]: [' ALT + mOd + J '] });
- expect(resolveShortcutHints([{ commandId: command.commandId }], [hotkey], context, null)[0]?.parts).toEqual([
- MOD_KEY_LABEL,
- IS_MAC_OS ? 'option' : 'alt',
- 'j',
- ]);
+ expect(resolveShortcutHints([{ commandId: command.commandId }], [hotkey], context, null)[0]?.parts).toEqual(
+ IS_MAC_OS ? ['option', 'cmd', 'j'] : ['ctrl', 'alt', 'j']
+ );
expect(resolveShortcutHints([{ labelKey: 'hold', parts: ['shift', 'alt'] }], [], context, null)[0]?.parts).toEqual([
'shift',
IS_MAC_OS ? 'option' : 'alt',
diff --git a/invokeai/frontend/webv2/src/workbench/palette/entries.test.ts b/invokeai/frontend/webv2/src/workbench/palette/entries.test.ts
index 9aeb55a491..88fae1ef97 100644
--- a/invokeai/frontend/webv2/src/workbench/palette/entries.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/palette/entries.test.ts
@@ -144,7 +144,8 @@ describe('buildCatalogCommandEntries', () => {
catalog: firstPartyHotkeyCatalog,
customHotkeys: { 'app.clearQueue': ['mod+shift+q'] },
execute,
- formatHotkey: formatHotkeyForPlatform,
+ // Pinned so the result does not depend on the machine; keys.test.ts owns the macOS order.
+ formatHotkey: (hotkey) => formatHotkeyForPlatform(hotkey, false),
presentWidgetTypeIds: new Set(),
t,
});