Check getLoadSettings to decide to open initial buffer

This commit is contained in:
Ben Ogle
2015-03-03 12:34:54 -08:00
parent 80cd20193a
commit 80b1d89c62
2 changed files with 3 additions and 18 deletions

View File

@@ -155,14 +155,8 @@ describe "the `atom` global", ->
describe "openInitialEmptyEditorIfNecessary", ->
describe "when there are no paths set", ->
oldPaths = null
beforeEach ->
oldPaths = atom.project.getPaths()
atom.project.setPaths([])
afterEach ->
atom.project.setPaths(oldPaths)
spyOn(atom, 'getLoadSettings').andReturn(initialPaths: [])
it "opens an empty buffer", ->
spyOn(atom.workspace, 'open')
@@ -180,18 +174,9 @@ describe "the `atom` global", ->
describe "when the project has a path", ->
beforeEach ->
spyOn(atom, 'getLoadSettings').andReturn(initialPaths: ['something'])
spyOn(atom.workspace, 'open')
it "does not open an empty buffer", ->
atom.openInitialEmptyEditorIfNecessary()
expect(atom.workspace.open).not.toHaveBeenCalled()
describe "when there is already a buffer open", ->
beforeEach ->
waitsForPromise ->
atom.workspace.open()
it "does not open an empty buffer", ->
spyOn(atom.workspace, 'open')
atom.openInitialEmptyEditorIfNecessary()
expect(atom.workspace.open).not.toHaveBeenCalled()

View File

@@ -632,7 +632,7 @@ class Atom extends Model
@windowEventHandler?.unsubscribe()
openInitialEmptyEditorIfNecessary: ->
if @project.getPaths().length is 0 and @workspace.getPaneItems().length is 0
if @getLoadSettings().initialPaths?.length is 0 and @workspace.getPaneItems().length is 0
@workspace.open(null, {isInitialEmptyEditor: true})
###