codecombat/test/demo/views/editor/PatchesView.demo.coffee

42 lines
1 KiB
CoffeeScript
Raw Normal View History

PatchesView = require 'views/editor/patches_view'
CocoModel = require 'models/CocoModel'
class BlandModel extends CocoModel
@className: 'Bland'
@schema: {
type: 'object'
additionalProperties: false
properties:
number: {type: 'number'}
object: {type: 'object'}
string: {type: 'string'}
_id: {type: 'string'}
}
urlRoot: '/db/bland'
module.exports = ->
2014-06-30 22:16:26 -04:00
model = new BlandModel({_id: '12345', name: 'name', original: 'original'})
v = new PatchesView(model)
v.load()
2014-06-16 13:42:28 -04:00
# Respond to request for pending patches.
r = jasmine.Ajax.requests.mostRecent()
2014-06-16 13:42:28 -04:00
patches = [
{
delta: null
commitMessage: 'Demo message'
creator: '12345'
2014-06-30 22:16:26 -04:00
created: '2014-01-01T12:00:00.000Z'
2014-06-16 13:42:28 -04:00
status: 'pending'
}
]
2014-06-30 22:16:26 -04:00
r.response({status: 200, responseText: JSON.stringify patches})
2014-06-16 13:42:28 -04:00
# Respond to request for user ids -> names
r = jasmine.Ajax.requests.mostRecent()
2014-06-30 22:16:26 -04:00
names = {'12345': {name: 'Patchman'}}
r.response({status: 200, responseText: JSON.stringify names})
v.render()
v