diff --git a/spec/app/pane-spec.coffee b/spec/app/pane-spec.coffee index 3c62fc797..96f379acd 100644 --- a/spec/app/pane-spec.coffee +++ b/spec/app/pane-spec.coffee @@ -450,6 +450,14 @@ describe "Pane", -> pane.remove() expect(rootView.focus).not.toHaveBeenCalled() + describe ".getNextPane()", -> + it "returns the next pane if one exists, wrapping around from the last pane to the first", -> + pane.showItem(editSession1) + expect(pane.getNextPane()).toBeUndefined + pane2 = pane.splitRight() + expect(pane.getNextPane()).toBe pane2 + expect(pane2.getNextPane()).toBe pane + describe "when the pane is focused", -> it "focuses the active item view", -> focusHandler = jasmine.createSpy("focusHandler") diff --git a/src/app/pane.coffee b/src/app/pane.coffee index ef29ce72f..b0134f552 100644 --- a/src/app/pane.coffee +++ b/src/app/pane.coffee @@ -72,6 +72,12 @@ class Pane extends View isActive: -> @hasClass('active') + getNextPane: -> + panes = @getContainer()?.getPanes() + return unless panes.length > 1 + nextIndex = (panes.indexOf(this) + 1) % panes.length + panes[nextIndex] + getItems: -> new Array(@items...)