mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add spec for Pane::destroyItems to pane-spec
This commit is contained in:
@@ -107,6 +107,17 @@ describe "Pane", ->
|
||||
pane.destroyItem(item) for item in pane.getItems()
|
||||
expect(pane.isDestroyed()).toBe true
|
||||
|
||||
describe "::destroyItems()", ->
|
||||
it "destroys all items and the pane", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
|
||||
[item1, item2, item3] = pane.items
|
||||
pane.destroyItems()
|
||||
expect(item1.isDestroyed()).toBe true
|
||||
expect(item2.isDestroyed()).toBe true
|
||||
expect(item3.isDestroyed()).toBe true
|
||||
expect(pane.isDestroyed()).toBe true
|
||||
expect(pane.items).toEqual []
|
||||
|
||||
describe "when an item emits a destroyed event", ->
|
||||
it "removes it from the list of items", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
|
||||
|
||||
@@ -138,14 +138,6 @@ describe "PaneView", ->
|
||||
paneModel2.activateItemAtIndex(1)
|
||||
expect(view1.data('preservative')).toBe 1234
|
||||
|
||||
describe "pane:close", ->
|
||||
it "destroys all items and removes the pane", ->
|
||||
pane.activateItem(editor1)
|
||||
pane.trigger 'pane:close'
|
||||
expect(pane.hasParent()).toBeFalsy()
|
||||
expect(editor2.isDestroyed()).toBe true
|
||||
expect(editor1.isDestroyed()).toBe true
|
||||
|
||||
describe "pane:close-other-items", ->
|
||||
it "destroys all items except the current", ->
|
||||
pane.activateItem(editor1)
|
||||
|
||||
Reference in New Issue
Block a user