Pass custom testers to asymmetric testers
This allows custom equality testers to affect asymmetric matches. This avoid suprises when combining addCustomEqualityTester with objectContaining or arrayContaining. Closes #1138
This commit is contained in:
@@ -28,12 +28,12 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
return hasProperty(getPrototype(obj), property);
|
||||
}
|
||||
|
||||
ObjectContaining.prototype.asymmetricMatch = function(other) {
|
||||
ObjectContaining.prototype.asymmetricMatch = function(other, customTesters) {
|
||||
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 (!hasProperty(other, property) ||
|
||||
!j$.matchersUtil.equals(this.sample[property], other[property])) {
|
||||
!j$.matchersUtil.equals(this.sample[property], other[property], customTesters)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user