Updates pretty printer to include array properties
[fixes #766][finishes #87644044]
This commit is contained in:
@@ -93,6 +93,23 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
if(array.length > length){
|
||||
this.append(', ...');
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var first = array.length === 0;
|
||||
this.iterateObject(array, function(property, isGetter) {
|
||||
if (property.match(/^\d+$/)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
self.append(', ');
|
||||
}
|
||||
|
||||
self.formatProperty(array, property, isGetter);
|
||||
});
|
||||
|
||||
this.append(' ]');
|
||||
};
|
||||
|
||||
@@ -115,18 +132,22 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
self.append(', ');
|
||||
}
|
||||
|
||||
self.append(property);
|
||||
self.append(': ');
|
||||
if (isGetter) {
|
||||
self.append('<getter>');
|
||||
} else {
|
||||
self.format(obj[property]);
|
||||
}
|
||||
self.formatProperty(obj, property, isGetter);
|
||||
});
|
||||
|
||||
this.append(' })');
|
||||
};
|
||||
|
||||
StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
|
||||
this.append(property);
|
||||
this.append(': ');
|
||||
if (isGetter) {
|
||||
this.append('<getter>');
|
||||
} else {
|
||||
this.format(obj[property]);
|
||||
}
|
||||
};
|
||||
|
||||
StringPrettyPrinter.prototype.append = function(value) {
|
||||
this.string += value;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user