Revert "toContain works with array-like objects (Arguments, HTMLCollections, etc)"
IE 8 doesn't have Array.prototype.indexOf so this breaks there.
Reverting until we can figure out a better way to solve across all
supported browsers.
This reverts commit 663fbd0cdb.
This commit is contained in:
@@ -2195,12 +2195,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!haystack) {
|
return !!haystack && haystack.indexOf(needle) >= 0;
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
var indexOf = haystack.indexOf || Array.prototype.indexOf;
|
|
||||||
return indexOf.call(haystack, needle) >= 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
buildFailureMessage: function() {
|
buildFailureMessage: function() {
|
||||||
|
|||||||
@@ -207,15 +207,6 @@ describe("matchersUtil", function() {
|
|||||||
it("fails when actual is null", function() {
|
it("fails when actual is null", function() {
|
||||||
expect(j$.matchersUtil.contains(null, 'A')).toBe(false);
|
expect(j$.matchersUtil.contains(null, 'A')).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes with array-like objects", function() {
|
|
||||||
var capturedArgs = null;
|
|
||||||
function testFunction(){
|
|
||||||
capturedArgs = arguments;
|
|
||||||
}
|
|
||||||
testFunction('foo', 'bar');
|
|
||||||
expect(j$.matchersUtil.contains(capturedArgs, 'bar')).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("buildMessage", function() {
|
describe("buildMessage", function() {
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!haystack) {
|
return !!haystack && haystack.indexOf(needle) >= 0;
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
var indexOf = haystack.indexOf || Array.prototype.indexOf;
|
|
||||||
return indexOf.call(haystack, needle) >= 0;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
buildFailureMessage: function() {
|
buildFailureMessage: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user