Skip to content

Commit

Permalink
Merge pull request #460 from buttercup/import-menu-fix
Browse files Browse the repository at this point in the history
Import menu fix
  • Loading branch information
sallar authored Dec 17, 2017
2 parents ff7a585 + 91b098e commit 3cc8fe8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
matrix:
include:
- language: node_js
sudo: required
#sudo: required
node_js: 8
env:
- NAME="Node 8"
install:
- sudo apt-get install build-essential g++ make -y
#- sudo apt-get install build-essential g++ make -y
- npm cache verify
- npm install
before_script:
Expand Down
3 changes: 2 additions & 1 deletion locales/en/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"import": {
"import": "Import",
"import-from-type": "From {{name}} archive (.{{extension}})",
"import-to-type": "To {{name}}"
"import-to-type": "To {{name}}",
"no-available-archives": "No available archives to import to."
},
"close": "Close"
},
Expand Down
3 changes: 2 additions & 1 deletion locales/fa/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"import": {
"import": "درون ریزی",
"import-from-type": "از آرشیو {{name}} (.{{extension}})",
"import-to-type": "به {{name}}"
"import-to-type": "به {{name}}",
"no-available-archives": "هیچ آرشیوی برای درون‌ریزی وجود ندارد."
},
"close": "بستن"
},
Expand Down
32 changes: 23 additions & 9 deletions src/main/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,29 @@ export const setupMenu = store => {
name: type.name,
extension: type.extension
}),
submenu: archives.map(archive => ({
label: label('archive.import.import-to-type', {
name: archive.name,
extension: type.extension
}),
enabled: archive.status === 'unlocked',
click: (item, focusedWindow) =>
openFileForImporting(focusedWindow, typeKey, archive.id)
}))
submenu:
archives.length > 0
? archives.map(archive => ({
label: label('archive.import.import-to-type', {
name: archive.name,
extension: type.extension
}),
enabled: archive.status === 'unlocked',
click: (item, focusedWindow) =>
openFileForImporting(
focusedWindow,
typeKey,
archive.id
)
}))
: [
{
label: label(
'archive.import.no-available-archives'
),
enabled: false
}
]
}))
};
}
Expand Down
14 changes: 7 additions & 7 deletions test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ let inputs;
test.before(async t => {
app = new Application({
path: require('electron'),
args: [path.join(__dirname, '../app')],
host: 'localhost',
port: 4444
args: [path.join(__dirname, '../app')]
});

await app.start();
await app.client.waitUntilWindowLoaded();
});

test.after(async t => {
await app.stop();
if (app && app.isRunning()) {
await app.stop();
}
});

const payload = {
Expand All @@ -33,7 +33,7 @@ const payload = {
isNew: true
};

test(async t => {
test('check if window is loaded and visible', async t => {
const win = app.browserWindow;
t.is(await app.client.getWindowCount(), 1);
t.false(await win.isMinimized());
Expand All @@ -58,13 +58,13 @@ test('test input focus', async t => {
await app.client.keys('Enter');

// wait for field change
await sleep(1000);
await sleep(2000);

await app.client.setValue('input[type="password"]', '1');
await app.client.keys('Enter');

// wait for login
await sleep(3500);
await sleep(5000);

// click add entry
buttons = await app.client.elements('button');
Expand Down

0 comments on commit 3cc8fe8

Please sign in to comment.