mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
do not select the extension of a file path when the move dialog triggered
This commit is contained in:
@@ -391,11 +391,13 @@ describe "TreeView", ->
|
||||
treeView.trigger "tree-view:move"
|
||||
moveDialog = rootView.find(".move-dialog").view()
|
||||
|
||||
it "opens a move dialog with the file's current path populated", ->
|
||||
it "opens a move dialog with the file's current path (excluding extension) populated", ->
|
||||
extension = fs.extension(filePath)
|
||||
fileNameWithoutExtension = fs.base(filePath, extension)
|
||||
expect(moveDialog).toExist()
|
||||
expect(moveDialog.prompt.text()).toBe "Enter the new path for the file:"
|
||||
expect(moveDialog.editor.getText()).toBe(project.relativize(filePath))
|
||||
expect(moveDialog.editor.getSelectedText()).toBe fs.base(filePath)
|
||||
expect(moveDialog.editor.getSelectedText()).toBe fs.base(fileNameWithoutExtension)
|
||||
expect(moveDialog.editor.isFocused).toBeTruthy()
|
||||
|
||||
describe "when the path is changed and confirmed", ->
|
||||
|
||||
@@ -18,8 +18,10 @@ class MoveDialog extends View
|
||||
|
||||
relativePath = @project.relativize(@path)
|
||||
@editor.setText(relativePath)
|
||||
|
||||
extension = fs.extension(path)
|
||||
baseName = fs.base(path)
|
||||
range = [[0, relativePath.length - baseName.length], [0, relativePath.length]]
|
||||
range = [[0, relativePath.length - baseName.length], [0, relativePath.length - extension.length]]
|
||||
@editor.setSelectionBufferRange(range)
|
||||
|
||||
confirm: ->
|
||||
|
||||
Reference in New Issue
Block a user