Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
✨ Add same item decoration in fuzzy-finder as in tree-view
Browse files Browse the repository at this point in the history
By adding the same data-attributes in the fuzzy-finder items as in
tree-view items the same css can apply immediately.

![Screenshot](http://i.imgur.com/e7ugyiK.png)
  • Loading branch information
abe33 committed May 27, 2014
1 parent 2e87d80 commit 138453a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/fuzzy-finder-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class FuzzyFinderView extends SelectListView
else
typeClass = 'icon-file-text'

@div path.basename(filePath), class: "primary-line file icon #{typeClass}"
fileBasename = path.basename(filePath)

@div fileBasename, class: "primary-line file icon #{typeClass}", 'data-name': fileBasename, 'data-path': projectRelativePath
@div projectRelativePath, class: 'secondary-line path no-icon'

openPath: (filePath, lineNumber) ->
Expand Down
8 changes: 7 additions & 1 deletion spec/fuzzy-finder-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ describe 'FuzzyFinder', ->
expect(projectView.list.children('li').length).toBe paths.length
for filePath in paths
expect(projectView.list.find("li:contains(#{path.basename(filePath)})")).toExist()
expect(projectView.list.children().first()).toHaveClass 'selected'
firstChild = projectView.list.children().first()
firstChildName = firstChild.find('div:first-child')
firstChildPath = firstChild.find('div:last-child')

expect(firstChild).toHaveClass 'selected'
expect(firstChildName).toHaveAttr('data-name', firstChildName.text())
expect(firstChildName).toHaveAttr('data-path', firstChildPath.text())
expect(projectView.find(".loading")).not.toBeVisible()

it "only creates a single path loader task", ->
Expand Down

0 comments on commit 138453a

Please sign in to comment.