aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
authorDi Peng2011-06-22 11:15:42 -0700
committerIgor Minar2011-06-23 08:06:24 -0700
commitbad62d87a1785f11b0df72ad597b9064517997cf (patch)
treeae170bcbc912d943c92728292fbc0c62ffa0bae2 /test/AngularSpec.js
parent65b6e4874275986607efaf66c3814f3b3a559399 (diff)
downloadangular.js-bad62d87a1785f11b0df72ad597b9064517997cf.tar.bz2
fix:scope - reintroduce support for eager services
8cad231 broke $eager services Problem is that the injector.eager function is not invoked when a new scope is created. Added a test to make sure service is eagerly instantiated. Closes #403
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index a4d617b6..983e5848 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -516,6 +516,13 @@ describe('angular', function(){
angular.service('svc2', function(svc1) { return 'svc2-' + svc1; });
expect(angular.scope().$service('svc2')).toEqual('svc2-svc1');
});
+
+ it('should eagerly instantiate a service if $eager is true', function() {
+ var log = [];
+ angular.service('svc1', function() { log.push('svc1'); }, {$eager: true});
+ angular.scope();
+ expect(log).toEqual(['svc1']);
+ });
});
describe('isDate', function() {