Removed more code that supported browsers we no longer run on

This commit is contained in:
Steve Gravrock
2021-07-27 17:53:09 -07:00
parent e9bddc7a06
commit 09d2ce9bc9
4 changed files with 10 additions and 45 deletions

View File

@@ -2577,18 +2577,6 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
this.sample = sample;
}
function getPrototype(obj) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(obj);
}
if (obj.constructor.prototype == obj) {
return null;
}
return obj.constructor.prototype;
}
function hasProperty(obj, property) {
if (!obj || typeof obj !== 'object') {
return false;
@@ -2598,7 +2586,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
return true;
}
return hasProperty(getPrototype(obj), property);
return hasProperty(Object.getPrototypeOf(obj), property);
}
ObjectContaining.prototype.asymmetricMatch = function(other, matchersUtil) {

View File

@@ -268,15 +268,13 @@ describe('PrettyPrinter', function() {
});
it('should stringify immutable circular objects', function() {
if (Object.freeze) {
var pp = jasmineUnderTest.makePrettyPrinter();
var frozenObject = { foo: { bar: 'baz' } };
frozenObject.circular = frozenObject;
frozenObject = Object.freeze(frozenObject);
expect(pp(frozenObject)).toEqual(
"Object({ foo: Object({ bar: 'baz' }), circular: <circular reference: Object> })"
);
}
var pp = jasmineUnderTest.makePrettyPrinter();
var frozenObject = { foo: { bar: 'baz' } };
frozenObject.circular = frozenObject;
frozenObject = Object.freeze(frozenObject);
expect(pp(frozenObject)).toEqual(
"Object({ foo: Object({ bar: 'baz' }), circular: <circular reference: Object> })"
);
});
it('should stringify RegExp objects properly', function() {

View File

@@ -110,16 +110,7 @@ describe('ObjectContaining', function() {
var matchersUtil = new jasmineUnderTest.MatchersUtil();
var prototypeObject = { foo: 'fooVal' };
var obj;
if (Object.create) {
obj = Object.create(prototypeObject);
} else {
function Foo() {}
Foo.prototype = prototypeObject;
Foo.prototype.constructor = Foo;
obj = new Foo();
}
var obj = Object.create(prototypeObject);
expect(containing.asymmetricMatch(obj, matchersUtil)).toBe(true);
});

View File

@@ -3,18 +3,6 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
this.sample = sample;
}
function getPrototype(obj) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(obj);
}
if (obj.constructor.prototype == obj) {
return null;
}
return obj.constructor.prototype;
}
function hasProperty(obj, property) {
if (!obj || typeof obj !== 'object') {
return false;
@@ -24,7 +12,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
return true;
}
return hasProperty(getPrototype(obj), property);
return hasProperty(Object.getPrototypeOf(obj), property);
}
ObjectContaining.prototype.asymmetricMatch = function(other, matchersUtil) {