diff --git a/spec/core/PrettyPrintSpec.js b/spec/core/PrettyPrintSpec.js index 9604ada1..a844730f 100644 --- a/spec/core/PrettyPrintSpec.js +++ b/spec/core/PrettyPrintSpec.js @@ -27,10 +27,10 @@ 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() { @@ -38,7 +38,7 @@ describe("j$.pp", 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 : }"); + expect(j$.pp(frozenObject)).toEqual("{ foo: { bar: 'baz' }, circular: }"); }); 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 : }"); + expect(j$.pp(sampleValue)).toEqual("{ foo: 'hello', nested: }"); }); 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 : }"); + expect(j$.pp(sampleValue)).toEqual("{ id: 1, calculatedValue: }"); } 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' }"); }); }); diff --git a/spec/html/PrettyPrintHtmlSpec.js b/spec/html/PrettyPrintHtmlSpec.js index 7eea6672..3c5e15f4 100644 --- a/spec/html/PrettyPrintHtmlSpec.js +++ b/spec/html/PrettyPrintHtmlSpec.js @@ -3,7 +3,7 @@ describe("j$.pp (HTML Dependent)", function () { var sampleNode = document.createElement('div'); sampleNode.innerHTML = 'foobar'; 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() { diff --git a/src/core/PrettyPrinter.js b/src/core/PrettyPrinter.js index 2898a3d1..f59bfc3c 100644 --- a/src/core/PrettyPrinter.js +++ b/src/core/PrettyPrinter.js @@ -111,7 +111,7 @@ getJasmineRequireObj().pp = function(j$) { } self.append(property); - self.append(' : '); + self.append(': '); if (isGetter) { self.append(''); } else {