mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Add path attr to DirView element
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user