From 2ba63e608f5524d37c68c2db808e732762793a32 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 21 Feb 2013 11:30:48 -0700 Subject: [PATCH] Don't allow core:close event to bubble out of Pane --- spec/app/pane-spec.coffee | 7 ++++++- src/app/pane.coffee | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/app/pane-spec.coffee b/spec/app/pane-spec.coffee index 3c249e749..499452b31 100644 --- a/spec/app/pane-spec.coffee +++ b/spec/app/pane-spec.coffee @@ -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 diff --git a/src/app/pane.coffee b/src/app/pane.coffee index 4b9a20357..14a1158bc 100644 --- a/src/app/pane.coffee +++ b/src/app/pane.coffee @@ -68,6 +68,7 @@ class Pane extends View removeCurrentItem: => @removeItem(@currentItem) + false removeItem: (item) -> @showNextItem() if item is @currentItem and @items.length > 1