27 lines
729 B
JavaScript
27 lines
729 B
JavaScript
getJasmineRequireObj().ArrayContaining = function(j$) {
|
|
function ArrayContaining(sample) {
|
|
this.sample = sample;
|
|
}
|
|
|
|
ArrayContaining.prototype.asymmetricMatch = function(other, customTesters) {
|
|
if (!j$.isArray_(this.sample)) {
|
|
throw new Error('You must provide an array to arrayContaining, not ' + j$.pp(this.sample) + '.');
|
|
}
|
|
|
|
for (var i = 0; i < this.sample.length; i++) {
|
|
var item = this.sample[i];
|
|
if (!j$.matchersUtil.contains(other, item, customTesters)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
ArrayContaining.prototype.jasmineToString = function () {
|
|
return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
|
|
};
|
|
|
|
return ArrayContaining;
|
|
};
|