diff options
| author | Misko Hevery | 2012-05-16 22:21:08 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2012-06-01 10:57:51 -0700 | 
| commit | 4361efb03b79e71bf0cea92b94ff377ed718bad4 (patch) | |
| tree | 81acb7661c8eb0709a0765c555da74c348a7ead4 /test/auto/injectorSpec.js | |
| parent | 416a7830403a579cc57cf3a0198193790dcd0bc6 (diff) | |
| download | angular.js-4361efb03b79e71bf0cea92b94ff377ed718bad4.tar.bz2 | |
feat($injector): provide API for retrieving function annotations
Diffstat (limited to 'test/auto/injectorSpec.js')
| -rw-r--r-- | test/auto/injectorSpec.js | 27 | 
1 files changed, 16 insertions, 11 deletions
diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index 83bd3d1f..33fecac6 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -123,11 +123,11 @@ describe('injector', function() {      it('should return $inject', function() {        function fn() {}        fn.$inject = ['a']; -      expect(inferInjectionArgs(fn)).toBe(fn.$inject); -      expect(inferInjectionArgs(function() {})).toEqual([]); -      expect(inferInjectionArgs(function () {})).toEqual([]); -      expect(inferInjectionArgs(function  () {})).toEqual([]); -      expect(inferInjectionArgs(function /* */ () {})).toEqual([]); +      expect(annotate(fn)).toBe(fn.$inject); +      expect(annotate(function() {})).toEqual([]); +      expect(annotate(function () {})).toEqual([]); +      expect(annotate(function  () {})).toEqual([]); +      expect(annotate(function /* */ () {})).toEqual([]);      }); @@ -142,43 +142,48 @@ describe('injector', function() {                   */            _c,            /* {some type} */ d) { extraParans();} -      expect(inferInjectionArgs($f_n0)).toEqual(['$a', 'b_', '_c',  'd']); +      expect(annotate($f_n0)).toEqual(['$a', 'b_', '_c',  'd']);        expect($f_n0.$inject).toEqual(['$a', 'b_', '_c',  'd']);      });      it('should strip leading and trailing underscores from arg name during inference', function() {        function beforeEachFn(_foo_) { /* foo = _foo_ */ }; -      expect(inferInjectionArgs(beforeEachFn)).toEqual(['foo']); +      expect(annotate(beforeEachFn)).toEqual(['foo']);      });      it('should handle no arg functions', function() {        function $f_n0() {} -      expect(inferInjectionArgs($f_n0)).toEqual([]); +      expect(annotate($f_n0)).toEqual([]);        expect($f_n0.$inject).toEqual([]);      });      it('should handle no arg functions with spaces in the arguments list', function() {        function fn( ) {} -      expect(inferInjectionArgs(fn)).toEqual([]); +      expect(annotate(fn)).toEqual([]);        expect(fn.$inject).toEqual([]);      });      it('should handle args with both $ and _', function() {        function $f_n0($a_) {} -      expect(inferInjectionArgs($f_n0)).toEqual(['$a_']); +      expect(annotate($f_n0)).toEqual(['$a_']);        expect($f_n0.$inject).toEqual(['$a_']);      });      it('should throw on non function arg', function() {        expect(function() { -        inferInjectionArgs({}); +        annotate({});        }).toThrow();      }); + + +    it('should publish annotate API', function() { +      expect(injector.annotate).toBe(annotate); +    });    });  | 
