From c16d84527dac0c2858b2eb5685bab2399fb1e72e Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Oct 2014 17:48:06 -0700 Subject: [PATCH] fix specs related to title --- spec/workspace-spec.coffee | 12 ++++++------ spec/workspace-view-spec.coffee | 4 ++-- src/config.coffee | 4 ++-- src/workspace.coffee | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e35a09ec3..5230fe966 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -376,7 +376,7 @@ describe "Workspace", -> describe "when the project has no path", -> it "sets the title to 'untitled'", -> atom.project.setPath(undefined) - expect(document.title).toBe 'untitled' + expect(document.title).toBe 'untitled - Atom' describe "when the project has a path", -> beforeEach -> @@ -386,25 +386,25 @@ describe "Workspace", -> describe "when there is an active pane item", -> it "sets the title to the pane item's title plus the project path", -> item = atom.workspace.getActivePaneItem() - expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]} - Atom" describe "when the title of the active pane item changes", -> it "updates the window title based on the item's new title", -> editor = atom.workspace.getActivePaneItem() editor.buffer.setPath(path.join(temp.dir, 'hi')) - expect(document.title).toBe "#{editor.getTitle()} - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "#{editor.getTitle()} - #{atom.project.getPaths()[0]} - Atom" describe "when the active pane's item changes", -> it "updates the title to the new item's title plus the project path", -> atom.workspace.getActivePane().activateNextItem() item = atom.workspace.getActivePaneItem() - expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]} - Atom" describe "when the last pane item is removed", -> it "updates the title to contain the project's path", -> atom.workspace.getActivePane().destroy() expect(atom.workspace.getActivePaneItem()).toBeUndefined() - expect(document.title).toBe atom.project.getPaths()[0] + expect(document.title).toBe "#{atom.project.getPaths()[0]} - Atom" describe "when an inactive pane's item changes", -> it "does not update the title", -> @@ -422,7 +422,7 @@ describe "Workspace", -> document.title = null workspace2 = atom.workspace.testSerialization() item = atom.workspace.getActivePaneItem() - expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]} - Atom" workspace2.destroy() describe "document edited status", -> diff --git a/spec/workspace-view-spec.coffee b/spec/workspace-view-spec.coffee index f07243581..fd8750910 100644 --- a/spec/workspace-view-spec.coffee +++ b/spec/workspace-view-spec.coffee @@ -49,7 +49,7 @@ describe "WorkspaceView", -> expect(atom.workspaceView.getEditorViews().length).toBe 2 expect(atom.workspaceView.getActivePaneView()).toBe atom.workspaceView.getPaneViews()[1] - expect(document.title).toBe "untitled - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "untitled - #{atom.project.getPaths()[0]} - Atom" describe "when there are open editors", -> it "constructs the view with the same panes", -> @@ -106,7 +106,7 @@ describe "WorkspaceView", -> expect(editorView3).not.toHaveFocus() expect(editorView4).not.toHaveFocus() - expect(document.title).toBe "#{path.basename(editorView2.getEditor().getPath())} - #{atom.project.getPaths()[0]}" + expect(document.title).toBe "#{path.basename(editorView2.getEditor().getPath())} - #{atom.project.getPaths()[0]} - Atom" describe "where there are no open editors", -> it "constructs the view with no open editors", -> diff --git a/src/config.coffee b/src/config.coffee index 8e4f599b3..58cb465bd 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -686,8 +686,8 @@ class Config @watchSubscription = null save: -> - allSettings = @scopedSettingsStore.propertiesForSource('user-config') - allSettings.global = @settings + allSettings = global: @settings + allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource('user-config') CSON.writeFileSync(@configFilePath, allSettings) ### diff --git a/src/workspace.coffee b/src/workspace.coffee index 29038826e..7c072ff77 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -136,8 +136,8 @@ class Workspace extends Model # Updates the application's title and proxy icon based on whichever file is # open. updateWindowTitle: => + appName = 'Atom' if projectPath = atom.project?.getPaths()[0] - appName = 'Atom' if item = @getActivePaneItem() document.title = "#{item.getTitle?() ? 'untitled'} - #{projectPath} - #{appName}" atom.setRepresentedFilename(item.getPath?() ? projectPath)