Specs for concurrent opening

This commit is contained in:
Ash Wilson 2018-03-23 09:14:48 -04:00
parent 112e9f5863
commit 7c9463acea
No known key found for this signature in database
GPG Key ID: 81B1DDB704F69D2A

View File

@ -274,6 +274,21 @@ describe('Workspace', () => {
})
})
it('discovers existing editors that are still opening', () => {
let editor0 = null
let editor1 = null
waitsForPromise(() => Promise.all([
workspace.open('spartacus.txt').then(o0 => { editor0 = o0 }),
workspace.open('spartacus.txt').then(o1 => { editor1 = o1 }),
]))
runs(() => {
expect(editor0).toEqual(editor1)
expect(workspace.getActivePane().items).toEqual([editor0])
})
})
it("uses the location specified by the model's `getDefaultLocation()` method", () => {
const item = {
getDefaultLocation: jasmine.createSpy().andReturn('right'),
@ -361,6 +376,28 @@ describe('Workspace', () => {
})
})
it('discovers existing editors that are still opening in an inactive pane', () => {
let editor0 = null
let editor1 = null
const pane0 = workspace.getActivePane()
const pane1 = workspace.getActivePane().splitRight()
pane0.activate()
const promise0 = workspace.open('spartacus.txt', {searchAllPanes: true}).then(o0 => { editor0 = o0 })
pane1.activate()
const promise1 = workspace.open('spartacus.txt', {searchAllPanes: true}).then(o1 => { editor1 = o1 })
waitsForPromise(() => Promise.all([promise0, promise1]))
runs(() => {
expect(editor0).toBeDefined()
expect(editor1).toBeDefined()
expect(editor0).toEqual(editor1)
expect(workspace.getActivePane().items).toEqual([editor0])
})
})
it('activates the pane in the dock with the matching item', () => {
const dock = atom.workspace.getRightDock()
const ITEM_URI = 'atom://test'