Move another integration test

This commit is contained in:
Nathan Sobo
2016-08-11 16:33:36 -06:00
parent b89c0cb415
commit a29db76073
2 changed files with 19 additions and 15 deletions

View File

@@ -40,21 +40,6 @@ describe "Starting Atom", ->
.then ({value}) -> expect(value).toBe "Hello!"
.dispatchCommand("editor:delete-line")
describe "when there is an existing window with no project path", ->
it "reuses that window to open a directory", ->
runAtom [], {ATOM_HOME: atomHome}, (client) ->
client
.treeViewRootDirectories()
.then ({value}) -> expect(value).toEqual([])
.startAnotherAtom([tempDirPath], ATOM_HOME: atomHome)
.waitUntil(->
@treeViewRootDirectories()
.then ({value}) -> value[0] is tempDirPath
, 5000)
.then (result) -> expect(result).toBe(true)
.waitForWindowCount(1, 5000)
describe "launching with no path", ->
it "doesn't open a new window if openEmptyEditorOnStart is disabled", ->
configPath = path.join(atomHome, 'config.cson')

View File

@@ -235,6 +235,25 @@ describe('AtomApplication', function () {
assert.equal(reusedWindow, window1)
assert.deepEqual(await getTreeViewRootDirectories(window1), [tempDirPath])
})
it('opens a new window with a single untitled buffer when launched with no path, even if windows already exist', async function () {
const atomApplication = buildAtomApplication()
const window1 = atomApplication.openWithOptions(parseCommandLine([]))
await window1.loadedPromise
const window1EditorTitle = await evalInWebContents(window1.browserWindow.webContents, function (sendBackToMainProcess) {
sendBackToMainProcess(atom.workspace.getActiveTextEditor().getTitle())
})
assert.equal(window1EditorTitle, 'untitled')
const window2 = atomApplication.openWithOptions(parseCommandLine([]))
await window2.loadedPromise
const window2EditorTitle = await evalInWebContents(window1.browserWindow.webContents, function (sendBackToMainProcess) {
sendBackToMainProcess(atom.workspace.getActiveTextEditor().getTitle())
})
assert.equal(window2EditorTitle, 'untitled')
assert.deepEqual(atomApplication.windows, [window1, window2])
})
})
function buildAtomApplication () {