aboutsummaryrefslogtreecommitdiffstats
path: root/test/JsonSpec.js
diff options
context:
space:
mode:
authorVojta Jina2010-11-05 23:04:13 +0000
committerIgor Minar2010-11-05 21:39:00 -0700
commitb7027b9d8755604799781313e9bbd8eee72fc4f4 (patch)
treec98800cee8d46dd9cfe408aaa765e956f3a058e4 /test/JsonSpec.js
parentfe8353bc5e1cf8712655e8bb959165ee660bce26 (diff)
downloadangular.js-b7027b9d8755604799781313e9bbd8eee72fc4f4.tar.bz2
Updated toJson() to not serialize window/document objects.
The reason to void these to objects is that they cause all sorts of problems like exceptions being thrown and infinite loops occuring when we iterate over object properties.
Diffstat (limited to 'test/JsonSpec.js')
-rw-r--r--test/JsonSpec.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/JsonSpec.js b/test/JsonSpec.js
index 33aae6ff..e6264293 100644
--- a/test/JsonSpec.js
+++ b/test/JsonSpec.js
@@ -92,6 +92,14 @@ 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');
+ });
it('should parse floats', function() {
expect(fromJson("{value:2.55, name:'misko'}")).toEqual({value:2.55, name:'misko'});