mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add Pane.itemForPath
This commit is contained in:
committed by
probablycorey
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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user