Add path attr to DirView element

This commit is contained in:
Corey Johnson
2012-04-30 17:43:25 -07:00
parent 5a836f5aaf
commit 24ce2d362a
2 changed files with 16 additions and 2 deletions

View File

@@ -277,7 +277,7 @@ describe "TreeView", ->
expect(rootView.activeEditor()).toBeUndefined()
describe "file modification", ->
[fileElement, rootDirPath, dirPath, filePath] = []
[dirView, fileElement, rootDirPath, dirPath, filePath] = []
beforeEach ->
treeView.deactivate()
@@ -310,6 +310,20 @@ describe "TreeView", ->
treeView.trigger "tree-view:add"
addDialog = rootView.find(".add-dialog").view()
describe "when a directory is selected", ->
it "opens an add dialog with the directory's path populated", ->
treeView.trigger "tree-view:cancel"
dirView.click()
console.log 'boom'
treeView.trigger "tree-view:add"
expect(addDialog).toExist()
expect(addDialog.prompt.text()).toBeTruthy()
expect(project.relativize(dirPath)).toMatch(/[^\/]$/)
expect(addDialog.miniEditor.getText()).toBe(project.relativize(dirPath) + "/")
expect(addDialog.miniEditor.getCursorBufferPosition().column).toBe addDialog.miniEditor.getText().length
expect(addDialog.miniEditor.isFocused).toBeTruthy()
describe "when a file is selected", ->
it "opens an add dialog with the file's current directory path populated", ->
expect(addDialog).toExist()

View File

@@ -5,7 +5,7 @@ $ = require 'jquery'
module.exports =
class DirectoryView extends View
@content: ({directory, isExpanded}) ->
@li class: 'directory entry', =>
@li class: 'directory entry', path: directory.path, =>
@div class: 'header', =>
@span '', class: 'disclosure-arrow', outlet: 'disclosureArrow'
@span directory.getName(), class: 'name'