mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Destroy remaining items when a pane is destroyed
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user