aboutsummaryrefslogtreecommitdiffstats
path: root/test/JsonTest.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/JsonTest.js')
-rw-r--r--test/JsonTest.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/JsonTest.js b/test/JsonTest.js
index 1ed56da8..f6da26b5 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 = createScope();
+ var child = createScope(parent);
+ child.c = 'c';
+ expect(angular.toJson(child)).toEqual('{"c":"c"}');
+};
+
JsonTest.prototype.testItShouldSerializeSameObjectsMultipleTimes = function () {
var obj = {a:'b'};
assertEquals('{"A":{"a":"b"},"B":{"a":"b"}}', angular.toJson({A:obj, B:obj}));
@@ -82,3 +89,7 @@ JsonTest.prototype.testItShouldSerializeSameObjectsMultipleTimes = function () {
JsonTest.prototype.testItShouldNotSerializeUndefinedValues = function () {
assertEquals('{}', angular.toJson({A:undefined}));
};
+
+JsonTest.prototype.testItShouldParseFloats = function () {
+ expect(fromJson("{value:2.55, name:'misko'}")).toEqual({value:2.55, name:'misko'});
+};