mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Add ControllerService to angular-mocks (#8889)
* Add ControllerService to angular-mocks
The definition in angular.d.ts changed that used to included this definition.
Needed because of 69d2fb9
* Added unit tests for controller service mock
This commit is contained in:
committed by
Masahiro Wakame
parent
3e03f67efe
commit
0ea6c46516
@@ -87,6 +87,15 @@ logCall = logService.warn;
|
||||
|
||||
logs = logCall.logs;
|
||||
|
||||
///////////////////////////////////////
|
||||
// ControllerService mock
|
||||
///////////////////////////////////////
|
||||
var $controller: ng.IControllerService;
|
||||
$controller(class TestController {}, {}, {myBinding: 'works!'});
|
||||
$controller(function TestController() {}, {someLocal: 42}, {myBinding: 'works!'});
|
||||
$controller('TestController', {}, {myBinding: 'works!'});
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IComponentControllerService
|
||||
///////////////////////////////////////
|
||||
|
||||
Vendored
+12
@@ -97,6 +97,18 @@ declare namespace angular {
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ControllerService mock
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$controller
|
||||
// This interface extends http://docs.angularjs.org/api/ng.$controller
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IControllerService {
|
||||
// Although the documentation doesn't state this, locals are optional
|
||||
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
|
||||
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
|
||||
<T>(controllerName: string, locals?: any, bindings?: any): T;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ComponentControllerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$componentController
|
||||
|
||||
Reference in New Issue
Block a user