Add spec for Pane::destroyItems to pane-spec

This commit is contained in:
Nathan Sobo
2014-01-14 19:31:13 -07:00
parent a6d8f588c3
commit cf6fc22c87
2 changed files with 11 additions and 8 deletions

View File

@@ -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")])

View File

@@ -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)