From a3af0d2ea5f301c46b490a4331f2b3a716cc4cec Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Mon, 16 Jun 2014 10:42:28 -0700 Subject: [PATCH] Got the PatchView demo working. --- .../demo/views/editor/PatchesView.demo.coffee | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test/demo/views/editor/PatchesView.demo.coffee b/test/demo/views/editor/PatchesView.demo.coffee index dd1c347b6..a06da6631 100644 --- a/test/demo/views/editor/PatchesView.demo.coffee +++ b/test/demo/views/editor/PatchesView.demo.coffee @@ -16,13 +16,28 @@ class BlandModel extends CocoModel module.exports = -> - model = new BlandModel({_id:'12345'}) + model = new BlandModel({_id:'12345', name:'name', original:'original'}) v = new PatchesView(model) v.load() - # doesn't quite work yet. Intercepts a mixpanel request instead + # Respond to request for pending patches. r = jasmine.Ajax.requests.mostRecent() - r.send({statusCode:200, responseText:"[]"}) + patches = [ + { + delta: null + commitMessage: 'Demo message' + creator: '12345' + created: "2014-01-01T12:00:00.000Z" + status: 'pending' + } + ] + r.response({ status:200, responseText: JSON.stringify patches }) + + # Respond to request for user ids -> names + r = jasmine.Ajax.requests.mostRecent() + names = { '12345': { name: 'Patchman' } } + r.response({ status:200, responseText: JSON.stringify names }) + v.render() v