Don't allow core:close event to bubble out of Pane

This commit is contained in:
Nathan Sobo
2013-02-21 11:30:48 -07:00
committed by probablycorey
parent 8f980a0f20
commit 2ba63e608f
2 changed files with 7 additions and 1 deletions

View File

@@ -93,11 +93,16 @@ describe "Pane", ->
expect(editSession2.destroyed).toBeTruthy()
describe "core:close", ->
it "removes the current item", ->
it "removes the current item and does not bubble the event", ->
containerCloseHandler = jasmine.createSpy("containerCloseHandler")
container.on 'core:close', containerCloseHandler
initialItemCount = pane.getItems().length
pane.trigger 'core:close'
expect(pane.getItems().length).toBe initialItemCount - 1
expect(containerCloseHandler).not.toHaveBeenCalled()
describe "pane:show-next-item and pane:show-previous-item", ->
it "advances forward/backward through the pane's items, looping around at either end", ->
expect(pane.currentItem).toBe view1

View File

@@ -68,6 +68,7 @@ class Pane extends View
removeCurrentItem: =>
@removeItem(@currentItem)
false
removeItem: (item) ->
@showNextItem() if item is @currentItem and @items.length > 1