mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Add Pane.itemForPath
This commit is contained in:
parent
c6729e9df1
commit
829bfa0a10
@ -101,3 +101,8 @@ describe "Pane", ->
|
||||
pane.remove()
|
||||
expect(editSession1.destroyed).toBeTruthy()
|
||||
expect(editSession2.destroyed).toBeTruthy()
|
||||
|
||||
describe ".itemForPath(path)", ->
|
||||
it "returns the item for which a call to .getPath() returns the given path", ->
|
||||
expect(pane.itemForPath(editSession1.getPath())).toBe editSession1
|
||||
expect(pane.itemForPath(editSession2.getPath())).toBe editSession2
|
@ -67,6 +67,9 @@ class Pane extends View
|
||||
item.destroy?()
|
||||
@cleanupItemView(item)
|
||||
|
||||
itemForPath: (path) ->
|
||||
_.detect @items, (item) -> item.getPath?() is path
|
||||
|
||||
cleanupItemView: (item) ->
|
||||
if item instanceof $
|
||||
item.remove()
|
||||
@ -101,7 +104,6 @@ class Pane extends View
|
||||
|
||||
verticalGridUnits: -> 1
|
||||
|
||||
|
||||
splitUp: (view) ->
|
||||
@split(view, 'column', 'before')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user