mirror of
https://github.com/atom/atom.git
synced 2026-02-03 11:14:59 -05:00
Use "shell.openExternal(url)" to open links in external browsers.
This commit is contained in:
@@ -12,5 +12,4 @@ module.exports =
|
||||
@selector = new TextMateScopeSelector('markup.underline.link')
|
||||
|
||||
if @selector.matches(token.scopes)
|
||||
ChildProcess = require 'child_process'
|
||||
ChildProcess.spawn 'open', [token.value]
|
||||
require('shell').openExternal token.value
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
RootView = require 'root-view'
|
||||
Editor = require 'editor'
|
||||
ChildProcess = require 'child_process'
|
||||
shell = require 'shell'
|
||||
|
||||
describe "link package", ->
|
||||
[editor] = []
|
||||
@@ -17,12 +17,12 @@ describe "link package", ->
|
||||
|
||||
describe "when the cursor is on a link", ->
|
||||
it "opens the link using the 'open' command", ->
|
||||
spyOn(ChildProcess, 'spawn')
|
||||
spyOn(shell, 'openExternal')
|
||||
editor.trigger('link:open')
|
||||
expect(ChildProcess.spawn).not.toHaveBeenCalled()
|
||||
expect(shell.openExternal).not.toHaveBeenCalled()
|
||||
|
||||
editor.setCursorBufferPosition([0,5])
|
||||
editor.trigger('link:open')
|
||||
|
||||
expect(ChildProcess.spawn).toHaveBeenCalled()
|
||||
expect(ChildProcess.spawn.argsForCall[0][1][0]).toBe "http://github.com"
|
||||
expect(shell.openExternal).toHaveBeenCalled()
|
||||
expect(shell.openExternal.argsForCall[0]).toBe "http://github.com"
|
||||
|
||||
Reference in New Issue
Block a user