Call PaneContainer::itemAdded from PaneContainer::reopenItem

This ensures the active item in the new root is filtered out of
the reopen stack, preventing a duplicate item from being opened.
This commit is contained in:
Kevin Sawicki
2013-08-26 13:35:39 -07:00
parent 419be22b7b
commit b22e45b8a9
2 changed files with 9 additions and 1 deletions

View File

@@ -149,6 +149,12 @@ describe "PaneContainer", ->
expect(container.reopenItem()).toBeFalsy()
expect(pane1.activeItem).toEqual item3
pane1.destroyItem(item3)
container.setRoot(new Pane(item3))
expect(container.reopenItem()).toBeFalsy()
expect(container.getActivePane().getItems().length).toBe 1
expect(container.getActivePaneItem()).toEqual item3
describe ".saveAll()", ->
it "saves all open pane items", ->
pane1.showItem(new TestView('4'))

View File

@@ -96,7 +96,9 @@ class PaneContainer extends View
setRoot: (root) ->
@empty()
@append(root) if root?
if root?
@append(root)
@itemAdded(root.activeItem) if root.activeItem
@state.set(root: root?.getState())
removeChild: (child) ->