aboutsummaryrefslogtreecommitdiffstats
path: root/test/directivesSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-08-02 13:29:12 -0700
committerIgor Minar2011-10-11 10:53:04 -0700
commit25a62b58db31c212c330d1bd7ce58bdd031e114a (patch)
tree9a332f36491740dabeabda1c8fa3062c62076ce8 /test/directivesSpec.js
parent97e3ec4d1b58a253d61c15239002265b33c30a13 (diff)
downloadangular.js-25a62b58db31c212c330d1bd7ce58bdd031e114a.tar.bz2
refactor(injection) infer injection args in ng:controller only
Because only controllers don't have currying, we can infer its arguments, all other APIs needing currying, automatic inference complicates the matters unecessary.
Diffstat (limited to 'test/directivesSpec.js')
-rw-r--r--test/directivesSpec.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index 6dbbfe9d..c925bdb5 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -469,17 +469,21 @@ describe("directive", function() {
expect(scope.$element.text()).toEqual('hey dude!');
});
+ it('should infer injection arguments', function(){
+ temp.MyController = function($xhr){
+ this.$root.someService = $xhr;
+ };
+ var scope = compile('<div ng:controller="temp.MyController"></div>');
+ expect(scope.someService).toBe(scope.$service('$xhr'));
+ });
});
describe('ng:cloak', function() {
it('should get removed when an element is compiled', function() {
var element = jqLite('<div ng:cloak></div>');
-
expect(element.attr('ng:cloak')).toBe('');
-
angular.compile(element);
-
expect(element.attr('ng:cloak')).toBeUndefined();
});