Use === when checking for circular dependencies for pretty printing.

This commit is contained in:
slackersoft
2014-09-13 18:58:02 -07:00
parent e8178d061b
commit 84dff421ea
2 changed files with 6 additions and 1 deletions

View File

@@ -26,6 +26,11 @@ describe("j$.pp", function () {
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() {
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 }");

View File

@@ -33,7 +33,7 @@ getJasmineRequireObj().util = function() {
util.arrayContains = function(array, search) {
var i = array.length;
while (i--) {
if (array[i] == search) {
if (array[i] === search) {
return true;
}
}