mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Update selected entry when moving to top/bottom
This commit is contained in:
@@ -445,6 +445,14 @@ describe "TreeView", ->
|
||||
treeView.trigger 'core:move-to-top'
|
||||
expect(treeView.scrollTop()).toBe 0
|
||||
|
||||
it "selects the root entry", ->
|
||||
entryCount = treeView.find(".entry").length
|
||||
_.times entryCount, -> treeView.moveDown()
|
||||
|
||||
expect(treeView.root).not.toHaveClass 'selected'
|
||||
treeView.trigger 'core:move-to-top'
|
||||
expect(treeView.root).toHaveClass 'selected'
|
||||
|
||||
describe "core:move-to-bottom", ->
|
||||
it "scrolls to the bottom", ->
|
||||
treeView.height(100)
|
||||
@@ -456,6 +464,11 @@ describe "TreeView", ->
|
||||
treeView.trigger 'core:move-to-bottom'
|
||||
expect(treeView.scrollBottom()).toBe treeView.prop('scrollHeight')
|
||||
|
||||
it "selects the last entry", ->
|
||||
expect(treeView.root).toHaveClass 'selected'
|
||||
treeView.trigger 'core:move-to-bottom'
|
||||
expect(treeView.root.find('.entry:last')).toHaveClass 'selected'
|
||||
|
||||
describe "core:page-up", ->
|
||||
it "scrolls up a page", ->
|
||||
treeView.height(5)
|
||||
|
||||
@@ -296,3 +296,13 @@ class TreeView extends ScrollView
|
||||
@scrollBottom(bottom)
|
||||
if top < @scrollTop()
|
||||
@scrollTop(top)
|
||||
|
||||
scrollToBottom: ->
|
||||
super()
|
||||
|
||||
@selectEntry(@root.find('.entry:last')) if @root
|
||||
|
||||
scrollToTop: ->
|
||||
super()
|
||||
|
||||
@selectEntry(@root) if @root
|
||||
|
||||
Reference in New Issue
Block a user