UNPKG

1.04 kBJavaScriptView Raw
1var should = require('./init.js');
2var app;
3describe('controller', function() {
4
5 before(function(done) {
6 app = getApp();
7 app.compound.on('ready', function() {
8 done();
9 });
10 });
11
12 it('should be reusable', function(done) {
13 function Controller() {
14 }
15 var f = 14, a = 24;
16 Controller.prototype.first = function first(c) {
17 f = 41;
18 c.next();
19 };
20 Controller.prototype.second = function second(c) {
21 a = 42;
22 c.next();
23 };
24 app.compound.structure.controllers.test = Controller;
25 app.compound.controllerBridge.callControllerAction('test', 'first', {}, {}, function(err) {
26 should.not.exists(err);
27 app.compound.controllerBridge.callControllerAction('test', 'second', {}, {}, function(err) {
28 should.not.exists(err);
29 f.should.equal(41);
30 a.should.equal(42);
31 done();
32 });
33 });
34 });
35});