mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Terminate worker when all snippets have been loaded
This commit is contained in:
@@ -255,6 +255,18 @@ describe "Snippets extension", ->
|
||||
expect(console.warn).toHaveBeenCalled()
|
||||
expect(console.warn.calls.length).toBe 1
|
||||
|
||||
it "terminates the worker when loading completes", ->
|
||||
jasmine.unspy(LoadSnippetsTask.prototype, 'loadAtomSnippets')
|
||||
spyOn(Worker.prototype, 'terminate').andCallThrough()
|
||||
snippets.loaded = false
|
||||
snippets.loadAll()
|
||||
|
||||
waitsFor "all snippets to load", 5000, -> snippets.loaded
|
||||
|
||||
runs ->
|
||||
expect(Worker.prototype.terminate).toHaveBeenCalled()
|
||||
expect(Worker.prototype.terminate.calls.length).toBe 1
|
||||
|
||||
describe "Snippet body parser", ->
|
||||
it "breaks a snippet body into lines, with each line containing tab stops at the appropriate position", ->
|
||||
bodyTree = snippets.getBodyParser().parse """
|
||||
|
||||
@@ -13,6 +13,7 @@ class LoadSnippetsTask extends Task
|
||||
|
||||
loadNextPackageSnippets: ->
|
||||
unless @packages.length
|
||||
@terminate()
|
||||
@snippets.loaded = true
|
||||
return
|
||||
|
||||
|
||||
@@ -30,3 +30,6 @@ class Task
|
||||
|
||||
postMessage: (data) ->
|
||||
@worker.postMessage(data)
|
||||
|
||||
terminate: ->
|
||||
@worker.terminate()
|
||||
|
||||
Reference in New Issue
Block a user