diff options
| author | Misko Hevery | 2010-08-10 11:23:23 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-08-10 11:23:23 -0700 | 
| commit | 9b392eca3597fdc9dab81d88df75bef75f6e678f (patch) | |
| tree | cd103d0830eb52a315dd605ccf4ba3a436743d45 /test/ScopeSpec.js | |
| parent | 4aac29da18ea4680a928edccc28dd8edad93e593 (diff) | |
| download | angular.js-9b392eca3597fdc9dab81d88df75bef75f6e678f.tar.bz2 | |
fix bug where $eval on undefined throws error
Diffstat (limited to 'test/ScopeSpec.js')
| -rw-r--r-- | test/ScopeSpec.js | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index 6f5485e7..ea63fea4 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -21,8 +21,11 @@ describe('scope/model', function(){    });    describe('$eval', function(){ +    var model; + +    beforeEach(function(){model = createScope();}); +      it('should eval function with correct this', function(){ -      var model = createScope();        model.$eval(function(){          this.name = 'works';        }); @@ -30,18 +33,24 @@ describe('scope/model', function(){      });      it('should eval expression with correct this', function(){ -      var model = createScope();        model.$eval('name="works"');        expect(model.name).toEqual('works');      });      it('should do nothing on empty string and not update view', function(){ -      var model = createScope();        var onEval = jasmine.createSpy('onEval');        model.$onEval(onEval);        model.$eval('');        expect(onEval).wasNotCalled();      }); + +    it('should ignore none string/function', function(){ +      model.$eval(null); +      model.$eval({}); +      model.$tryEval(null); +      model.$tryEval({}); +    }); +    });    describe('$watch', function(){  | 
