diff options
| author | Misko Hevery | 2010-05-30 19:42:21 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-30 19:42:21 -0700 |
| commit | 2e33e89a77d115ff17f5841ec328b1c1e4228161 (patch) | |
| tree | 22a97d5c70f2e74ffb4dfe789c82545363abed55 /test/ScopeSpec.js | |
| parent | 1aa99c08e9ccd515a333478f00b361f40c622002 (diff) | |
| download | angular.js-2e33e89a77d115ff17f5841ec328b1c1e4228161.tar.bz2 | |
added compiled getterFN for better performance
Diffstat (limited to 'test/ScopeSpec.js')
| -rw-r--r-- | test/ScopeSpec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index a3b6d9ae..d93400e5 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -157,4 +157,25 @@ describe('scope/model', function(){ } }); }); + + describe('getterFn', function(){ + it('should get chain', function(){ + expect(getterFn('a.b')(undefined)).toEqual(undefined); + expect(getterFn('a.b')({})).toEqual(undefined); + expect(getterFn('a.b')({a:null})).toEqual(undefined); + expect(getterFn('a.b')({a:{}})).toEqual(undefined); + expect(getterFn('a.b')({a:{b:null}})).toEqual(null); + expect(getterFn('a.b')({a:{b:0}})).toEqual(0); + expect(getterFn('a.b')({a:{b:'abc'}})).toEqual('abc'); + }); + + it('should map type method on top of expression', function(){ + expect(getterFn('a.$filter')({a:[]})('')).toEqual([]); + }); + + it('should bind function this', function(){ + expect(getterFn('a')({a:function($){return this.b + $;}, b:1})(2)).toEqual(3); + + }); + }); }); |
