Add all Tool Panel append and prepend methods

This commit is contained in:
probablycorey
2014-01-03 15:32:34 -08:00
parent 5d99acd8c5
commit 9f32a24e7e
2 changed files with 30 additions and 4 deletions

View File

@@ -111,7 +111,7 @@ describe "WorkspaceView", ->
it "passes focus to the first focusable element", ->
focusable1 = $$ -> @div "One", id: 'one', tabindex: -1
focusable2 = $$ -> @div "Two", id: 'two', tabindex: -1
atom.workspaceView.horizontal.append(focusable1, focusable2)
atom.workspaceView.appendToLeft(focusable1, focusable2)
expect(document.activeElement).toBe document.body
atom.workspaceView.focus()
@@ -120,7 +120,7 @@ describe "WorkspaceView", ->
describe "when there are no visible focusable elements", ->
it "surrenders focus to the body", ->
focusable = $$ -> @div "One", id: 'one', tabindex: -1
atom.workspaceView.horizontal.append(focusable)
atom.workspaceView.appendToLeft(focusable)
focusable.hide()
expect(document.activeElement).toBe document.body

View File

@@ -272,12 +272,38 @@ class WorkspaceView extends View
getOpenBufferPaths: ->
_.uniq(_.flatten(@getEditorViews().map (editorView) -> editorView.getOpenBufferPaths()))
prependToBottom: (element)->
# Public: Prepends the element to the top of the window.
prependToTop: (element) ->
@vertical.prepend(element)
# Public: Appends the element to the top of the window.
appendToTop: (element) ->
@panes.before(element)
# Public: Prepends the element to the bottom of the window.
prependToBottom: (element) ->
@panes.after(element)
appendToBottom: (element)->
# Public: Appends the element to bottom of the window.
appendToBottom: (element) ->
@vertical.append(element)
# Public: Prepends the element to the left side of the window.
prependToLeft: (element) ->
@horizontal.prepend(element)
# Public: Appends the element to the left side of the window.
appendToLeft: (element) ->
@vertical.before(element)
# Public: Prepends the element to the right side of the window.
prependToRight: (element) ->
@vertical.after(element)
# Public: Appends the element to the right side of the window.
appendToRight: (element) ->
@horizontal.append(element)
# Public: Returns the currently focused {Pane}.
getActivePane: ->
@panes.getActivePane()