Permalink
Browse files

Remove space between key and colon when pretty printing objects

[#4005255]
  • Loading branch information...
1 parent c9e37a2 commit 21de44a2042289d50b0eb4d51ecbf3dfb9267dcc Greg Cobb and Luan Santos committed Mar 12, 2014
Showing with 14 additions and 14 deletions.
  1. +12 −12 spec/core/PrettyPrintSpec.js
  2. +1 −1 spec/html/PrettyPrintHtmlSpec.js
  3. +1 −1 src/core/PrettyPrinter.js
@@ -27,18 +27,18 @@ describe("j$.pp", function () {
});
it("should stringify objects properly", function() {
- expect(j$.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
- expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
+ expect(j$.pp({foo: 'bar'})).toEqual("{ foo: 'bar' }");
+ expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined }");
expect(j$.pp({foo: function () {
- }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
+ }, bar: [1, 2, 3]})).toEqual("{ foo: Function, bar: [ 1, 2, 3 ] }");
});
it("should not include inherited properties when stringifying an object", function() {
var SomeClass = function() {};
SomeClass.prototype.foo = "inherited foo";
var instance = new SomeClass();
instance.bar = "my own bar";
- expect(j$.pp(instance)).toEqual("{ bar : 'my own bar' }");
+ expect(j$.pp(instance)).toEqual("{ bar: 'my own bar' }");
});
it("should not recurse objects and arrays more deeply than j$.MAX_PRETTY_PRINT_DEPTH", function() {
@@ -48,15 +48,15 @@ describe("j$.pp", function () {
try {
j$.MAX_PRETTY_PRINT_DEPTH = 2;
- expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : Object } }");
+ expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: Object } }");
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
j$.MAX_PRETTY_PRINT_DEPTH = 3;
- expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : Object } } }");
+ expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: { level3: Object } } }");
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
j$.MAX_PRETTY_PRINT_DEPTH = 4;
- expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : { level4 : 'leaf' } } } }");
+ expect(j$.pp(nestedObject)).toEqual("{ level1: { level2: { level3: { level4: 'leaf' } } } }");
expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
} finally {
j$.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
@@ -67,7 +67,7 @@ describe("j$.pp", function () {
var frozenObject = {foo: {bar: 'baz'}};
frozenObject.circular = frozenObject;
frozenObject = Object.freeze(frozenObject);
- expect(j$.pp(frozenObject)).toEqual("{ foo : { bar : 'baz' }, circular : <circular reference: Object> }");
+ expect(j$.pp(frozenObject)).toEqual("{ foo: { bar: 'baz' }, circular: <circular reference: Object> }");
});
it("should stringify RegExp objects properly", function() {
@@ -77,7 +77,7 @@ describe("j$.pp", function () {
it("should indicate circular object references", function() {
var sampleValue = {foo: 'hello'};
sampleValue.nested = sampleValue;
- expect(j$.pp(sampleValue)).toEqual("{ foo : 'hello', nested : <circular reference: Object> }");
+ expect(j$.pp(sampleValue)).toEqual("{ foo: 'hello', nested: <circular reference: Object> }");
});
it("should indicate getters on objects as such", function() {
@@ -89,10 +89,10 @@ describe("j$.pp", function () {
});
}
if (sampleValue.__defineGetter__) {
- expect(j$.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
+ expect(j$.pp(sampleValue)).toEqual("{ id: 1, calculatedValue: <getter> }");
}
else {
- expect(j$.pp(sampleValue)).toEqual("{ id : 1 }");
+ expect(j$.pp(sampleValue)).toEqual("{ id: 1 }");
}
});
@@ -136,7 +136,7 @@ describe("j$.pp", function () {
var obj = Object.create(null);
obj.foo = 'bar';
- expect(j$.pp(obj)).toEqual("{ foo : 'bar' }");
+ expect(j$.pp(obj)).toEqual("{ foo: 'bar' }");
});
});
@@ -3,7 +3,7 @@ describe("j$.pp (HTML Dependent)", function () {
var sampleNode = document.createElement('div');
sampleNode.innerHTML = 'foo<b>bar</b>';
expect(j$.pp(sampleNode)).toEqual("HTMLNode");
- expect(j$.pp({foo: sampleNode})).toEqual("{ foo : HTMLNode }");
+ expect(j$.pp({foo: sampleNode})).toEqual("{ foo: HTMLNode }");
});
it("should print Firefox's wrapped native objects correctly", function() {
@@ -111,7 +111,7 @@ getJasmineRequireObj().pp = function(j$) {
}
self.append(property);
- self.append(' : ');
+ self.append(': ');
if (isGetter) {
self.append('<getter>');
} else {

0 comments on commit 21de44a

Please sign in to comment.