diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee index 30abc6da4..7b8656a70 100644 --- a/spec/app/root-view-spec.coffee +++ b/spec/app/root-view-spec.coffee @@ -30,6 +30,7 @@ describe "RootView", -> it "creates a project for the directory and sets the document.title, but does not open an editor", -> path = require.resolve 'fixtures/dir/' rootView = new RootView(pathToOpen: path) + rootView.focus() expect(rootView.project.path).toBe path expect(rootView.editors().length).toBe 0 @@ -390,3 +391,7 @@ describe "RootView", -> editor1.buffer.setPath("should-not-be-title.txt") expect(document.title).toBe "second.txt" + describe "when the last editor is removed", -> + it "updates the title to the project path", -> + rootView.editors()[0].remove() + expect(document.title).toBe rootView.project.path diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index dc96b9aff..80828708d 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -31,6 +31,8 @@ class RootView extends View if @editors().length @activeEditor().focus() false + else + @setTitle(@project?.path) @commandPanel = new CommandPanel({rootView: this}) @@ -42,8 +44,6 @@ class RootView extends View else if not panesViewState? @activeEditor().setBuffer(new Buffer) - @setTitle(@project?.path) - @deserializePanes(panesViewState) if panesViewState serialize: ->