Focus pane after reopening it

Previously the reopened item would not have focus if it was
reopened into a newly appended pane.
This commit is contained in:
Kevin Sawicki
2013-04-08 16:52:08 -07:00
parent ae77011385
commit d1c9d0ea68
2 changed files with 6 additions and 2 deletions

View File

@@ -110,7 +110,8 @@ describe "PaneContainer", ->
expect(pane1.activeItem).toEqual item3
describe "when there is no active pane", ->
it "attaches a new pane with the reconstructed last pane item", ->
it "attaches a new pane with the reconstructed last pane item and focuses it", ->
container.attachToDom()
pane1.remove()
pane2.remove()
item3 = pane3.activeItem
@@ -120,6 +121,7 @@ describe "PaneContainer", ->
container.reopenItem()
expect(container.getActivePane().activeItem).toEqual item3
expect(container.getActivePane().activeView).toMatchSelector ':focus'
it "does not reopen an item that is already open", ->
item3 = pane3.activeItem

View File

@@ -55,7 +55,9 @@ class PaneContainer extends View
activePane.showItem(deserialize(lastItemState))
true
else
@append(new Pane(deserialize(lastItemState)))
newPane = new Pane(deserialize(lastItemState))
@append(newPane)
newPane.focus()
itemDestroyed: (item) ->
state = item.serialize?()