Fixed comparison between ObjectContaining and non-objects on IE

This commit is contained in:
Steve Gravrock
2019-09-28 18:39:43 -07:00
parent 472f61ab37
commit ef3f127d27
2 changed files with 4 additions and 2 deletions

View File

@@ -2495,7 +2495,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}
function hasProperty(obj, property) {
if (!obj) {
if (!obj || typeof(obj) !== 'object') {
return false;
}
@@ -2508,6 +2508,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
ObjectContaining.prototype.asymmetricMatch = function(other, customTesters) {
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
// TODO: This succeeds when sample is an empty object and other is a non-object, but should probably fail
for (var property in this.sample) {
if (!hasProperty(other, property) ||

View File

@@ -17,7 +17,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
}
function hasProperty(obj, property) {
if (!obj) {
if (!obj || typeof(obj) !== 'object') {
return false;
}
@@ -30,6 +30,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
ObjectContaining.prototype.asymmetricMatch = function(other, customTesters) {
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
// TODO: This succeeds when sample is an empty object and other is a non-object, but should probably fail
for (var property in this.sample) {
if (!hasProperty(other, property) ||