diff options
| author | Sudhir Jonathan | 2012-11-27 00:47:37 +0530 |
|---|---|---|
| committer | Pawel Kozlowski | 2012-12-01 19:09:36 +0100 |
| commit | cf89e8653cd796308d87d75fa9dd1601227fadec (patch) | |
| tree | e07a35bb12921a8414e772e45961f96958a2423a /test/auto/injectorSpec.js | |
| parent | 0c3500f532c1c2d7fb455206822c8a42561c962c (diff) | |
| download | angular.js-cf89e8653cd796308d87d75fa9dd1601227fadec.tar.bz2 | |
fix($injector): provider can now be defined in the array format
`injector.instantiate` is now called for arrays too, instead of only for functions.
Closes #1452
Diffstat (limited to 'test/auto/injectorSpec.js')
| -rw-r--r-- | test/auto/injectorSpec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index 7e5c5d33..2f82d3b5 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -387,6 +387,20 @@ describe('injector', function() { }); + it('should configure $provide using an array', function() { + function Type(PREFIX) { + this.prefix = PREFIX; + }; + Type.prototype.$get = function() { + return this.prefix + 'def'; + }; + expect(createInjector([function($provide) { + $provide.constant('PREFIX', 'abc'); + $provide.provider('value', ['PREFIX', Type]); + }]).get('value')).toEqual('abcdef'); + }); + + it('should configure a set of providers', function() { expect(createInjector([function($provide) { $provide.provider({value: valueFn({$get:Array})}); |
