From af0ad6561c0d75c4f155b07e9cfc36a983af55bd Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 28 Mar 2012 12:21:07 -0700 Subject: refactor(fromJson/toJson): move the contents of these files into Angular.js these files are now mostly empty so it doesn't make sense to keep them separated from other helper functions --- test/JsonSpec.js | 58 -------------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 test/JsonSpec.js (limited to 'test/JsonSpec.js') diff --git a/test/JsonSpec.js b/test/JsonSpec.js deleted file mode 100644 index 5ca3e42e..00000000 --- a/test/JsonSpec.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -describe('json', function() { - - describe('fromJson', function() { - - it('should delegate to JSON.parse', function() { - var spy = spyOn(JSON, 'parse').andCallThrough(); - - expect(fromJson('{}')).toEqual({}); - expect(spy).toHaveBeenCalled(); - }); - }); - - - describe('toJson', function() { - - it('should delegate to JSON.stringify', function() { - var spy = spyOn(JSON, 'stringify').andCallThrough(); - - expect(toJson({})).toEqual('{}'); - expect(spy).toHaveBeenCalled(); - }); - - - it('should format objects pretty', function() { - expect(toJson({a: 1, b: 2}, true)). - toBeOneOf('{\n "a": 1,\n "b": 2\n}', '{\n "a":1,\n "b":2\n}'); - expect(toJson({a: {b: 2}}, true)). - toBeOneOf('{\n "a": {\n "b": 2\n }\n}', '{\n "a":{\n "b":2\n }\n}'); - }); - - - it('should not serialize properties starting with $', function() { - expect(toJson({$few: 'v', $$some:'value'}, false)).toEqual('{}'); - }); - - - 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 not serialize scope instances', inject(function($rootScope) { - expect(toJson({key: $rootScope})).toEqual('{"key":"$SCOPE"}'); - })); - }); -}); -- cgit v1.2.3