mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
Added overload to angular.mock.inject function to allow array-style dependency injection, which the function supports. Added test excercising the overload.
This commit is contained in:
@@ -21,6 +21,15 @@ mock.inject(
|
||||
function () { return 2; }
|
||||
);
|
||||
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope) { return 1; }]);
|
||||
|
||||
// This overload is not documented on the website, but flows from
|
||||
// how the injector works.
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope) { return 1; }],
|
||||
['$rootScope', function ($rootScope) { return 2; }]);
|
||||
|
||||
mock.module('module1', 'module2');
|
||||
mock.module(
|
||||
function () { return 1; },
|
||||
|
||||
1
angularjs/angular-mocks.d.ts
vendored
1
angularjs/angular-mocks.d.ts
vendored
@@ -30,6 +30,7 @@ declare module ng {
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.inject
|
||||
inject(...fns: Function[]): any;
|
||||
inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.module
|
||||
module(...modules: string[]): any;
|
||||
|
||||
Reference in New Issue
Block a user