mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
A buffer with no path sets document.title to 'untitled'
This commit is contained in:
@@ -366,3 +366,8 @@ describe "RootView", ->
|
||||
|
||||
editor1.buffer.setPath("should-not-be-title.txt")
|
||||
expect(document.title).toBe "second.txt"
|
||||
|
||||
it "sets title to 'untitled' when buffer's path is null", ->
|
||||
editor = rootView.activeEditor()
|
||||
editor.setBuffer(new Buffer())
|
||||
expect(document.title).toBe "untitled"
|
||||
@@ -51,11 +51,10 @@ class RootView extends View
|
||||
_.remove(@editors, editor)
|
||||
@editors.push(editor)
|
||||
|
||||
@setTitleToActiveEditorPath()
|
||||
@setTitle(editor.buffer.path)
|
||||
|
||||
editor.on 'buffer-path-change.root-view', (event) =>
|
||||
e = $(event.target).view()
|
||||
@setTitleToActiveEditorPath()
|
||||
e.off '.root-view' for e in @editors
|
||||
editor.on 'buffer-path-change.root-view', => @setTitle(editor.buffer.path)
|
||||
|
||||
editorRemoved: (editor) ->
|
||||
if @panes.containsElement
|
||||
@@ -66,8 +65,8 @@ class RootView extends View
|
||||
else
|
||||
window.close()
|
||||
|
||||
setTitleToActiveEditorPath: ->
|
||||
document.title = @activeEditor().buffer.path
|
||||
setTitle: (title='untitled') ->
|
||||
document.title = title
|
||||
|
||||
activeEditor: ->
|
||||
if @editors.length
|
||||
|
||||
Reference in New Issue
Block a user