2017-09-17 00:43:58 -08:00
|
|
|
import test from 'ava';
|
|
|
|
|
import {findCommandByKeys} from '../../app/utils/keymaps-normalize';
|
|
|
|
|
|
|
|
|
|
const expectedCommand = 'test-command';
|
|
|
|
|
const expectedLocalizedCommand = 'test-localized-command';
|
|
|
|
|
|
|
|
|
|
const commands = {
|
|
|
|
|
'alt+p+shift': expectedCommand,
|
|
|
|
|
'ç+cmd+ctrl': expectedLocalizedCommand
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
test(`returns a command`, t => {
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('alt+shift+p', commands), expectedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('shift+p+alt', commands), expectedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('p+alt+shift', commands), expectedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('alt+shift+P', commands), expectedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('Shift+P+Alt', commands), expectedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test(`returns a localized command`, t => {
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('cmd+ctrl+ç', commands), expectedLocalizedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('ç+cmd+ctrl', commands), expectedLocalizedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('ctrl+ç+cmd', commands), expectedLocalizedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('ctrl+Ç+cmd', commands), expectedLocalizedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
|
2017-09-17 00:48:16 -08:00
|
|
|
t.is(findCommandByKeys('Cmd+Ctrl+Ç', commands), expectedLocalizedCommand);
|
2017-09-17 00:43:58 -08:00
|
|
|
});
|