Skip to content

Commit

Permalink
Adding Symbol.unscopables tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 17, 2015
1 parent acc74f1 commit a132d6e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ var runArrayTests = function () {
expect(Array.prototype.slice.call(args)).to.eql([1, 1, 2]);
expect(Object.prototype.toString.call(args)).to.equal(argsClass);
});

ifSymbolUnscopablesIt('should be unscopable if Symbols exist', function () {
var unscopables = Array.prototype[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.copyWithin).to.equal(true);
});
});

describe('Array#find', function () {
Expand Down Expand Up @@ -425,6 +431,12 @@ var runArrayTests = function () {
expect(found).to.equal(undefined);
expect(seen).to.eql([[0, 1], [1, undefined], [2, undefined]]);
});

ifSymbolUnscopablesIt('should be unscopable if Symbols exist', function () {
var unscopables = Array.prototype[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.find).to.equal(true);
});
});

describe('Array#findIndex', function () {
Expand Down Expand Up @@ -512,6 +524,12 @@ var runArrayTests = function () {
expect(foundIndex).to.equal(-1);
expect(seen).to.eql([[0, 1], [1, undefined], [2, undefined]]);
});

ifSymbolUnscopablesIt('should be unscopable if Symbols exist', function () {
var unscopables = Array.prototype[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.findIndex).to.equal(true);
});
});

describe('ArrayIterator', function () {
Expand Down Expand Up @@ -812,6 +830,12 @@ var runArrayTests = function () {

expect(original.fill(-1, 9)).to.eql(filled);
});

ifSymbolUnscopablesIt('should be unscopable if Symbols exist', function () {
var unscopables = Array.prototype[Sym.unscopables];
expect(!!unscopables).to.equal(true);
expect(unscopables.fill).to.equal(true);
});
});
});
};
Expand Down

0 comments on commit a132d6e

Please sign in to comment.