Allow returning file for custom protocol.
This commit is contained in:
parent
1ed77371c0
commit
244d7eaf17
4 changed files with 40 additions and 1 deletions
|
@ -13,9 +13,9 @@ describe 'protocol API', ->
|
|||
it 'calls the callback when scheme is visited', (done) ->
|
||||
protocol.registerProtocol 'test2', (url) ->
|
||||
assert.equal url, 'test2://test2'
|
||||
protocol.unregisterProtocol 'test2'
|
||||
done()
|
||||
$.get 'test2://test2', ->
|
||||
protocol.unregisterProtocol 'test2'
|
||||
|
||||
describe 'protocol.unregisterProtocol', ->
|
||||
it 'throws error when scheme does not exist', ->
|
||||
|
@ -40,3 +40,12 @@ describe 'protocol API', ->
|
|||
done()
|
||||
error: (xhr, errorType, error) ->
|
||||
assert false, 'Got error: ' + errorType + ' ' + error
|
||||
|
||||
it 'returns RequestFileJob should send file', (done) ->
|
||||
$.ajax
|
||||
url: 'atom-file-job://' + __filename
|
||||
success: (data) ->
|
||||
console.log data
|
||||
done()
|
||||
error: (xhr, errorType, error) ->
|
||||
assert false, 'Got error: ' + errorType + ' ' + error
|
||||
|
|
|
@ -45,6 +45,10 @@ app.on('will-finish-launching', function() {
|
|||
protocol.registerProtocol('atom-string-job', function(url) {
|
||||
return new protocol.RequestStringJob({mimeType: 'text/html', data: url});
|
||||
});
|
||||
|
||||
protocol.registerProtocol('atom-file-job', function(url) {
|
||||
return new protocol.RequestFileJob(url.substr(16));
|
||||
});
|
||||
});
|
||||
|
||||
app.on('finish-launching', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue