mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 18:15:52 -05:00
20 lines
868 B
CoffeeScript
20 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)
|