Use === when checking for circular dependencies for pretty printing.
This commit is contained in:
@@ -26,6 +26,11 @@ describe("j$.pp", function () {
|
|||||||
expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
|
expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not indicate circular references incorrectly", function() {
|
||||||
|
var array = [ [1] ];
|
||||||
|
expect(j$.pp(array)).toEqual("[ [ 1 ] ]");
|
||||||
|
});
|
||||||
|
|
||||||
it("should stringify objects properly", function() {
|
it("should stringify objects properly", function() {
|
||||||
expect(j$.pp({foo: 'bar'})).toEqual("{ foo: 'bar' }");
|
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', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined }");
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ getJasmineRequireObj().util = function() {
|
|||||||
util.arrayContains = function(array, search) {
|
util.arrayContains = function(array, search) {
|
||||||
var i = array.length;
|
var i = array.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (array[i] == search) {
|
if (array[i] === search) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user