Merge branch 'master' into canary

This commit is contained in:
CHaBou 2017-09-20 01:39:55 +02:00
commit d3cd9aee00
No known key found for this signature in database
GPG key ID: EF8D073B729A0B33
7 changed files with 84 additions and 5 deletions

View file

@ -0,0 +1,34 @@
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);
});

View file

@ -0,0 +1,16 @@
import test from 'ava';
import normalize from '../../app/utils/keymaps/normalize';
test(`is normalizing keymaps correctly`, t => {
const notNormalized = 'cmd+alt+o';
const normalized = 'alt+cmd+o';
t.is(normalize(notNormalized), normalized);
});
test(`is normalizing localized keymaps correctly`, t => {
const notNormalized = 'cmd+alt+ç';
const normalized = 'alt+ç+cmd';
t.is(normalize(notNormalized), normalized);
});