Add Pane.getNextPane

This commit is contained in:
Corey Johnson & Nathan Sobo 2013-03-07 12:21:20 -08:00
parent ff50bc2e6f
commit d84614866a
2 changed files with 14 additions and 0 deletions

View File

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

View File

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