From 0eb88e69d7d77466eff7fda49340fac94ec2551a Mon Sep 17 00:00:00 2001 From: Bogdan Radacina Date: Thu, 7 Jan 2016 20:19:49 +1100 Subject: [PATCH 1/2] showOpenDialog returns string[] The showOpenDialog() function returns string[] as per https://github.com/atom/electron/blob/master/docs/api/dialog.md --- github-electron/github-electron.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index b1df3bccc..290bf06aa 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1157,11 +1157,11 @@ declare module GitHubElectron { browserWindow?: BrowserWindow, options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; export function showOpenDialog( options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; interface OpenDialogOptions { title?: string; From 77669f31509f704cf2e9ddc0d1df8081e6596ca6 Mon Sep 17 00:00:00 2001 From: Bogdan Radacina Date: Fri, 8 Jan 2016 08:56:45 +1100 Subject: [PATCH 2/2] Add showOpenDialog tests for both call variants --- github-electron/github-electron-main-tests.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 55588681f..fd7437a89 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -249,9 +249,21 @@ contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, () => { // dialog // https://github.com/atom/electron/blob/master/docs/api/dialog.md -console.log(dialog.showOpenDialog({ +// variant without browserWindow +var openDialogResult: string[] = dialog.showOpenDialog({ + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], properties: ['openFile', 'openDirectory', 'multiSelections'] -})); +}); + +// variant with browserWindow +openDialogResult = dialog.showOpenDialog(win, { + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], + properties: ['openFile', 'openDirectory', 'multiSelections'] +}); // global-shortcut // https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md