From 80b1d89c62b71ca9b02b6156379d240fba7147a2 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 3 Mar 2015 12:34:54 -0800 Subject: [PATCH] Check getLoadSettings to decide to open initial buffer --- spec/atom-spec.coffee | 19 ++----------------- src/atom.coffee | 2 +- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index 27040bcfb..8603f008b 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -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() diff --git a/src/atom.coffee b/src/atom.coffee index a08a4b983..7f2626fa9 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -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}) ###