mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Fix tests + add integration test
This commit is contained in:
parent
638d8cc13f
commit
e7064bfc9d
@ -227,3 +227,13 @@ describe "Starting Atom", ->
|
||||
[tempDirPath]
|
||||
[otherTempDirPath]
|
||||
].sort()
|
||||
|
||||
describe "opening a remote directory", ->
|
||||
it "opens the parent directory and creates an empty text editor", ->
|
||||
remoteDirectory = 'remote://server:3437/some/directory/path'
|
||||
runAtom [remoteDirectory], {ATOM_HOME: atomHome}, (client) ->
|
||||
client
|
||||
.waitForWindowCount(1, 1000)
|
||||
.waitForExist("atom-workspace", 5000)
|
||||
.treeViewRootDirectories()
|
||||
.then ({value}) -> expect(value).toEqual([remoteDirectory])
|
||||
|
@ -5,6 +5,7 @@ app = require 'app'
|
||||
fs = require 'fs-plus'
|
||||
path = require 'path'
|
||||
yargs = require 'yargs'
|
||||
url = require 'url'
|
||||
nslog = require 'nslog'
|
||||
|
||||
console.log = nslog
|
||||
@ -45,9 +46,11 @@ start = ->
|
||||
|
||||
cwd = args.executedFrom?.toString() or process.cwd()
|
||||
args.pathsToOpen = args.pathsToOpen.map (pathToOpen) ->
|
||||
pathToOpen = fs.normalize(pathToOpen)
|
||||
if cwd
|
||||
path.resolve(cwd, pathToOpen)
|
||||
normalizedPath = fs.normalize(pathToOpen)
|
||||
if url.parse(pathToOpen || '').protocol?
|
||||
pathToOpen
|
||||
else if cwd
|
||||
path.resolve(cwd, normalizedPath)
|
||||
else
|
||||
path.resolve(pathToOpen)
|
||||
|
||||
|
@ -15,14 +15,18 @@ class DefaultDirectoryProvider
|
||||
# * {Directory} if the given URI is compatible with this provider.
|
||||
# * `null` if the given URI is not compatibile with this provider.
|
||||
directoryForURISync: (uri) ->
|
||||
directoryPath = if not fs.isDirectorySync(uri) and fs.isDirectorySync(path.dirname(uri))
|
||||
path.normalize(path.dirname(uri))
|
||||
else
|
||||
normalizedPath = path.normalize(uri);
|
||||
{protocol} = url.parse(uri || '')
|
||||
directoryPath = if protocol?
|
||||
uri
|
||||
else if not fs.isDirectorySync(normalizedPath) and fs.isDirectorySync(path.dirname(normalizedPath))
|
||||
path.dirname(normalizedPath)
|
||||
else
|
||||
normalizedPath
|
||||
|
||||
# TODO: Stop normalizing the path in pathwatcher Directory.
|
||||
# TODO: Stop normalizing the path in pathwatcher's Directory.
|
||||
directory = new Directory(directoryPath)
|
||||
if url.parse(directoryPath).protocol?
|
||||
if protocol?
|
||||
directory.path = directoryPath
|
||||
if fs.isCaseInsensitive()
|
||||
directory.lowerCasePath = directoryPath.toLowerCase()
|
||||
|
Loading…
Reference in New Issue
Block a user