mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Add Pane.getNextPane
This commit is contained in:
parent
ff50bc2e6f
commit
d84614866a
@ -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")
|
||||
|
@ -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...)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user