1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

controller and action property

This commit is contained in:
kbparagua 2016-03-25 13:28:03 +08:00
parent 6d9e22e85f
commit b13d65e514
2 changed files with 16 additions and 3 deletions

View file

@ -31,7 +31,7 @@ describe('Paloma.ControllerBuilder', function(){
expect(controller instanceof TestController).toBeTruthy(); expect(controller instanceof TestController).toBeTruthy();
}); });
it("initializes controller instance's params", function(){ it("initializes controller instance's params property", function(){
var expectedParams = {a: 1, b: 2}; var expectedParams = {a: 1, b: 2};
var correct = true; var correct = true;
@ -43,6 +43,14 @@ describe('Paloma.ControllerBuilder', function(){
expect(correct).toBeTruthy(); expect(correct).toBeTruthy();
}); });
it("initializes controller instance's controller property", function(){
expect(controller.controller).toEqual('Test');
});
it("initializes controller instance's action property", function(){
expect(controller.action).toEqual('show');
});
}); });
}); });

View file

@ -11,7 +11,12 @@ Paloma.ControllerBuilder.prototype = {
var ControllerClass = this._controllerClass(); var ControllerClass = this._controllerClass();
if ( !ControllerClass ) return null; if ( !ControllerClass ) return null;
return new ControllerClass( this._buildParams() ); var controller = new ControllerClass( this._buildParams() );
controller.controller = this.options.controller;
controller.action = this.options.action;
return controller;
}, },
_controllerClass: function(){ _controllerClass: function(){