diff --git a/spec/app/pane-spec.coffee b/spec/app/pane-spec.coffee index a856fcc82..bb5c0b430 100644 --- a/spec/app/pane-spec.coffee +++ b/spec/app/pane-spec.coffee @@ -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 diff --git a/src/app/pane.coffee b/src/app/pane.coffee index 2cf3f7ef5..3f6a8c2ba 100644 --- a/src/app/pane.coffee +++ b/src/app/pane.coffee @@ -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