- Also move the asymmetric testers into their own dir for easier locating. [#58120558] Fix #243
26 lines
742 B
JavaScript
26 lines
742 B
JavaScript
getJasmineRequireObj().ObjectContaining = function(j$) {
|
|
|
|
function ObjectContaining(sample) {
|
|
this.sample = sample;
|
|
}
|
|
|
|
ObjectContaining.prototype.asymmetricMatch = function(other) {
|
|
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
|
|
|
|
for (var property in this.sample) {
|
|
if (!Object.prototype.hasOwnProperty.call(other, property) ||
|
|
!j$.matchersUtil.equals(this.sample[property], other[property])) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
ObjectContaining.prototype.jasmineToString = function() {
|
|
return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
|
|
};
|
|
|
|
return ObjectContaining;
|
|
};
|