diff --git a/spec/pane-model-spec.coffee b/spec/pane-model-spec.coffee index 2b9cb40bb..c036232e4 100644 --- a/spec/pane-model-spec.coffee +++ b/spec/pane-model-spec.coffee @@ -107,9 +107,15 @@ describe "PaneModel", -> [pane1, container] = [] beforeEach -> - pane1 = new PaneModel(items: ["A"]) + pane1 = new PaneModel(items: [new Model, new Model]) container = new PaneContainerModel(root: pane1) + it "destroys the pane's destroyable items", -> + [item1, item2] = pane1.items + pane1.destroy() + expect(item1.isDestroyed()).toBe true + expect(item2.isDestroyed()).toBe true + describe "if the pane's parent has more than two children", -> it "removes the pane from its parent", -> pane2 = pane1.splitRight() diff --git a/src/pane-model.coffee b/src/pane-model.coffee index 1930e93db..881fc2f48 100644 --- a/src/pane-model.coffee +++ b/src/pane-model.coffee @@ -142,6 +142,7 @@ class PaneModel extends Model # Private: Called by model superclass destroyed: -> + item.destroy?() for item in @items.slice() @parent.focusNextPane() if @focused # Public: Prompt the user to save the given item.