Merge branch 'main' into 3.99

This commit is contained in:
Steve Gravrock
2020-09-14 18:39:32 -07:00
82 changed files with 2725 additions and 1286 deletions

View File

@@ -63,7 +63,6 @@ describe('asymmetricEqualityTesterArgCompatShim', function() {
it('provides and deprecates properties of Array.prototype', function() {
var keys = [
'concat',
'constructor',
'every',
'filter',
'forEach',
@@ -82,8 +81,6 @@ describe('asymmetricEqualityTesterArgCompatShim', function() {
'some',
'sort',
'splice',
'toLocaleString',
'toString',
'unshift'
],
optionalKeys = [
@@ -142,4 +139,46 @@ describe('asymmetricEqualityTesterArgCompatShim', function() {
expect(deprecated).not.toHaveBeenCalled();
});
describe('When Array.prototype additions collide with MatchersUtil methods', function() {
function keys() {
return [
'contains',
'buildFailureMessage',
'asymmetricDiff_',
'asymmetricMatch_',
'equals',
'eq_'
];
}
beforeEach(function() {
keys().forEach(function(k) {
expect(Array.prototype[k])
.withContext('Array.prototype already had ' + k)
.toBeUndefined();
Array.prototype[k] = function() {};
});
});
afterEach(function() {
keys().forEach(function(k) {
delete Array.prototype[k];
});
});
it('uses the MatchersUtil methods', function() {
var matchersUtil = new jasmineUnderTest.MatchersUtil({}),
shim = jasmineUnderTest.asymmetricEqualityTesterArgCompatShim(
matchersUtil,
[]
);
keys().forEach(function(k) {
expect(shim[k])
.withContext(k + ' was overwritten')
.toBe(jasmineUnderTest.MatchersUtil.prototype[k]);
});
});
});
});