mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Focus the root view when canceling the move dialog.
This is temporary, because we really want to focus the tree view, but less annoying for now than losing focus entirely.
This commit is contained in:
@@ -338,11 +338,20 @@ describe "TreeView", ->
|
||||
dirView.expand()
|
||||
expect(dirView.entries.children().length).toBe 0
|
||||
|
||||
describe "when 'tree-view:cancel' is triggered on the move dialog", ->
|
||||
it "removes the dialog and focuses root view", ->
|
||||
rootView.attachToDom()
|
||||
moveDialog.trigger 'tree-view:cancel'
|
||||
expect(moveDialog.parent()).not.toExist()
|
||||
expect(rootView.activeEditor().isFocused).toBeTruthy()
|
||||
|
||||
describe "when the move dialog's editor loses focus", ->
|
||||
it "removes the dialog", ->
|
||||
it "removes the dialog and focuses root view", ->
|
||||
rootView.attachToDom()
|
||||
rootView.focus()
|
||||
expect(moveDialog.parent()).not.toExist()
|
||||
expect(rootView.activeEditor().isFocused).toBeTruthy()
|
||||
# expect(rootView).toMatchSelector(':focus')
|
||||
|
||||
describe "file system events", ->
|
||||
temporaryFilePath = null
|
||||
|
||||
@@ -6,3 +6,4 @@ window.keymap.bindKeys '.tree-view'
|
||||
|
||||
window.keymap.bindKeys '.move-dialog .mini.editor'
|
||||
'enter': 'tree-view:confirm'
|
||||
'escape': 'tree-view:cancel'
|
||||
|
||||
@@ -163,8 +163,9 @@ class MoveDialog extends View
|
||||
|
||||
initialize: (@project, @path) ->
|
||||
@editor.focus()
|
||||
@editor.on 'focusout', => @remove()
|
||||
@on 'tree-view:confirm', => @confirm()
|
||||
@on 'tree-view:cancel', => @cancel()
|
||||
@editor.on 'focusout', => @remove()
|
||||
|
||||
relativePath = @project.relativize(@path)
|
||||
@editor.setText(relativePath)
|
||||
@@ -175,3 +176,9 @@ class MoveDialog extends View
|
||||
confirm: ->
|
||||
fs.move(@path, @project.resolve(@editor.getText()))
|
||||
@remove()
|
||||
$('#root-view').focus()
|
||||
|
||||
cancel: ->
|
||||
@remove()
|
||||
$('#root-view').focus()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user