File tree 2 files changed +9
-10
lines changed 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,7 @@ module.exports = {
15
15
properties : [" openDirectory" ]
16
16
}
17
17
18
- new Promise (resolve , reject ) ->
19
- dialog .showOpenDialog props, (paths = []) ->
20
- process .nextTick ->
21
- # # return the first path since there can only ever
22
- # # be a single directory selection
23
- resolve (paths[0 ])
18
+ dialog .showOpenDialog (props)
19
+ .then ({ filePaths }) ->
20
+ return filePaths[0 ]
24
21
}
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ Windows = require("#{root}../lib/gui/windows")
7
7
describe " gui/dialog" , ->
8
8
context " .show" , ->
9
9
beforeEach ->
10
- @showOpenDialog = electron .dialog .showOpenDialog = sinon .stub ()
10
+ @showOpenDialog = electron .dialog .showOpenDialog = sinon .stub ().resolves ({
11
+ filePaths : []
12
+ })
11
13
12
14
it " calls dialog.showOpenDialog with args" , ->
13
15
dialog .show ()
@@ -16,13 +18,13 @@ describe "gui/dialog", ->
16
18
})
17
19
18
20
it " resolves with first path" , ->
19
- @showOpenDialog .yields ([" foo" , " bar" ])
21
+ @showOpenDialog .resolves ({
22
+ filePaths : [" foo" , " bar" ]
23
+ })
20
24
21
25
dialog .show ().then (ret) ->
22
26
expect (ret).to .eq (" foo" )
23
27
24
28
it " handles null paths" , ->
25
- @showOpenDialog .yields (null )
26
-
27
29
dialog .show ().then (ret) ->
28
30
expect (ret).to .eq (undefined )
You can’t perform that action at this time.
0 commit comments