From 2cb907a8366e3273890f5ef6174b2e3970cd1720 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 28 Mar 2012 17:20:12 -0700 Subject: fix($injector): properly infer dependencies from fn with no args Previously if there was a white-space in fn: fn( ) {} we failed to infer no args. This was originally reported by recht, but I decided to use a different fix. Closes #829 --- test/auto/injectorSpec.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/auto') diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index 16cf1524..83bd3d1f 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -160,6 +160,13 @@ describe('injector', function() { }); + it('should handle no arg functions with spaces in the arguments list', function() { + function fn( ) {} + expect(inferInjectionArgs(fn)).toEqual([]); + expect(fn.$inject).toEqual([]); + }); + + it('should handle args with both $ and _', function() { function $f_n0($a_) {} expect(inferInjectionArgs($f_n0)).toEqual(['$a_']); -- cgit v1.2.3