From 2c405f417125c80c387a51baece8bf6e1e0c0a81 Mon Sep 17 00:00:00 2001 From: Sudhir Jonathan Date: Tue, 27 Nov 2012 00:47:37 +0530 Subject: 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 --- test/auto/injectorSpec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/auto') diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index d2a63789..6f84897b 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -394,6 +394,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})}); -- cgit v1.2.3