diff options
| author | Greg Thornton | 2013-06-23 14:04:59 -0500 |
|---|---|---|
| committer | Pawel Kozlowski | 2013-07-12 20:49:50 +0200 |
| commit | 332a3c7984229a7e3a9a8a277f92942299616fdb (patch) | |
| tree | 518ca551b70d579255d6126c2a1bfb1916992684 /test/AngularSpec.js | |
| parent | fcd761b9d7c3c91673efce9b980ac5e7973adf3d (diff) | |
| download | angular.js-332a3c7984229a7e3a9a8a277f92942299616fdb.tar.bz2 | |
feat(Angular.js): skip JSON.stringify for undefined
Return early in `angular.toJson` if the object to be stringified is `undefined`.
IE8 stringifies `undefined` to `'undefined'` whereas other browsers return
`undefined`. This normalizes behavior and passes currently broken unit tests
in IE8.
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index febc0226..8e4fbb1a 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -879,5 +879,9 @@ describe('angular', function() { it('should not serialize scope instances', inject(function($rootScope) { expect(toJson({key: $rootScope})).toEqual('{"key":"$SCOPE"}'); })); + + it('should serialize undefined as undefined', function() { + expect(toJson(undefined)).toEqual(undefined); + }); }); }); |
