From fe8353bc5e1cf8712655e8bb959165ee660bce26 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 5 Nov 2010 22:37:55 +0000 Subject: Changed toJson() to not ignore $ properties --- test/JsonSpec.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'test/JsonSpec.js') diff --git a/test/JsonSpec.js b/test/JsonSpec.js index db658517..33aae6ff 100644 --- a/test/JsonSpec.js +++ b/test/JsonSpec.js @@ -49,10 +49,6 @@ describe('json', function(){ expect(fromJson("false")).toBeFalsy(); }); - it('should ignore $$ properties', function() { - expect(toJson({$$:0})).toEqual("{}"); - }); - it('should serialize array with empty items', function() { var a = []; a[1] = "X"; @@ -77,18 +73,15 @@ describe('json', function(){ expect(angular.toJson(obj)).toEqual('{"a":"b","recursion":RECURSION}'); }); - it('should ignore $ properties', function() { - var scope = createScope(); - scope.a = 'a'; - scope['$b'] = '$b'; - scope.c = 'c'; - expect(angular.toJson(scope)).toEqual('{"a":"a","c":"c","this":RECURSION}'); + it('should serialize $ properties', function() { + var obj = {$a: 'a'} + expect(angular.toJson(obj)).toEqual('{"$a":"a"}'); }); it('should serialize inherited properties', function() { - var scope = createScope({p:'p'}); - scope.a = 'a'; - expect(angular.toJson(scope)).toEqual('{"a":"a","p":"p","this":RECURSION}'); + var obj = inherit({p:'p'}); + obj.a = 'a'; + expect(angular.toJson(obj)).toEqual('{"a":"a","p":"p"}'); }); it('should serialize same objects multiple times', function() { -- cgit v1.2.3