mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-09 19:21:32 -07:00
feat(keybindings): add mouse button support for mpv keybindings (#103)
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
buildMpvKeybindingConfigValue,
|
||||
createMpvKeybindingRows,
|
||||
keyboardEventToConfigKey,
|
||||
mouseEventToConfigKey,
|
||||
} from './key-input';
|
||||
|
||||
test('keyboardEventToConfigKey formats Electron accelerators from learned input', () => {
|
||||
@@ -75,6 +76,23 @@ test('keyboardEventToConfigKey formats mpv key bindings from learned input', ()
|
||||
);
|
||||
});
|
||||
|
||||
test('mouseEventToConfigKey formats mpv mouse buttons from learned input', () => {
|
||||
assert.equal(
|
||||
mouseEventToConfigKey(
|
||||
{ button: 3, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false },
|
||||
'dom-code',
|
||||
),
|
||||
'MBTN_BACK',
|
||||
);
|
||||
assert.equal(
|
||||
mouseEventToConfigKey(
|
||||
{ button: 4, ctrlKey: false, altKey: true, shiftKey: true, metaKey: false },
|
||||
'dom-code',
|
||||
),
|
||||
'Alt+Shift+MBTN_FORWARD',
|
||||
);
|
||||
});
|
||||
|
||||
test('MPV keybinding rows save default key moves as a disable plus replacement', () => {
|
||||
const defaults: Keybinding[] = [{ key: 'Space', command: ['cycle', 'pause'] }];
|
||||
const rows = createMpvKeybindingRows(defaults, []);
|
||||
|
||||
Reference in New Issue
Block a user