Fixed merge conflicts
This commit is contained in:
parent
4d7ce43755
commit
4ce99863c4
133 changed files with 74506 additions and 53064 deletions
|
|
@ -1,64 +0,0 @@
|
|||
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
|
||||
);
|
||||
});
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
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
|
||||
);
|
||||
});
|
||||
|
|
@ -14,39 +14,15 @@ test(`returns a color that's in hex`, t => {
|
|||
const hslaColor = 'hsl(15, 100%, 50%, 1)';
|
||||
const colorKeyword = 'pink';
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(hexColor)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(hexColor)));
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(rgbColor)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(rgbColor)));
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(rgbaColor)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(rgbaColor)));
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(hslColor)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(hslColor)));
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(hslaColor)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(hslaColor)));
|
||||
|
||||
t.true(
|
||||
isHexColor(
|
||||
toElectronBackgroundColor(colorKeyword)
|
||||
)
|
||||
);
|
||||
t.true(isHexColor(toElectronBackgroundColor(colorKeyword)));
|
||||
});
|
||||
|
|
|
|||
88
test/unit/window-utils.test.js
Normal file
88
test/unit/window-utils.test.js
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import test from 'ava';
|
||||
const proxyquire = require('proxyquire').noCallThru();
|
||||
|
||||
test('positionIsValid() returns true when window is on only screen', t => {
|
||||
const position = [50, 50];
|
||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||
electron: {
|
||||
screen: {
|
||||
getAllDisplays: () => {
|
||||
return [
|
||||
{
|
||||
workArea: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 500,
|
||||
height: 500
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = windowUtils.positionIsValid(position);
|
||||
|
||||
t.true(result);
|
||||
});
|
||||
|
||||
test('positionIsValid() returns true when window is on second screen', t => {
|
||||
const position = [750, 50];
|
||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||
electron: {
|
||||
screen: {
|
||||
getAllDisplays: () => {
|
||||
return [
|
||||
{
|
||||
workArea: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 500,
|
||||
height: 500
|
||||
}
|
||||
},
|
||||
{
|
||||
workArea: {
|
||||
x: 500,
|
||||
y: 0,
|
||||
width: 500,
|
||||
height: 500
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = windowUtils.positionIsValid(position);
|
||||
|
||||
t.true(result);
|
||||
});
|
||||
|
||||
test('positionIsValid() returns false when position isnt valid', t => {
|
||||
const primaryDisplay = {
|
||||
workArea: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 500,
|
||||
height: 500
|
||||
}
|
||||
};
|
||||
const position = [600, 50];
|
||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||
electron: {
|
||||
screen: {
|
||||
getAllDisplays: () => {
|
||||
return [primaryDisplay];
|
||||
},
|
||||
getPrimaryDisplay: () => primaryDisplay
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = windowUtils.positionIsValid(position);
|
||||
|
||||
t.false(result);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue