diff options
| author | Igor Minar | 2010-08-13 15:14:41 -0700 |
|---|---|---|
| committer | Igor Minar | 2010-08-13 15:14:41 -0700 |
| commit | 7159b30752f63ad8a127101cbc10d7e672ae1620 (patch) | |
| tree | e49e5a6ef6394ec9453e8f89df41c1939cc4bfe9 /test | |
| parent | 84b3a1774edb1e12ba0076e32fe8928ba54a48e3 (diff) | |
| download | angular.js-7159b30752f63ad8a127101cbc10d7e672ae1620.tar.bz2 | |
Serialize only own properties to avoid infinite loops when serializing scopes (this)
Diffstat (limited to 'test')
| -rw-r--r-- | test/JsonTest.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/JsonTest.js b/test/JsonTest.js index 4afb7743..d077c0df 100644 --- a/test/JsonTest.js +++ b/test/JsonTest.js @@ -74,6 +74,13 @@ JsonTest.prototype.testItShouldPreventRecursion = function () { assertEquals('{"a":"b","recursion":RECURSION}', angular.toJson(obj)); }; +JsonTest.prototype.testItShouldSerializeOnlyOwnProperties = function() { + var parent = { p: 'p'}; + var child = { c: 'c'}; + child.__proto__ = parent; + assertEquals('{"c":"c"}', angular.toJson(child)); +} + JsonTest.prototype.testItShouldSerializeSameObjectsMultipleTimes = function () { var obj = {a:'b'}; assertEquals('{"A":{"a":"b"},"B":{"a":"b"}}', angular.toJson({A:obj, B:obj})); |
