aboutsummaryrefslogtreecommitdiffstats
path: root/test/auto
diff options
context:
space:
mode:
authorSudhir Jonathan2012-11-27 00:47:37 +0530
committerPawel Kozlowski2012-12-01 18:41:59 +0100
commit2c405f417125c80c387a51baece8bf6e1e0c0a81 (patch)
tree1344ded9874838a7a9db19c1950488129224f36a /test/auto
parent8991680d8ab632dda60cd70c780868c803c74509 (diff)
downloadangular.js-2c405f417125c80c387a51baece8bf6e1e0c0a81.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')
-rw-r--r--test/auto/injectorSpec.js14
1 files changed, 14 insertions, 0 deletions
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})});