mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-09 23:44:24 +03:00
Add test for core URI handler window-selection logic
This commit is contained in:
parent
cbf2d24d9e
commit
db0fd527ce
@ -461,6 +461,30 @@ describe('AtomApplication', function () {
|
||||
assert.equal(reached, true);
|
||||
windows[0].close();
|
||||
})
|
||||
|
||||
it('triggers /core/open/file in the correct window', async function() {
|
||||
const dirAPath = makeTempDir('a')
|
||||
const dirBPath = makeTempDir('b')
|
||||
|
||||
const atomApplication = buildAtomApplication()
|
||||
const window1 = atomApplication.launch(parseCommandLine([path.join(dirAPath)]))
|
||||
await focusWindow(window1)
|
||||
const window2 = atomApplication.launch(parseCommandLine([path.join(dirBPath)]))
|
||||
await focusWindow(window2)
|
||||
|
||||
await new Promise(res => setTimeout(res, 2000))
|
||||
|
||||
const fileA = path.join(dirAPath, 'file-a')
|
||||
const fileB = path.join(dirBPath, 'file-b')
|
||||
|
||||
atomApplication.launch(parseCommandLine(['--uri-handler', `atom://core/open/file?filename=${fileA}`]))
|
||||
await new Promise(res => setTimeout(res, 1000))
|
||||
assert.equal(atomApplication.getLastFocusedWindow(), window1)
|
||||
|
||||
atomApplication.launch(parseCommandLine(['--uri-handler', `atom://core/open/file?filename=${fileB}`]))
|
||||
await new Promise(res => setTimeout(res, 1000))
|
||||
assert.equal(atomApplication.getLastFocusedWindow(), window2)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user