From 7e3abe4ff3261f80e0a0e3c5603459e0a3ab0218 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 13 Apr 2012 15:22:15 -0600 Subject: [PATCH] Set document.title to the project path when the last editor is closed --- spec/app/root-view-spec.coffee | 5 +++++ src/app/root-view.coffee | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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: ->