From 08e5c42f0cf343d02cd06d5d64ce6fa59cdb4e7d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 16 Oct 2013 12:04:14 -0700 Subject: [PATCH] Explicitly make pane active Previously it relied on focus firing an event which will not occur when not on the DOM. --- spec/pane-container-spec.coffee | 3 --- src/pane-container.coffee | 3 ++- src/pane.coffee | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/pane-container-spec.coffee b/spec/pane-container-spec.coffee index 5d7a426c5..4a773e6c7 100644 --- a/spec/pane-container-spec.coffee +++ b/spec/pane-container-spec.coffee @@ -87,9 +87,6 @@ describe "PaneContainer", -> expect(panes).toEqual [] describe ".reopenItem()", -> - beforeEach -> - pane3.makeActive() - describe "when there is an active pane", -> it "reconstructs and shows the last-closed pane item", -> expect(container.getActivePane()).toBe pane3 diff --git a/src/pane-container.coffee b/src/pane-container.coffee index 5564d34bd..62ea8eede 100644 --- a/src/pane-container.coffee +++ b/src/pane-container.coffee @@ -113,7 +113,8 @@ class PaneContainer extends View @empty() if root? @append(root) - @itemAdded(root.activeItem) if root.activeItem + @itemAdded(root.activeItem) if root.activeItem? + root.makeActive?() @state.set(root: root?.getState()) removeChild: (child) -> diff --git a/src/pane.coffee b/src/pane.coffee index ba52b0db6..a54ba4764 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -412,6 +412,7 @@ class Pane extends View when 'before' then parent.insertChildBefore(this, newPane) when 'after' then parent.insertChildAfter(this, newPane) @getContainer().adjustPaneDimensions() + newPane.makeActive() newPane.focus() newPane