mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-16 04:46:07 -08:00
Controller: hold to show the secondary subtitle, dictionary entry navigation, standard button names (#312)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af44735bb8
commit
655510cf2e
24 files changed
+609
-33
No files matched your search
@@ -16,6 +16,7 @@ type CommandEventDetail = {
|
||||
visible?: boolean;
|
||||
key?: string;
|
||||
code?: string;
|
||||
modifiers?: string[];
|
||||
repeat?: boolean;
|
||||
direction?: number;
|
||||
deltaX?: number;
|
||||
@@ -2525,3 +2526,31 @@ test('an unfinished built-in y chord cannot start a configured sequence', async
|
||||
testGlobals.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('controller popup entry navigation forwards Alt+Up / Alt+Down only while the popup is open', async () => {
|
||||
const { ctx, handlers, testGlobals } = createKeyboardHandlerHarness();
|
||||
|
||||
try {
|
||||
assert.equal(handlers.movePopupEntryForController(1), false);
|
||||
assert.equal(
|
||||
testGlobals.commandEvents.some((event) => event.type === 'forwardKeyDown'),
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.state.yomitanPopupVisible = true;
|
||||
testGlobals.setPopupVisible(true);
|
||||
|
||||
assert.equal(handlers.movePopupEntryForController(1), true);
|
||||
assert.equal(handlers.movePopupEntryForController(-1), true);
|
||||
|
||||
const forwarded = testGlobals.commandEvents
|
||||
.filter((event) => event.type === 'forwardKeyDown')
|
||||
.map((event) => [event.key, event.code, event.modifiers]);
|
||||
assert.deepEqual(forwarded, [
|
||||
['ArrowDown', 'ArrowDown', ['alt']],
|
||||
['ArrowUp', 'ArrowUp', ['alt']],
|
||||
]);
|
||||
} finally {
|
||||
testGlobals.restore();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user