mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Remove pane when its last item is removed
This commit is contained in:
committed by
probablycorey
parent
7d147dd2ce
commit
11a702a2a6
@@ -69,6 +69,10 @@ describe "Pane", ->
|
||||
expect(pane.getItems()).toEqual [editSession1, view2]
|
||||
expect(pane.currentItem).toBe editSession1
|
||||
|
||||
it "removes the pane when its last item is removed", ->
|
||||
pane.removeItem(item) for item in pane.getItems()
|
||||
expect(pane.hasParent()).toBeFalsy()
|
||||
|
||||
describe "when the item is a view", ->
|
||||
it "removes the item from the 'item-views' div", ->
|
||||
expect(view1.parent()).toMatchSelector pane.itemViews
|
||||
|
||||
@@ -70,6 +70,7 @@ class Pane extends View
|
||||
_.remove(@items, item)
|
||||
item.destroy?()
|
||||
@cleanupItemView(item)
|
||||
@remove() unless @items.length
|
||||
|
||||
itemForPath: (path) ->
|
||||
_.detect @items, (item) -> item.getPath?() is path
|
||||
|
||||
Reference in New Issue
Block a user