codecombat/test/app/views/editor/PatchModal.spec.coffee
Scott Erickson 88252806c7 Fixed #1413.
2014-08-11 18:47:41 -07:00

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)