diff options
| author | Vojta Jina | 2012-03-18 23:46:30 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2012-03-18 23:46:30 -0700 | 
| commit | 192ff61f5d61899e667c6dbce4d3e6e399429d8b (patch) | |
| tree | 2f5b4cd83b05a28e444ea1bac3c6bc7e3aeefa92 /test | |
| parent | 935c1018da05dbf3124b2dd33619c4a3c82d7a2a (diff) | |
| download | angular.js-192ff61f5d61899e667c6dbce4d3e6e399429d8b.tar.bz2 | |
feat(scope.$eval): Allow passing locals to the expression
Diffstat (limited to 'test')
| -rw-r--r-- | test/service/scopeSpec.js | 11 | 
1 files changed, 11 insertions, 0 deletions
diff --git a/test/service/scopeSpec.js b/test/service/scopeSpec.js index 972584cf..35be7a2f 100644 --- a/test/service/scopeSpec.js +++ b/test/service/scopeSpec.js @@ -416,8 +416,19 @@ describe('Scope', function() {        $rootScope.$eval(function(self) {self.b=2;});        expect($rootScope.b).toEqual(2);      })); + + +    it('should allow passing locals to the expression', inject(function($rootScope) { +      expect($rootScope.$eval('a+1', {a: 2})).toBe(3); + +      $rootScope.$eval(function(scope, locals) { +        scope.c = locals.b + 4; +      }, {b: 3}); +      expect($rootScope.c).toBe(7); +    }));    }); +    describe('$evalAsync', function() {      it('should run callback before $watch', inject(function($rootScope) {  | 
