Merge branch 'main' into 3.99
This commit is contained in:
24
src/core/asymmetric_equality/StringContaining.js
Normal file
24
src/core/asymmetric_equality/StringContaining.js
Normal file
@@ -0,0 +1,24 @@
|
||||
getJasmineRequireObj().StringContaining = function(j$) {
|
||||
function StringContaining(expected) {
|
||||
if (!j$.isString_(expected)) {
|
||||
throw new Error('Expected is not a String');
|
||||
}
|
||||
|
||||
this.expected = expected;
|
||||
}
|
||||
|
||||
StringContaining.prototype.asymmetricMatch = function(other) {
|
||||
if (!j$.isString_(other)) {
|
||||
// Arrays, etc. don't match no matter what their indexOf returns.
|
||||
return false;
|
||||
}
|
||||
|
||||
return other.indexOf(this.expected) !== -1;
|
||||
};
|
||||
|
||||
StringContaining.prototype.jasmineToString = function() {
|
||||
return '<jasmine.stringContaining("' + this.expected + '")>';
|
||||
};
|
||||
|
||||
return StringContaining;
|
||||
};
|
||||
Reference in New Issue
Block a user