mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 08:38:09 -05:00
19 lines
868 B
CoffeeScript
19 lines
868 B
CoffeeScript
LevelComponent = require 'models/LevelComponent'
|
|
Patch = require 'models/Patch'
|
|
|
|
PatchModal = require 'views/editor/PatchModal'
|
|
|
|
describe 'PatchModal', ->
|
|
describe 'acceptPatch', ->
|
|
it 'triggers LevelComponents and Systems to recompile their code', ->
|
|
levelComponent = new LevelComponent({ code: 'newList = (item.prop for item in list)', id: 'id' })
|
|
levelComponent.markToRevert()
|
|
levelComponent.set('code', 'func = -> console.log()')
|
|
patch = new Patch({delta: levelComponent.getDelta(), target: 'id'})
|
|
|
|
levelComponent = new LevelComponent({ code: 'newList = (item.prop for item in list)', id: 'id' })
|
|
levelComponent.markToRevert()
|
|
patchModal = new PatchModal(patch, levelComponent)
|
|
patchModal.render()
|
|
patchModal.acceptPatch()
|
|
expect(levelComponent.get('js').indexOf('function()')).toBeGreaterThan(-1)
|