💄 rename treeViewList outlet to list

This commit is contained in:
Nathan Sobo
2013-04-16 12:02:31 -06:00
parent 3c95fbd72c
commit 45ede6bc79
2 changed files with 19 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ class TreeView extends ScrollView
@content: (rootView) ->
@div class: 'tree-view-resizer', =>
@div class: 'tree-view-scroller', outlet: 'scroller', =>
@ol class: 'list-unstyled tree-view tool-panel', tabindex: -1, outlet: 'treeViewList'
@ol class: 'list-unstyled tree-view tool-panel', tabindex: -1, outlet: 'list'
@div class: 'tree-view-resize-handle', outlet: 'resizeHandle'
root: null
@@ -89,10 +89,10 @@ class TreeView extends ScrollView
rootView.focus()
focus: ->
@treeViewList.focus()
@list.focus()
hasFocus: ->
@treeViewList.is(':focus')
@list.is(':focus')
entryClicked: (e) ->
entry = $(e.currentTarget).view()
@@ -124,7 +124,7 @@ class TreeView extends ScrollView
if rootDirectory = project.getRootDirectory()
@root = new DirectoryView(directory: rootDirectory, isExpanded: true, project: project)
@treeViewList.append(@root)
@list.append(@root)
else
@root = null
@@ -160,7 +160,7 @@ class TreeView extends ScrollView
else
bestMatchEntry
@treeViewList.find(".entry").toArray().reduce(fn, @root)
@list.find(".entry").toArray().reduce(fn, @root)
selectEntryForPath: (path) ->
@selectEntry(@entryForPath(path))
@@ -187,7 +187,7 @@ class TreeView extends ScrollView
else
@selectEntry(selectedEntry.parents('.directory').first())
else
@selectEntry(@treeViewList.find('.entry').last())
@selectEntry(@list.find('.entry').last())
@scrollToEntry(@selectedEntry())
@@ -296,7 +296,7 @@ class TreeView extends ScrollView
rootView.append(dialog)
selectedEntry: ->
@treeViewList.find('.selected')?.view()
@list.find('.selected')?.view()
selectEntry: (entry) ->
return false unless entry.get(0)
@@ -306,7 +306,7 @@ class TreeView extends ScrollView
entry.addClass('selected')
deselect: ->
@treeViewList.find('.selected').removeClass('selected')
@list.find('.selected').removeClass('selected')
scrollTop: (top) ->
if top?

View File

@@ -101,11 +101,11 @@ describe "TreeView", ->
it "restores the focus state of the tree view", ->
rootView.attachToDom()
treeView.focus()
expect(treeView.treeViewList).toMatchSelector ':focus'
expect(treeView.list).toMatchSelector ':focus'
atom.deactivatePackage("tree-view")
atom.activatePackage("tree-view")
treeView = rootView.find(".tree-view").view()
expect(treeView.treeViewList).toMatchSelector ':focus'
expect(treeView.list).toMatchSelector ':focus'
it "restores the scroll top when toggled", ->
rootView.height(5)
@@ -142,14 +142,14 @@ describe "TreeView", ->
rootView.focus()
rootView.trigger 'tree-view:toggle'
expect(treeView).toBeVisible()
expect(treeView.treeViewList).toMatchSelector(':focus')
expect(treeView.list).toMatchSelector(':focus')
describe "when the tree view is hidden", ->
it "shows and focuses the tree view", ->
treeView.detach()
rootView.trigger 'tree-view:toggle'
expect(treeView.hasParent()).toBeTruthy()
expect(treeView.treeViewList).toMatchSelector(':focus')
expect(treeView.list).toMatchSelector(':focus')
describe "when tree-view:reveal-current-file is triggered on the root view", ->
beforeEach ->
@@ -184,10 +184,10 @@ describe "TreeView", ->
rootView.open() # When we trigger 'tool-panel:unfocus' below, we want an editor to become focused
rootView.attachToDom()
treeView.focus()
expect(treeView.treeViewList).toMatchSelector(':focus')
expect(treeView.list).toMatchSelector(':focus')
treeView.trigger 'tool-panel:unfocus'
expect(treeView).toBeVisible()
expect(treeView.treeViewList).not.toMatchSelector(':focus')
expect(treeView.list).not.toMatchSelector(':focus')
expect(rootView.getActiveView().isFocused).toBeTruthy()
describe "when core:close is triggered on the tree view", ->
@@ -428,7 +428,7 @@ describe "TreeView", ->
treeView.height(100)
treeView.attachToDom()
$(element).view().expand() for element in treeView.find('.directory')
expect(treeView.treeViewList.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.list.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.scrollTop()).toBe 0
@@ -452,7 +452,7 @@ describe "TreeView", ->
treeView.height(100)
treeView.attachToDom()
$(element).view().expand() for element in treeView.find('.directory')
expect(treeView.treeViewList.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.list.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.scrollTop()).toBe 0
treeView.trigger 'core:move-to-bottom'
@@ -468,7 +468,7 @@ describe "TreeView", ->
treeView.height(5)
treeView.attachToDom()
$(element).view().expand() for element in treeView.find('.directory')
expect(treeView.treeViewList.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.list.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.scrollTop()).toBe 0
treeView.scrollToBottom()
@@ -483,7 +483,7 @@ describe "TreeView", ->
treeView.height(5)
treeView.attachToDom()
$(element).view().expand() for element in treeView.find('.directory')
expect(treeView.treeViewList.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.list.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.scrollTop()).toBe 0
treeView.trigger 'core:page-down'
@@ -494,7 +494,7 @@ describe "TreeView", ->
treeView.height(100)
treeView.attachToDom()
$(element).view().expand() for element in treeView.find('.directory')
expect(treeView.treeViewList.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
expect(treeView.list.outerHeight()).toBeGreaterThan treeView.scroller.outerHeight()
treeView.moveDown()
expect(treeView.scrollTop()).toBe 0