skip the test when we can’t get the propertyDescriptor
This commit is contained in:
@@ -418,8 +418,12 @@ describe("matchersUtil", function() {
|
|||||||
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
if (jasmine.getEnv().ieVersion < 9) { return; }
|
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||||
|
|
||||||
|
var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
|
||||||
|
if (!findIndexDescriptor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
this.origDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
|
|
||||||
Object.defineProperty(Array.prototype, 'findIndex', {
|
Object.defineProperty(Array.prototype, 'findIndex', {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
value: function (predicate) {
|
value: function (predicate) {
|
||||||
@@ -449,7 +453,7 @@ describe("matchersUtil", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
Object.defineProperty(Array.prototype, 'findIndex', this.origDescriptor);
|
Object.defineProperty(Array.prototype, 'findIndex', findIndexDescriptor);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes when there's an array polyfill", function() {
|
it("passes when there's an array polyfill", function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user