mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Fix #2195: normalizing keybindings using localeCompare to include non english keyboards as well
64 lines
1.2 KiB
JavaScript
64 lines
1.2 KiB
JavaScript
import test from 'ava';
|
|
import findCommandByKeys from '../../app/utils/keymaps/find-command-by-keys';
|
|
|
|
const expectedCommand = 'test-command';
|
|
const expectedLocalizedCommand = 'test-localized-command';
|
|
|
|
const commands = {
|
|
'alt+p+shift': expectedCommand,
|
|
'ç+cmd+ctrl': expectedLocalizedCommand
|
|
};
|
|
|
|
test(`returns a command`, t => {
|
|
t.is(
|
|
findCommandByKeys('alt+shift+p', commands),
|
|
expectedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('shift+p+alt', commands),
|
|
expectedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('p+alt+shift', commands),
|
|
expectedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('alt+shift+P', commands),
|
|
expectedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('Shift+P+Alt', commands),
|
|
expectedCommand
|
|
);
|
|
});
|
|
|
|
test(`returns a localized command`, t => {
|
|
t.is(
|
|
findCommandByKeys('cmd+ctrl+ç', commands),
|
|
expectedLocalizedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('ç+cmd+ctrl', commands),
|
|
expectedLocalizedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('ctrl+ç+cmd', commands),
|
|
expectedLocalizedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('ctrl+Ç+cmd', commands),
|
|
expectedLocalizedCommand
|
|
);
|
|
|
|
t.is(
|
|
findCommandByKeys('Cmd+Ctrl+Ç', commands),
|
|
expectedLocalizedCommand
|
|
);
|
|
});
|