mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Merge pull request #1401 from rubenvereecken/test_fix
Repaired TestView by only loading js files once
This commit is contained in:
commit
ca7b8ca10a
1 changed files with 12 additions and 5 deletions
|
@ -9,6 +9,7 @@ module.exports = TestView = class TestView extends CocoView
|
|||
id: 'test-view'
|
||||
template: template
|
||||
reloadOnClose: true
|
||||
loadedFileIDs: []
|
||||
|
||||
# INITIALIZE
|
||||
|
||||
|
@ -18,13 +19,19 @@ module.exports = TestView = class TestView extends CocoView
|
|||
@loadTestingLibs()
|
||||
|
||||
loadTestingLibs: ->
|
||||
@queue = new createjs.LoadQueue()
|
||||
@queue = new createjs.LoadQueue() unless @queue
|
||||
@queue.on('complete', @scriptsLoaded, @)
|
||||
@queue.on('fileload', @onFileLoad, @)
|
||||
for f in ['jasmine', 'jasmine-html', 'boot', 'mock-ajax', 'test-app']
|
||||
@queue.loadFile({
|
||||
src: "/javascripts/#{f}.js"
|
||||
type: createjs.LoadQueue.JAVASCRIPT
|
||||
})
|
||||
if f not in @loadedFileIDs
|
||||
@queue.loadFile({
|
||||
id: f
|
||||
src: "/javascripts/#{f}.js"
|
||||
type: createjs.LoadQueue.JAVASCRIPT
|
||||
})
|
||||
|
||||
onFileLoad: (e) ->
|
||||
@loadedFileIDs.push e.item.id if e.item.id
|
||||
|
||||
scriptsLoaded: ->
|
||||
@initSpecFiles()
|
||||
|
|
Loading…
Reference in a new issue