From d0b255e57b76063a063c6acefef7f1421cce19cb Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Mon, 30 Apr 2012 09:25:45 -0700 Subject: [PATCH] Focus returns to tree view when a dialog is canceled with escape --- spec/extensions/tree-view-spec.coffee | 7 +++---- src/extensions/tree-view.coffee | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/extensions/tree-view-spec.coffee b/spec/extensions/tree-view-spec.coffee index 00727c863..14a034072 100644 --- a/spec/extensions/tree-view-spec.coffee +++ b/spec/extensions/tree-view-spec.coffee @@ -339,11 +339,11 @@ describe "TreeView", -> 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() + it "removes the dialog and focuses the tree view", -> + treeView.attachToDom() moveDialog.trigger 'tree-view:cancel' expect(moveDialog.parent()).not.toExist() - expect(rootView.activeEditor().isFocused).toBeTruthy() + expect(treeView).toMatchSelector(':focus') describe "when the move dialog's editor loses focus", -> it "removes the dialog and focuses root view", -> @@ -351,7 +351,6 @@ describe "TreeView", -> rootView.focus() expect(moveDialog.parent()).not.toExist() expect(rootView.activeEditor().isFocused).toBeTruthy() - # expect(rootView).toMatchSelector(':focus') describe "file system events", -> temporaryFilePath = null diff --git a/src/extensions/tree-view.coffee b/src/extensions/tree-view.coffee index 8ec2da739..1c021722a 100644 --- a/src/extensions/tree-view.coffee +++ b/src/extensions/tree-view.coffee @@ -180,5 +180,5 @@ class MoveDialog extends View cancel: -> @remove() - $('#root-view').focus() + $('.tree-view').focus()