From 25a62b58db31c212c330d1bd7ce58bdd031e114a Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 2 Aug 2011 13:29:12 -0700 Subject: 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. --- test/directivesSpec.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/directivesSpec.js') 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('
'); + expect(scope.someService).toBe(scope.$service('$xhr')); + }); }); describe('ng:cloak', function() { it('should get removed when an element is compiled', function() { var element = jqLite(''); - expect(element.attr('ng:cloak')).toBe(''); - angular.compile(element); - expect(element.attr('ng:cloak')).toBeUndefined(); }); -- cgit v1.2.3