mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Address comments + add tests
This commit is contained in:
@@ -31,6 +31,12 @@ describe "DefaultDirectoryProvider", ->
|
||||
directory = provider.directoryForURISync(file)
|
||||
expect(directory.getPath()).toEqual tmp
|
||||
|
||||
it "creates a Directory with a path as a uri when passed a uri", ->
|
||||
provider = new DefaultDirectoryProvider()
|
||||
uri = 'remote://server:6792/path/to/a/dir'
|
||||
directory = provider.directoryForURISync(uri)
|
||||
expect(directory.getPath()).toEqual uri
|
||||
|
||||
describe ".directoryForURI(uri)", ->
|
||||
it "returns a Promise that resolves to a Directory with a path that matches the uri", ->
|
||||
provider = new DefaultDirectoryProvider()
|
||||
|
||||
@@ -293,3 +293,14 @@ describe "Window", ->
|
||||
pathToOpen = __dirname
|
||||
atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}]
|
||||
expect(atom.workspace.open.callCount).toBe 0
|
||||
|
||||
describe "when the opened path is a uri", ->
|
||||
it "adds it to the project's paths as is", ->
|
||||
pathToOpen = 'remote://server:7644/some/dir/path'
|
||||
atom.getCurrentWindow().send 'message', 'open-locations', [{pathToOpen}]
|
||||
|
||||
waitsFor ->
|
||||
atom.project.getPaths().length is 1
|
||||
|
||||
runs ->
|
||||
expect(atom.project.getPaths()[0]).toBe pathToOpen
|
||||
|
||||
@@ -522,9 +522,8 @@ class AtomApplication
|
||||
new AtomWindow({bootstrapScript, @resourcePath, exitWhenDone, isSpec, specDirectory, devMode})
|
||||
|
||||
locationForPathToOpen: (pathToOpen) ->
|
||||
{protocol} = url.parse(pathToOpen)
|
||||
return {pathToOpen} if protocol?
|
||||
return {pathToOpen} unless pathToOpen
|
||||
return {pathToOpen} if url.parse(pathToOpen).protocol?
|
||||
return {pathToOpen} if fs.existsSync(pathToOpen)
|
||||
|
||||
pathToOpen = pathToOpen.replace(/[:\s]+$/, '')
|
||||
|
||||
@@ -24,9 +24,9 @@ class DefaultDirectoryProvider
|
||||
|
||||
# TODO: Stop normalizing the path in pathwatcher's Directory.
|
||||
directory = new Directory(directoryPath)
|
||||
if (url.parse(directoryPath).protocol)
|
||||
if url.parse(directoryPath).protocol
|
||||
directory.path = directoryPath
|
||||
if (fs.isCaseInsensitive())
|
||||
if fs.isCaseInsensitive()
|
||||
directory.lowerCasePath = directoryPath.toLowerCase()
|
||||
directory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user