diff options
| author | Misko Hevery | 2011-01-13 10:35:26 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-01-14 10:30:00 -0800 | 
| commit | 347be5ae9aa6829427e1e8e1b1e58afdf2a36c0a (patch) | |
| tree | 3b350a12378c1ec63f60cce0fe674186d204726e /test/JsonSpec.js | |
| parent | 934f44f69e94a77a3ea6c19dc5c6f82ade2cc669 (diff) | |
| download | angular.js-347be5ae9aa6829427e1e8e1b1e58afdf2a36c0a.tar.bz2 | |
fixed select with ng:format
select (one/multiple) could not chose from a list of objects, since DOM requires string ids.
Solved by adding index formatter, which exposed incorrect handling of formatters in select
widgets.
Diffstat (limited to 'test/JsonSpec.js')
| -rw-r--r-- | test/JsonSpec.js | 17 | 
1 files changed, 12 insertions, 5 deletions
| diff --git a/test/JsonSpec.js b/test/JsonSpec.js index 6d8a40e4..4a160905 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -92,11 +92,11 @@ describe('json', function(){    it('should not serialize undefined values', function() {      expect(angular.toJson({A:undefined})).toEqual('{}');    }); -   +    it('should not serialize $window object', function() {      expect(toJson(window)).toEqual('WINDOW');    }); -   +    it('should not serialize $document object', function() {      expect(toJson(document)).toEqual('DOCUMENT');    }); @@ -116,6 +116,13 @@ describe('json', function(){      expect(fromJson("{exp:1.2e-10}")).toEqual({exp:1.2E-10});    }); +  it('should ignore non-strings', function(){ +    expect(fromJson([])).toEqual([]); +    expect(fromJson({})).toEqual({}); +    expect(fromJson(null)).toEqual(null); +    expect(fromJson(undefined)).toEqual(undefined); +  }); +    //run these tests only in browsers that have native JSON parser    if (JSON && JSON.parse) { @@ -187,18 +194,18 @@ describe('json', function(){        expect(function(){fromJson('[].constructor');}).          toThrow(new Error("Parse Error: Token '.' is not valid json at column 3 of expression [[].constructor] starting at [.constructor]."));      }); -     +      it('should not allow object dereference', function(){        expect(function(){fromJson('{a:1, b: $location, c:1}');}).toThrow();        expect(function(){fromJson("{a:1, b:[1]['__parent__']['location'], c:1}");}).toThrow();      }); -     +      it('should not allow assignments', function(){        expect(function(){fromJson("{a:1, b:[1]=1, c:1}");}).toThrow();        expect(function(){fromJson("{a:1, b:=1, c:1}");}).toThrow();        expect(function(){fromJson("{a:1, b:x=1, c:1}");}).toThrow();      }); -     +    });  }); | 
